summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/build_command.rb5
-rw-r--r--lib/rubygems/specification.rb4
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index decdca06bb..eaf8573d8f 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -1,11 +1,16 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
+require 'rubygems/version_option'
class Gem::Commands::BuildCommand < Gem::Command
+ include Gem::VersionOption
+
def initialize
super 'build', 'Build a gem from a gemspec'
+ add_platform_option
+
add_option '--force', 'skip validation of the spec' do |value, options|
options[:force] = true
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 883cad35f9..dc93adb5ab 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1991,6 +1991,10 @@ class Gem::Specification < Gem::BasicSpecification
self.name = name if name
self.version = version if version
+ if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local
+ self.platform = platform
+ end
+
yield self if block_given?
end