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

gemspec: platform-dependent dependencies leading to inconsistent builds #1662

Closed
HoneyryderChuck opened this Issue Jul 12, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@HoneyryderChuck

HoneyryderChuck commented Jul 12, 2016

My current problem is :

I create this gemspec where I define multiple dependencies, one of them depending of redcarpet, which doesn't build on jruby. I've been naively setting it in the gemspec like this:

# mygem.gemspec
spec.add_runtime_dependency "md2man" unless RUBY_PLATFORM == "java"

# in my code, I require on a need basis:
require 'binman/rakefile' unless RUBY_PLATFORM == "java"

This works mostly in development mode, but breaks as soon as I install the gem on other projects.

  • If the gem build is performed with CRuby, md2man will be tagged as package dependency, and installing the gem won't work for jruby.
  • If the gem build is performed with JRuby, md2man will be missing from the package dependencies, and that require will fail in runtime.

What is the proper way for setting platform-dependent dependencies in the gemspec?

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

@bronzdoc bronzdoc added the triage label Jul 12, 2016

@segiddins

This comment has been minimized.

Show comment
Hide comment
@segiddins

segiddins Jul 12, 2016

Member

Adding conditionals in your gem spec won't work -- it's eval'ed once and then re-serialized. You'll want to create platform-specific gems for your gem that has different dependencies

Member

segiddins commented Jul 12, 2016

Adding conditionals in your gem spec won't work -- it's eval'ed once and then re-serialized. You'll want to create platform-specific gems for your gem that has different dependencies

@HoneyryderChuck

This comment has been minimized.

Show comment
Hide comment
@HoneyryderChuck

HoneyryderChuck Jul 12, 2016

and how do I do that?

HoneyryderChuck commented Jul 12, 2016

and how do I do that?

@bronzdoc

This comment has been minimized.

Show comment
Hide comment
@bronzdoc

bronzdoc Feb 26, 2018

Member

@HoneyryderChuck is this still and issue for you?

Member

bronzdoc commented Feb 26, 2018

@HoneyryderChuck is this still and issue for you?

@HoneyryderChuck

This comment has been minimized.

Show comment
Hide comment
@HoneyryderChuck

HoneyryderChuck Feb 26, 2018

@bronzdoc I don't know, jumped out of that project... but what is the solution? spec.platform=? I've also been waiting for feedback since.

HoneyryderChuck commented Feb 26, 2018

@bronzdoc I don't know, jumped out of that project... but what is the solution? spec.platform=? I've also been waiting for feedback since.

@bronzdoc

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment