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

depends_on :java #7993

Closed
radeksimko opened this issue Dec 10, 2014 · 6 comments
Closed

depends_on :java #7993

radeksimko opened this issue Dec 10, 2014 · 6 comments

Comments

@radeksimko
Copy link
Contributor

I like the idea of depends_on :cask => 'cask-name', but I feel, that it may not work well with the current naming convention in caskroom/homebrew-versions, especially not with Java.

It would has to allow some complicated combinations like:

:depends_on :cask => or('java6', 'java7', 'java')
:depends_on :cask => and('java', 'x11')

which I don't see as a bad idea, but probably not for Java casks.

I'm not sure if it's something that the actual stanza should be solving or whether we should rather think about better naming convention and more functional metadata - e.g. brew cask install java -v 7

Either way we already have many casks (IntelliJ IDEs including Android Studio), that depends on Java, but in reality it's usually any java, not a particular version.

I'm just opening discussion here to get some feedback and eventually get to some suggestions/solutions.

@radeksimko radeksimko changed the title :depends_on [java6, java7, java] depends_on :cask => [java6, java7, java] Dec 10, 2014
@rolandwalker
Copy link
Contributor

Yes, it has to be a special case. I made room for depends_on :java.

My rough and incomplete plan was

  • parse the runtime version number from the output of javac -version
  • java_version_object = Gem::Version.new(java_version.gsub('_','.'))
  • use Gem::Version to support a complex value to depends_on :java including the ~> operator

Then of course we'd like to install the needed Java version from a Cask.

Since it is possible to have multiple Java versions it would be nice to support that by not overwriting an existing java. I'm not sure how much work that is. Also perhaps in that case we shouldn't trust what javac -version returns, but instead inspect the contents of `/Library/Java/JavaVirtualMachines/'.

Lots of practical stuff to figure out.

@radeksimko
Copy link
Contributor Author

I made room for depends_on :java.

Ah, I didn't go beyond the documentation to the source code... to see that it's already prepared... :) Thanks for noticing. So the goal is to improve it and make it more practical then.

@radeksimko radeksimko changed the title depends_on :cask => [java6, java7, java] depends_on :java Dec 10, 2014
@rolandwalker
Copy link
Contributor

"More practical" is a polite way to say it. I didn't do any of the implementation because I was worried I would miss something important.

@tsparber
Copy link
Contributor

Homebrew has a working depends_on :java in java_requirement.rb (So this issue might also benefit from #14384)

@vitorgalvao
Copy link
Member

@tsparber They do, but it’s no use to use. The only thing it does is exit with an error and tell you java ins’t present but is needed. The first solution is a recommendation to install via homebrew-cask. We’re looking to actually install it.

@vitorgalvao
Copy link
Member

Closing in favour of #16383.

@miccal miccal removed the discussion label Dec 23, 2016
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants