Closed mbrukman closed 4 years ago
Running an explicit brew update
before brew install
brings it down to 6 min 21 sec, which is an improvement over the previous version with implicit brew update
6 min 48 sec, but still somewhat marginal.
Maybe it would be better to avoid running brew update
entirely?
Looks like skipping brew update
won't work with a ruby
base image:
$ HOMEBREW_NO_AUTO_UPDATE=1 brew install bazel
bazel: Java 1.8 is required to install this formula.
Install AdoptOpenJDK 8 with Homebrew Cask:
brew cask install homebrew/cask-versions/adoptopenjdk8
Error: An unsatisfied requirement failed this build.
The command "HOMEBREW_NO_AUTO_UPDATE=1 brew install bazel" failed and exited with 1 during .
Looks like the default version of Java 13 doesn't work with the installation of Bazel via Homebrew, because it requires Java 8:
$ java -Xmx32m -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment (build 13.0.1+9)
OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
$ javac -J-Xmx32m -version
javac 13.0.1
1.51s$ HOMEBREW_NO_AUTO_UPDATE=1 brew install bazel
bazel: Java 1.8 is required to install this formula.
Install AdoptOpenJDK 8 with Homebrew Cask:
brew cask install homebrew/cask-versions/adoptopenjdk8
Error: An unsatisfied requirement failed this build.
The command "HOMEBREW_NO_AUTO_UPDATE=1 brew install bazel" failed and exited with 1 during .
Latest build still failed, as it is still running Java 13; looks like this is not the right setting:
java:
- openjdk8
Turns out, we need to specify osx_image: xcode9.3
, as that's the latest image which includes Java 8. Let's try that instead.
Success! Done in 1 min 46 sec, this is excellent.
Technically, Bazel on Homebrew would like Java 11, but there are no macOS versions on Travis CI that provide Java 11 out-of-the-box; it skips from Java 8 straight to Java 13, which isn't compatible (yet) with Bazel, so we'll have to stay with this.
Bazel ships with its own embedded JRE, so unless you need to compile Java source files, you don't need the full JDK. Homebrew, however, insists on installing Ruby before continuing (since Homebrew recipes are all Ruby scripts), so by starting with a Ruby image, we should cut down on that step and save some time.
Also added an explicit
brew update
step since Homebrew insists on calling it every time when we're installing Bazel; hopefully, this will get it to cache the metadata across builds as well.