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

Improve homebrew support #4

Closed
karianna opened this issue Mar 28, 2018 · 11 comments
Closed

Improve homebrew support #4

karianna opened this issue Mar 28, 2018 · 11 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@karianna
Copy link
Member

Workflow:
brew cask install openjdK

Expected:
Works analog to brew cask install java

Instead:
No official cask.

Further Information:

@karianna karianna added the enhancement New feature or request label Mar 28, 2018
@karianna karianna added this to To do in homebrew-openjdk via automation Mar 28, 2018
@gdams
Copy link
Member

gdams commented Mar 28, 2018

Casks seem to be for the installation of large .app files which we aren't doing. I personally think that using brew is fine for this.

As for the question about merging into the main branch..... I'm open to this concept but I do like the way that with this current setup we can simply manage our own repo and cut releases immediately without having to get someone to manually merge our pull request into the main repo. I'd be happy to add a pull request and see how it goes down in the main repo though. I do personally feel that we should have JCK compliance on macOS before adding this to the main repo as well.

@AlexanderWillner
Copy link

Given that Oracle Java is a cask my assumption is that OpenJDK should also be a cask. This will probably be discussed after creating a Homebrew Pull Request. Maintaining also an own Tap to update immediately w/o waiting for the pull request to be merged, might be another option.

Anyway, waiting for JCK compliance and offering a Tap in the mean time might be the safest option.

@gibfahn
Copy link
Member

gibfahn commented Mar 29, 2018

Casks seem to be for the installation of large .app files which we aren't doing. I personally think that using brew is fine for this.

I agree with this, the cask docs say:

Homebrew-Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.
Homebrew-Cask does one thing, does it well, and plays nice with others. Apps are moved to your /Applications folder in the same way as you would manually.

Basically Cask is for GUI things that need to go into /Applications, and homebrew is for command-line things that need to be in the path (they usually go into /usr/local/bin).

I've always found it odd that Oracle java is a cask (and that it goes into /Applications, unlike every other language I've ever installed, which are all installed with brew and go into /usr/local/bin (e.g. python, groovy, go, kotlin, scala, Node.js). Maybe it's because it has a GUI update manager, idk.

Being a cask instead of a normal brew package also has the disadvantage that there is no built-in way to upgrade your apps, for brew you have brew upgrade, for Casks you have to install a separate command-line tool (which is not officially supported etc.) to upgrade things.

@gdams
Copy link
Member

gdams commented Aug 8, 2018

closing as using brew appears to be okay for now

@gdams gdams closed this as completed Aug 8, 2018
homebrew-openjdk automation moved this from To do to Done Aug 8, 2018
@karianna karianna added the wontfix This will not be worked on label Aug 9, 2018
@moshen
Copy link

moshen commented Oct 4, 2018

While this is a little bit of issue necromancy, after checking out this Tap I think the best course would be to implement as Casks.

  • Casks aren't only for .apps, they are also for software that is installed globally or requires admin permissions to install
  • @gdams zulu and java (Now openjdk) are both Casks and both simply install into /Library/Java/JavaVirtualMachines/
  • Installing into /usr/local does not allow GUI apps to use the installed jvm (as far as I know)
  • @gibfahn , unlike linux (and other nixs) Mac Java installs in various JavaVirtualMachines folders are usable on the cli through the /usr/libexec/java_home utility, which also allows you to switch jvms
  • @gibfahn buo/brew-cask-upgrade is completely unnecessary, use either brew cask upgrade caskname or brew cask reinstall caskname

I would be happy to make a PR converting these to Casks.

Maybe it would be better just to contribute these to https://github.com/Homebrew/homebrew-cask-versions.

@gdams
Copy link
Member

gdams commented Oct 4, 2018

@moshen I've just started hacking together a basic cask file. I'll update the issue with progress

@moshen
Copy link

moshen commented Oct 4, 2018

@gdams 👍 nice, seems like you basically want something like the openjdk one: https://github.com/Homebrew/homebrew-cask/blob/3ca5556706a8e08fca9ea35bc82e9645494ebb05/Casks/java.rb

@gdams
Copy link
Member

gdams commented Oct 4, 2018

nearly finished now, just getting the plist stuff done :)

@gdams
Copy link
Member

gdams commented Oct 4, 2018

