Skip to content

Commit 7f5368f

Browse files
committed
Modify the Rake compile task to exclude native:
- I know it feels kind of a weird change as we only perform native compilation on CI. The issue is that RakeCompiler wasn't really meant to build fat gems for native compilation. Native compilation with Rake Compiler was meant for development purposes to compile the project and test it. When the compilation kicks in, we build `3.1/foo.so` `3.2/foo.so` but we also end up with a `foo.so` that gets compiled at `lib/foo.so`. The workaround we do to make Rake Compiler build fat gems natively is hacking it by pretending we are doing cross platform compilation using `ext.platform = [RUBY_PLATFORM]`.
1 parent bac9d2e commit 7f5368f

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

lib/cibuildgem/compilation_tasks.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def define_task(path, binary_name)
6060
ext.gem_spec = gemspec
6161
ext.cross_platform = normalized_platform
6262
ext.cross_compile = true
63+
ext.no_native = true
6364
end
6465

6566
disable_shared unless Gem.win_platform?

lib/cibuildgem/tasks/wrapper.rake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ require_relative "../compilation_tasks"
55
task = Cibuildgem::CompilationTasks.new(!Rake::Task.task_defined?(:gem))
66

77
task "cibuildgem:setup" do
8-
Rake.application.instance_variable_get(:@tasks).delete_if do |name, _|
9-
name == "native:#{task.gemspec.name}:#{task.normalized_platform}"
10-
end
11-
128
task.setup
139
end
1410

0 commit comments

Comments
 (0)