summaryrefslogtreecommitdiff
path: root/tool/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-16 15:43:28 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-16 17:28:00 +0900
commit9f708d48f6df37ee9600db9d51b57a156609a13b (patch)
treea7d21ce02ad440f55559ceea3ad296d8d21378d2 /tool/lib
parent4047222aca02a35774746eb91c5661427410149e (diff)
Clear runtime dependencies if default gems is specified.
The current build system uses runtime dependencies from only `.bundle` directory. We shouldn't install runtime dependencies from rubygems.org when `make test-bundled-gems` is invoked.
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/bundled_gem.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
index bfc0be1c81..4c9568a1f1 100644
--- a/tool/lib/bundled_gem.rb
+++ b/tool/lib/bundled_gem.rb
@@ -6,6 +6,15 @@ require 'rubygems/package'
# unpack bundled gem files.
module BundledGem
+ DEFAULT_GEMS_DEPENDENCIES = %w[
+ net-protocol # net-ftp
+ time # net-ftp
+ singleton # prime
+ ipaddr # rinda
+ forwardable # prime, rinda
+ ruby2_keywords # drb
+ ]
+
module_function
def unpack(file, *rest)
@@ -55,6 +64,9 @@ module BundledGem
gem_dir = File.join(dir, "gems", target)
yield gem_dir
spec_dir = spec.extensions.empty? ? "specifications" : File.join("gems", target)
+ if spec.extensions.empty?
+ spec.dependencies.reject! {|dep| DEFAULT_GEMS_DEPENDENCIES.include?(dep.name)}
+ end
File.binwrite(File.join(dir, spec_dir, "#{target}.gemspec"), spec.to_ruby)
unless spec.extensions.empty?
spec.dependencies.clear