Okay so this cask file seems to be passing all of the tests and installing Java in the correct location. I'm pretty happy with this other than the fact that I curl the Info.plist file in from a gist right now. We should probably move these Info.plist files to an internal repo somewhere. Also the generated Info.plist might need a few other bits being changed (see below)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>libjli.dylib</string>
	<key>CFBundleGetInfoString</key>
	<string>AdoptOpenJDK 1.8.0_172</string>
	<key>CFBundleIdentifier</key>
	<string>net.java.openjdk.1.8.0.jdk</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>7.0</string>
	<key>CFBundleName</key>
	<string>AdoptOpenJDK 1.8.0</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>10.0.2</string>
	<key>JavaVM</key>
	<dict>
		<key>JVMCapabilities</key>
		<array>
			<string>CommandLine</string>
		</array>
		<key>JVMMinimumFrameworkVersion</key>
		<string>13.2.9</string>
		<key>JVMMinimumSystemVersion</key>
		<string>10.6.0</string>
		<key>JVMPlatformVersion</key>
		<string>1.8</string>
		<key>JVMVendor</key>
		<string>Oracle Corporation</string>
		<key>JVMVersion</key>
		<string>1.8.0_172</string>
	</dict>
</dict>
</plist>
cask 'adoptopenjdk8' do
  version '8u172-b11,1.8.0_172'
  sha256 'c271c5aeebfec5cd6f41c24092472a66fc55f893e3118e63f4c1ab1cb4446157'

  # github.com was verified as official when first introduced to the cask
  url "https://github.com/AdoptOpenJDK/openjdk8-releases/releases/download/jdk8u172-b11/OpenJDK8_x64_Mac_jdk#{version.before_comma}.tar.gz"
  appcast 'https://github.com/adoptopenjdk/openjdk8-releases/releases.atom'
  name 'AdoptOpenJDK8'
  homepage 'https://adoptopenjdk.net/'

  postflight do
    system_command '/bin/mv',
                   args: ['-f', '--', "/usr/local/Caskroom/adoptopenjdk8/#{version}/jdk#{version.before_comma}",
                          '/usr/local/Caskroom/adoptopenjdk8/']
    system_command '/bin/rm',
                   args: ['-rf', '--', "/usr/local/Caskroom/adoptopenjdk8/#{version}"]
    system_command '/bin/mkdir',
                   args: ['-p', '--', "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk/Contents/MacOS"],
                   sudo: true
    system_command '/bin/ln',
                   args: ['-s', '--', "/usr/local/Caskroom/adoptopenjdk8/jdk#{version.before_comma}",
                          "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk/Contents/Home"],
                   sudo: true
    system_command '/bin/ln',
                   args: ['-s', '--', "/usr/local/Caskroom/adoptopenjdk8/jdk#{version.before_comma}/jre/lib/jli/libjli.dylib",
                          "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk/Contents/MacOS/libjli.dylib"],
                   sudo: true
    system_command '/usr/bin/curl',
                   args: ['--output', "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk/Contents/Info.plist",
                          'https://gist.githubusercontent.com/chaines27/32810cdfddefeeb5965e2969eb709fb5/raw/5ae95952b91f879e849c2be8a3a90be2d54ea1ec/homebrew-openjdk-1.8-info.plist'],
                   sudo: true
    system_command '/usr/libexec/PlistBuddy',
                   args: ['-c', "Set :CFBundleGetInfoString AdoptOpenJDK #{version.after_comma}", "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk/Contents/Info.plist"],
                   sudo: true
  end

  uninstall_postflight do
    system_command '/bin/rm',
                   args: ['-rf', '--', "/usr/local/Caskroom/adoptopenjdk8/jdk#{version.before_comma}"]
    system_command '/bin/rm',
                   args: ['-rf', '--', "/Library/Java/JavaVirtualMachines/adoptopenjdk-#{version.after_comma}.jdk"],
                   sudo: true
  end
end

@ghost
Copy link

ghost commented Oct 4, 2018

hello i'd really appreciate brew install openjdk preferably with everything just magically working :)

@gdams
Copy link
Member

gdams commented Oct 5, 2018

here is the first PR for jdk11 Homebrew/homebrew-cask#52874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
Development

No branches or pull requests

5 participants