cibuildgem 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cibuildgem/cli.rb +41 -9
- data/lib/cibuildgem/compilation_tasks.rb +19 -2
- data/lib/cibuildgem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da5409562c657378fb90d4f47e47227b9db5d647d179f7f9814ee96409e5e28e
|
|
4
|
+
data.tar.gz: 7a91e89c2aa9fc6159b69dfdcfb55072ec6c2dad4d84629da51de84dde1af992
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b590a75b1288f5a2dbf7318b2fc76eb2ab37203318ba5e5429d6c8afc50962bcd50f0343f2d85ea680d3435ac91334392cd3854b007f95be2fb92ad9a8f2cfe
|
|
7
|
+
data.tar.gz: 1d3c96ff0c538804a9ccfcfe6187b0819bc1ccf910bccf994b1bb69d190071a507e3c3902c59a5d6256d01e6809f12512a6eca5aede166ae3cd00ec0864cc6cd
|
data/lib/cibuildgem/cli.rb
CHANGED
|
@@ -11,6 +11,10 @@ module Cibuildgem
|
|
|
11
11
|
|
|
12
12
|
source_root(File.expand_path("templates", __dir__))
|
|
13
13
|
|
|
14
|
+
# RubyGems already restricts a gem's name, version and platform to these characters, so every filename
|
|
15
|
+
# `cibuildgem package` can legitimately produce matches. Anything else was not produced by the package task.
|
|
16
|
+
RELEASABLE_GEM_FILENAME = /\A[A-Za-z0-9._-]+\.gem\z/
|
|
17
|
+
|
|
14
18
|
class << self
|
|
15
19
|
def exit_on_failure?
|
|
16
20
|
true
|
|
@@ -32,7 +36,7 @@ module Cibuildgem
|
|
|
32
36
|
run_rake_tasks!("cibuildgem:setup", :compile)
|
|
33
37
|
end
|
|
34
38
|
|
|
35
|
-
desc "package", "Compile and package a '
|
|
39
|
+
desc "package", "Compile and package a 'multi-ABI gem'.", hide: true
|
|
36
40
|
long_desc <<~MSG
|
|
37
41
|
This command should normally run on CI, using the cibuildgem workflow. It will not work locally unless
|
|
38
42
|
the environment is properly setup.
|
|
@@ -42,13 +46,20 @@ module Cibuildgem
|
|
|
42
46
|
- A gem without precompiled binary (Ruby platform).
|
|
43
47
|
|
|
44
48
|
The gem with precompiled binaries will be packaged with multiple binaries compatible for different
|
|
45
|
-
Ruby ABI (depending on what Ruby version the gem supports).
|
|
49
|
+
Ruby ABI (depending on what Ruby version the gem supports). If `--include-single-abi` is passed,
|
|
50
|
+
cibuildgem will also compile a set of single-ABI gems per Ruby version supported by the gem.
|
|
46
51
|
MSG
|
|
47
52
|
method_option "gemspec", type: "string", required: false, desc: "The gemspec to use. Defaults to the gemspec from the current working directory."
|
|
53
|
+
method_option "include-single-abi", type: :boolean, required: false, default: false, desc: "Whether to also compile a set of single-ABI gems. Defaults to false."
|
|
48
54
|
def package
|
|
49
55
|
ENV["RUBY_CC_VERSION"] ||= compilation_task.ruby_cc_version
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
run_rake_tasks!(
|
|
57
|
+
"cibuildgem:setup",
|
|
58
|
+
:cross,
|
|
59
|
+
:native,
|
|
60
|
+
:gem,
|
|
61
|
+
env: { "CIBUILDGEM_CONTENT_ADDRESSABLE" => options["include-single-abi"] == true ? "true" : "false" },
|
|
62
|
+
)
|
|
52
63
|
end
|
|
53
64
|
|
|
54
65
|
desc "test", "Run the test suites of the target gem"
|
|
@@ -113,7 +124,9 @@ module Cibuildgem
|
|
|
113
124
|
pathname = Pathname(file)
|
|
114
125
|
next if pathname.directory? || pathname.extname != ".gem"
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
verify_releasable_filename!(pathname)
|
|
128
|
+
|
|
129
|
+
out, status = Open3.capture2e("gem", "push", file)
|
|
117
130
|
next if status.success?
|
|
118
131
|
|
|
119
132
|
if out =~ /Repushing of gem versions is not allowed/
|
|
@@ -139,8 +152,20 @@ module Cibuildgem
|
|
|
139
152
|
|
|
140
153
|
private
|
|
141
154
|
|
|
142
|
-
def
|
|
143
|
-
|
|
155
|
+
def verify_releasable_filename!(pathname)
|
|
156
|
+
basename = pathname.basename.to_s
|
|
157
|
+
return if RELEASABLE_GEM_FILENAME.match?(basename)
|
|
158
|
+
|
|
159
|
+
raise(<<~MSG)
|
|
160
|
+
Refusing to publish #{basename.inspect}.
|
|
161
|
+
|
|
162
|
+
A gem filename may only contain letters, digits, dots, dashes and underscores, so this file was not
|
|
163
|
+
produced by `cibuildgem package`. Artifacts reach the release job from the compile job, which runs
|
|
164
|
+
without publishing credentials, so an unexpected filename is treated as tampering rather than a gem.
|
|
165
|
+
MSG
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def run_rake_tasks!(*tasks, env: {})
|
|
144
169
|
rakelibdir = [File.expand_path("tasks", __dir__), "rakelib"].join(File::PATH_SEPARATOR)
|
|
145
170
|
rake_compiler_path = Gem.loaded_specs["rake-compiler"].full_require_paths
|
|
146
171
|
rake_specs = Gem.loaded_specs["rake"]
|
|
@@ -151,8 +176,15 @@ module Cibuildgem
|
|
|
151
176
|
patch = File.expand_path("../extension_patch.rb", __FILE__)
|
|
152
177
|
|
|
153
178
|
system(
|
|
154
|
-
{ "RUBYLIB" => load_paths },
|
|
155
|
-
"bundle
|
|
179
|
+
{ "RUBYLIB" => load_paths }.merge(env),
|
|
180
|
+
"bundle",
|
|
181
|
+
"exec",
|
|
182
|
+
RbConfig.ruby,
|
|
183
|
+
rake_executable,
|
|
184
|
+
*tasks.map(&:to_s),
|
|
185
|
+
"-R#{rakelibdir}",
|
|
186
|
+
"-r",
|
|
187
|
+
patch,
|
|
156
188
|
exception: true,
|
|
157
189
|
)
|
|
158
190
|
end
|
|
@@ -7,13 +7,18 @@ require_relative "create_makefile_finder"
|
|
|
7
7
|
|
|
8
8
|
module Cibuildgem
|
|
9
9
|
class CompilationTasks
|
|
10
|
-
attr_reader :gemspec, :native, :create_packaging_task, :extension_task
|
|
10
|
+
attr_reader :gemspec, :native, :create_packaging_task, :extension_task, :content_addressable
|
|
11
11
|
|
|
12
|
-
def initialize(
|
|
12
|
+
def initialize(
|
|
13
|
+
create_packaging_task = false,
|
|
14
|
+
gemspec = nil,
|
|
15
|
+
content_addressable: ENV["CIBUILDGEM_CONTENT_ADDRESSABLE"] == "true"
|
|
16
|
+
)
|
|
13
17
|
@gemspec = Bundler.load_gemspec(gemspec || find_gemspec)
|
|
14
18
|
verify_gemspec!
|
|
15
19
|
|
|
16
20
|
@create_packaging_task = create_packaging_task
|
|
21
|
+
@content_addressable = content_addressable
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
def setup
|
|
@@ -62,6 +67,14 @@ module Cibuildgem
|
|
|
62
67
|
@extension_task.cross_platform = normalized_platform
|
|
63
68
|
@extension_task.cross_compile = true
|
|
64
69
|
@extension_task.no_native = true
|
|
70
|
+
if content_addressable
|
|
71
|
+
if @extension_task.respond_to?(:content_addressable=)
|
|
72
|
+
@extension_task.content_addressable = true
|
|
73
|
+
else
|
|
74
|
+
warn("WARNING: content-addressable packaging was requested, but rake-compiler #{rake_compiler_version} " \
|
|
75
|
+
"does not support it. Upgrade rake-compiler to >= 1.3.2 to build single-ABI gems.")
|
|
76
|
+
end
|
|
77
|
+
end
|
|
65
78
|
|
|
66
79
|
Rake::ExtensionTask.enable!
|
|
67
80
|
@extension_task.define
|
|
@@ -69,6 +82,10 @@ module Cibuildgem
|
|
|
69
82
|
disable_shared unless Gem.win_platform?
|
|
70
83
|
end
|
|
71
84
|
|
|
85
|
+
def rake_compiler_version
|
|
86
|
+
Gem.loaded_specs["rake-compiler"]&.version&.to_s || "unknown"
|
|
87
|
+
end
|
|
88
|
+
|
|
72
89
|
def binary_lib_dir(binary_name)
|
|
73
90
|
dir = File.dirname(binary_name)
|
|
74
91
|
return if dir == "."
|
data/lib/cibuildgem/version.rb
CHANGED