diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb index 24c1d3ae6e..3377c9a8ad 100644 --- a/lib/rubygems/ext/cargo_builder.rb +++ b/lib/rubygems/ext/cargo_builder.rb @@ -52,7 +52,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder cmd += ["--manifest-path", manifest] cmd += ["--lib"] cmd += ["--profile", profile.to_s] - cmd += ["--locked"] if profile == :release + cmd += ["--locked"] cmd += Gem::Command.build_args cmd += args cmd += ["--"] @@ -75,7 +75,6 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder *rustc_dynamic_linker_flags(dest_dir), *rustc_lib_flags(dest_dir), *platform_specific_rustc_args(dest_dir), - *debug_flags, ] end @@ -149,7 +148,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder prefix = so_ext == "dll" ? "" : "lib" path_parts = [dest_path] path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"] - path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"] + path_parts += ["release", "#{prefix}#{cargo_crate_name}.#{so_ext}"] File.join(*path_parts) end @@ -254,13 +253,6 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder RbConfig.expand(val.dup) end - # Good balance between binary size and debugability - def debug_flags - return [] if profile == :dev - - ["-C", "debuginfo=1"] - end - # Copied from ExtConfBuilder def finalize_directory(dest_path, lib_dir, extension_dir) require "fileutils" @@ -299,14 +291,6 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder path end - def profile_target_directory - case profile - when :release then "release" - when :dev then "debug" - else raise "unknown target directory for profile: #{profile}" - end - end - # Error raised when no cdylib artifact was created class DylibNotFoundError < StandardError def initialize(dir) diff --git a/test/rubygems/test_gem_ext_cargo_builder.rb b/test/rubygems/test_gem_ext_cargo_builder.rb index c6bbab2cb3..c2c903daca 100644 --- a/test/rubygems/test_gem_ext_cargo_builder.rb +++ b/test/rubygems/test_gem_ext_cargo_builder.rb @@ -65,31 +65,6 @@ class TestGemExtCargoBuilder < Gem::TestCase raise(e) end - def test_build_dev_profile - skip_unsupported_platforms! - setup_rust_gem "rust_ruby_example" - - output = [] - - Dir.chdir @ext do - ENV.update(@rust_envs) - spec = Gem::Specification.new "rust_ruby_example", "0.1.0" - builder = Gem::Ext::CargoBuilder.new(spec) - builder.profile = :dev - builder.build nil, @dest_path, output - end - - output = output.join "\n" - bundle = File.join(@dest_path, "debug/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}") - - assert_match "Finished dev [unoptimized + debuginfo] target(s)", output - assert_ffi_handle bundle, "Init_rust_ruby_example" - rescue Exception => e - pp output if output - - raise(e) - end - def test_build_fail skip_unsupported_platforms! setup_rust_gem "rust_ruby_example"