How to upgrade bazel?

user8219368 picture user8219368 · Jun 27, 2017 · Viewed 11.8k times · Source

I built bazel-0.4.0 successfully.
Then I tried upgrading it to the latest version bazel-0.5.1 using

$ ./compile.sh compile ../bazel-0.4.0/output/bazel.exe

It's giving me an error, bazel-0.5.0, bazel-0.4.5 gave me same error

ERROR LOG:

$ ./compile.sh compile ../bazel-0.4.0/output/bazel.exe  
🍃 Building Bazel with Bazel.  
ERROR: Illegal javabase value 'C:/Program Files/Java/jdk', javabase must be an absolute path or label.  
INFO: Elapsed time: 0.246s  
ERROR: Could not build Bazel

bazel-0.4.4 gave me different error

ERROR LOG:

🍃 Building Bazel with Bazel.  
.ERROR: no such target '//:Files/Java/jdk': target 'Files/Java/jdk' not declared in package '' defined by C:/Users/potlapel/Downloads/bazel-0.4.4/BUILD.  
INFO: Elapsed time: 0.182s  
ERROR: Could not build Bazel

Answer

hlopko picture hlopko · Jun 27, 2017

If you already have bazel installed, you can upgrade by running bazel build //src:bazel on a fresh clone of the git repository. Or just download distribution archive and run ./compile. Details: https://bazel.build/versions/master/docs/install-compile-source.html.

Now I'm not sure you can build bazel 0.5.0 with bazel 0.4.0, there were some incompatible changes around 0.4.3. We test building bazel from scratch, and building bazel with last released bazel, but not building bazel with old releases. That will be supported only after we reach 1.0.0.