From 0a9e0d4c7bd89bce6760ed2a5c07f02d0a8df5f1 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Tue, 22 Oct 2019 22:36:35 +0200 Subject: [PATCH 1/3] Fix build for Bazel 0.25 and later The new_http_archive rule has been replaced with just http_archive in recent versions of Bazel. See also https://stackoverflow.com/a/58291928. The last documentation that still includes new_http_archive is for version 0.22. [1] The first version where http_archive appears on the "Repository rules" page is Bazel version 0.25. [2] So I expect this makes the BUILD files compatible with Bazel 0.25 and later, but possibly earlier versions too. I tested with 0.29.1. [1]: https://docs.bazel.build/versions/0.22.0/be/workspace.html#new_http_archive [2]: https://docs.bazel.build/versions/0.25.0/repo/http.html#http_archive --- WORKSPACE | 6 ++++-- png.BUILD => external/png.BUILD | 0 zlib.BUILD => external/zlib.BUILD | 0 3 files changed, 4 insertions(+), 2 deletions(-) rename png.BUILD => external/png.BUILD (100%) rename zlib.BUILD => external/zlib.BUILD (100%) diff --git a/WORKSPACE b/WORKSPACE index 0fb97782..49308c05 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,7 +3,9 @@ workspace(name = "guetzli") -new_http_archive( +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( name = "png_archive", build_file = "png.BUILD", sha256 = "a941dc09ca00148fe7aaf4ecdd6a67579c293678ed1e1cf633b5ffc02f4f8cf7", @@ -11,7 +13,7 @@ new_http_archive( url = "http://github.com/glennrp/libpng/archive/v1.2.57.zip", ) -new_http_archive( +http_archive( name = "zlib_archive", build_file = "zlib.BUILD", sha256 = "8d7e9f698ce48787b6e1c67e6bff79e487303e66077e25cb9784ac8835978017", diff --git a/png.BUILD b/external/png.BUILD similarity index 100% rename from png.BUILD rename to external/png.BUILD diff --git a/zlib.BUILD b/external/zlib.BUILD similarity index 100% rename from zlib.BUILD rename to external/zlib.BUILD From fe2dd485dad28665ccfba7345845b86e7fce5e19 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Tue, 22 Oct 2019 23:04:03 +0200 Subject: [PATCH 2/3] Use Bazel 1.1.0 on CI --- .travis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.sh b/.travis.sh index d2345812..1d4278fa 100755 --- a/.travis.sh +++ b/.travis.sh @@ -15,9 +15,9 @@ case "$1" in case "${TRAVIS_OS_NAME}" in "linux") sudo apt-get remove openjdk-9-jdk oracle-java9-installer # Conflicts with Bazel. - wget https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel_0.4.5-linux-x86_64.deb - echo 'b494d0a413e4703b6cd5312403bea4d92246d6425b3be68c9bfbeb8cc4db8a55 bazel_0.4.5-linux-x86_64.deb' | sha256sum -c --strict || exit 1 - sudo dpkg -i bazel_0.4.5-linux-x86_64.deb + wget https://github.com/bazelbuild/bazel/releases/download/1.1.0/bazel_1.1.0-linux-x86_64.deb + echo '138b47ffd54924e3c0264c65d31d3927803fb9025db4d5b18107df79ee3bda95 bazel_1.1.0-linux-x86_64.deb' | sha256sum -c --strict || exit 1 + sudo dpkg -i bazel_1.1.0-linux-x86_64.deb ;; "osx") brew install bazel From d5545ad831333484501a1d426876fad096cdbbfc Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Wed, 23 Oct 2019 19:53:11 +0200 Subject: [PATCH 3/3] Ensure Java 1.8 is available on Darwin on CI The build failed, and the logs say this: 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. So let's try that then. --- .travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.sh b/.travis.sh index 1d4278fa..7bf972dd 100755 --- a/.travis.sh +++ b/.travis.sh @@ -20,6 +20,7 @@ case "$1" in sudo dpkg -i bazel_1.1.0-linux-x86_64.deb ;; "osx") + brew cask install homebrew/cask-versions/adoptopenjdk8 brew install bazel ;; esac