From 30ea3b9bd24819a09b83b0ef262982c1872cfc76 Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Thu, 13 Nov 2025 15:58:31 +0100 Subject: [PATCH 1/3] WIP --- lib/easy_compile/compilation_tasks.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/easy_compile/compilation_tasks.rb b/lib/easy_compile/compilation_tasks.rb index 8091a82..79be278 100644 --- a/lib/easy_compile/compilation_tasks.rb +++ b/lib/easy_compile/compilation_tasks.rb @@ -57,8 +57,10 @@ def with_mkmf_monkey_patch instance = self + previous_create_makefile = method(:create_makefile) Object.define_method(:create_makefile) do |name, *args| instance.binary_name = name + previous_create_makefile.call(name, *args) end Object.define_method(:create_rust_makefile) do |name, *args| From e650ee82e96f7e6979750e7c8ae92bea1bb65767 Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Thu, 13 Nov 2025 16:32:06 +0100 Subject: [PATCH 2/3] Take in consideration that the target gem has a rakelibdir --- lib/easy_compile/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/easy_compile/cli.rb b/lib/easy_compile/cli.rb index eeb7af4..e5dec7b 100644 --- a/lib/easy_compile/cli.rb +++ b/lib/easy_compile/cli.rb @@ -129,7 +129,7 @@ def print_normalized_platform def run_rake_tasks!(*tasks) all_tasks = tasks.join(" ") - rakelibdir = File.expand_path("tasks", __dir__) + rakelibdir = [File.expand_path("tasks", __dir__), "rakelib"].join(File::PATH_SEPARATOR) rake_compiler_path = Gem.loaded_specs["rake-compiler"].full_require_paths rake_specs = Gem.loaded_specs["rake"] rake_executable = rake_specs.bin_file("rake") From d78f906e8254569230ae5ff1136b34dd316ffb5b Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Thu, 13 Nov 2025 19:44:35 +0100 Subject: [PATCH 3/3] Workaround gem that configure Rake Compiler for packaging: - The problem is here https://github.com/rake-compiler/rake-compiler/blob/f65f1f2a4f6ce3c0c54ca28fb4d857801e899f3a/lib/rake/extensiontask.rb#L261 If a gem has a Rakefile that looks like `Rake::ExtensionTask.new('foo', gemspec)`, then Rake Compiler sets up packaging, which then conflicts with our own packacing task. The result is that the required_ruby_version that get dynamically set https://github.com/rake-compiler/rake-compiler/blob/f65f1f2a4f6ce3c0c54ca28fb4d857801e899f3a/lib/rake/extensiontask.rb#L276 is incorrect. Not super happy with this patch but I'll go with it for now --- lib/easy_compile/tasks/wrapper.rake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/easy_compile/tasks/wrapper.rake b/lib/easy_compile/tasks/wrapper.rake index 3ccca5d..f4670e4 100644 --- a/lib/easy_compile/tasks/wrapper.rake +++ b/lib/easy_compile/tasks/wrapper.rake @@ -5,6 +5,10 @@ require_relative "../compilation_tasks" task = EasyCompile::CompilationTasks.new(!Rake::Task.task_defined?(:package)) task "easy_compile:setup" do + Rake.application.instance_variable_get(:@tasks).delete_if do |name, _| + name == "native:#{task.gemspec.name}:#{task.normalized_platform}" + end + task.setup end