Class: RubyWasm::Packager::Core::BuildStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_wasm/packager/core.rb

Direct Known Subclasses

DynamicLinking, StaticLinking

Instance Method Summary collapse

Constructor Details

#initialize(packager) ⇒ BuildStrategy

Returns a new instance of BuildStrategy.



32
33
34
# File 'lib/ruby_wasm/packager/core.rb', line 32

def initialize(packager)
  @packager = packager
end

Instance Method Details

#artifactObject

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/ruby_wasm/packager/core.rb', line 74

def artifact
  raise NotImplementedError
end

#build(executor, options) ⇒ Object

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/ruby_wasm/packager/core.rb', line 36

def build(executor, options)
  raise NotImplementedError
end

#build_gem_exts(executor, gem_home) ⇒ Object

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/ruby_wasm/packager/core.rb', line 40

def build_gem_exts(executor, gem_home)
  raise NotImplementedError
end

#cache_key(digest) ⇒ Object

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/ruby_wasm/packager/core.rb', line 70

def cache_key(digest)
  raise NotImplementedError
end

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/ruby_wasm/packager/core.rb', line 44

def link_gem_exts(executor, ruby_root, gem_home, module_bytes)
  raise NotImplementedError
end

#specs_with_extensionsObject

Array of paths to extconf.rb files.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ruby_wasm/packager/core.rb', line 49

def specs_with_extensions
  @packager.specs.filter_map do |spec|
    exts =
      spec.extensions.select do |ext|
        # Filter out extensions of default gems (e.g. json, openssl)
        # for the exactly same gem version.
        File.exist?(File.join(spec.full_gem_path, ext))
      end
    next nil if exts.empty?
    [spec, exts]
  end
end

#with_unbundled_env(&block) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/ruby_wasm/packager/core.rb', line 62

def with_unbundled_env(&block)
  __skip__ = if defined?(Bundler)
    Bundler.with_unbundled_env(&block)
  else
    block.call
  end
end