Conversation
2dfe44b to
6b81423
Compare
|
Putting this in draft temporarily until we are aligned on any changes needed to the |
|
|
af1a67b to
8096128
Compare
|
This PR is looking good to me 👍 |
|
Updated PR description: TLDRAdds Includes commits from #9906, please look at the last commit. Description
When TestingA one-file gem packaged with # Rakefile
require "rubygems/package_task"
spec = Gem::Specification.new do |s|
s.name = "hello"
s.version = "1.0.0"
s.summary = "hello"
s.authors = ["x"]
s.files = ["lib/hello.rb"]
s.platform = "arm64-darwin"
s.required_ruby_version = "~> 4.0.0"
end
Gem::PackageTask.new(spec) do |pkg|
pkg.content_addressable = true
end$ rake gem
Successfully built RubyGem
File: hello-1.0.0-fa8b73c3.gem
Platform: arm64-darwin
Ruby ABI: 4.0
$ ls -p pkg
hello-1.0.0-arm64-darwin-4.0/ # staging dir, suffixed with the ABI
hello-1.0.0-arm64-darwin-4.0.gem-built # stamp, the Rake target
hello-1.0.0-fa8b73c3.gem # the gem
$ cat pkg/hello-1.0.0-arm64-darwin-4.0.gem-built
pkg/hello-1.0.0-fa8b73c3.gem |
8c0d3cc to
1899306
Compare
1899306 to
32715dd
Compare
…ntent addressable gem
Adds Gem::PackageTask#content_addressable. When true, the gem task builds a content addressable gem for the single Ruby ABI identified by gem_spec.required_ruby_version, passing content_addressable through to Gem::Package.build. A content addressable gem's file name contains a hash of its contents, so it isn't known until the gem is built and can't be a Rake target. In this mode the task uses a stamp file (pkg/<full_name>-<ruby abi>.gem-built) as its Rake target, writes the built gem's path into it, and rebuilds when the referenced gem no longer exists. The staging directory is suffixed with the Ruby ABI (pkg/<full_name>-<ruby abi>) so per-ABI builds of the same full_name don't share a directory. When content_addressable is false, behaviour is unchanged.
32715dd to
c138e1f
Compare
#9900
NB Blocked behind: #9906 which changes the arguments for Gem::Package.build.
TLDR
Adds support to
Gem::PackageTaskfor building single-ABI, content-addressable gems.Description
This PR:
Adds an optional
ruby_abiattribute toGem::PackageTask.Passes
ruby_abitoGem::Package.build, allowing it to produce a content-addressable gem for thatRuby ABI.
Uses a predictable
.gem-builtstamp file as the Rake build target whenruby_abiis present. Thisis necessary because the content-addressable gem filename contains a hash that is not known until the
gem has been built.
Writes the path of the generated content-addressable gem into the stamp file. When
ruby_abiis notprovided,
Gem::PackageTaskretains its existing behaviour and uses the traditional gem path as itsbuild target.
Testing
Tests in
test_gem_package_task.rbverify that:ruby_abiis passed toGem::Package.build;Gem::Package.buildis moved into the package directory;Top Hat
This has been top-hatted as part of the complete flow. See the cibuildgem CA support PR for more information.