Skip to content

Commit 7681a7e

Browse files
committed
Handle additional edge cases in puppet.gemspec
Previously, running `gem build puppet.gemspec` on windows included the windows-specific runtime dependencies in the "ruby" puppet-<version>.gem, because of the `Gem.win_platform?` condition. Now add the runtime dependencies if we're running on that platform via bundler. or if we're building a gem for that platform. In the latter case, it doesn't matter which platform we're running on. This also relaxes the darwin and mingw platforms, to future proof against other variations of darwin and mingw ucrt.
1 parent 2d332ce commit 7681a7e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

puppet.gemspec

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,24 @@ Gem::Specification.new do |spec|
3232
spec.add_runtime_dependency('semantic_puppet', '~> 1.0')
3333
spec.add_runtime_dependency('ostruct', '~> 0.6.0')
3434

35+
# If we're building a platform-specific gem, as indicated by spec.platform,
36+
# include the corresponding runtime dependencies no matter which platform we're
37+
# currently running on.
38+
#
39+
# If we're running in bundler, include runtime dependencies for the platform
40+
# we're currently running on.
3541
platform = spec.platform.to_s
36-
if platform == 'universal-darwin'
42+
if platform =~ /darwin/ || (defined?(Bundler) && RUBY_PLATFORM =~ /darwin/)
3743
spec.add_runtime_dependency('CFPropertyList', ['>= 3.0.6', '< 4'])
3844
end
3945

40-
if (platform == 'x64-mingw32' || platform == 'x86-mingw32') || Gem.win_platform?
46+
if platform =~ /mingw/ || (defined?(Bundler) && Gem.win_platform?)
4147
# ffi 1.16.0 - 1.16.2 are broken on Windows
4248
spec.add_runtime_dependency('ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2')
4349
spec.add_runtime_dependency('minitar', '~> 0.9')
44-
elsif !Gem.java_platform?
50+
elsif platform =~ /java/ || (defined?(Bundler) && Gem.java_platform?)
4551
# don't depend on syslog on jruby, it requires extensions
52+
else
4653
spec.add_runtime_dependency('syslog', '~> 0.1.2')
4754
end
4855
end

0 commit comments

Comments
 (0)