Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #143 - Childprocess v1.0.0 failing to install. #144

Merged
merged 1 commit into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion childprocess.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ Gem::Specification.new do |s|

s.add_development_dependency "rspec", "~> 3.0"
s.add_development_dependency "yard", "~> 0.0"
s.add_development_dependency 'rake', '< 12.0'
s.add_development_dependency 'coveralls', '< 1.0'

s.add_runtime_dependency 'rake', '< 12.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this eliminates the situation where installation is broken when rake is missing.

But it also propagates rake as a runtime dependency of any app that includes childprocess and returns any app that uses childprocess on any platform to a state where rake is always available at runtime. For users who are concerned about the surface area of their applications for security or performance reasons, this is less than desirable.

Since we have a known workaround (pin to 0.9.x), I advocate for taking the time to find a solution that doesn't add runtime dependencies that aren't actually necessary at runtime, or at least reduces the effect to platforms on which they are needed for the installation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change came from a desire to not have ffi be a dependency. So...it's kind of a 'pick your poison' situation. Between the two, I'd guess that more places are fine having rake installed than ffi. If there is yet another solution that doesn't require either gem as a mandatory dependency, then that would be even better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enkessler If a conditional dependency (ffi on Windows) is all you want, you can remove ext/mkrf_conf.rb and do a conditional instead in childprocess.gemspec:

-  s.extensions = 'ext/mkrf_conf.rb'
+  s.add_runtime_dependency 'ffi', '~> 1.0', '>= 1.0.11' if Gem.win_platform?

With this you don't need rake at runtime. As you pointed out, that generated Rakefile has no use at the moment.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farkasmate conditionals in the gemspec don't quite work in this case, because they are evaluated at gem build, before the gem is uploaded to rubygems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked at alternative extensions we could implement, but the introduction of rake as a dependency is the only way to do this in a platform-agnostic way. Other extensions require the existence of make or other tools, which may not be installed on some systems.

For this reason, and given the fact that rake is usually (but not always) installed by default on Ruby systems, it seems reasonable to add a dependency on rake for sake of removing the ffi dependency for all non-Windows systems.


# Install FFI gem if we're running on Windows
s.extensions = 'ext/mkrf_conf.rb'
end
2 changes: 1 addition & 1 deletion lib/childprocess/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ChildProcess
VERSION = '1.0.0'
VERSION = '1.0.1'
end