diff --git a/.travis.yml b/.travis.yml index a3301e0..598c000 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ dist: trusty -sudo: required + osx_image: xcode8.3 language: java @@ -8,21 +8,17 @@ os: - osx env: - - BAZEL_VERSION=0.9.0 - - BAZEL_VERSION=0.10.1 - - BAZEL_VERSION=0.11.1 - BAZEL_VERSION=0.12.0 - BAZEL_VERSION=0.13.1 + - BAZEL_VERSION=0.14.1 + - BAZEL_VERSION=0.15.2 + - BAZEL_VERSION=0.16.1 + - BAZEL_VERSION=0.17.2 + - BAZEL_VERSION=0.18.1 + - BAZEL_VERSION=0.19.2 matrix: fast_finish: true - allow_failures: - - os: osx - env: BAZEL_VERSION=0.9.0 - - os: osx - env: BAZEL_VERSION=0.10.1 - - os: osx - env: BAZEL_VERSION=0.11.1 before_install: - echo $TRAVIS_OS_NAME; diff --git a/README.md b/README.md index bfde8a9..5951422 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,26 @@ Invoke Bazel with the custom toolchain: `vsco/bazel-toolchains` is tested against the following build matrix: -| Bazel Version | OSX | Linux | -| :------------- | :-: | :---: | -| 0.9.x | ✗ | ✓ | -| 0.10.x | ✗ | ✓ | -| 0.11.x | ✗ | ✓ | -| 0.12.x | ✓ | ✓ | -| 0.13.x | ✓ | ✓ | +| Bazel Version | OSX | Linux | +| :-------------- | :-: | :---: | +| 0.20.0+ | ✗ | ✗ | +| 0.19.2 | ✓ | ✓ | +| 0.18.1 | ✓ | ✓ | +| 0.17.2 | ✓ | ✓ | +| 0.16.1 | ✓ | ✓ | +| 0.15.2 | ✓ | ✓ | +| 0.14.1 | ✓ | ✓ | +| 0.13.1 | ✓ | ✓ | +| 0.12.0 | ✓ | ✓ | +| ~0.11.x~ | ✗ | ✗ | +| ~0.10.x~ | ✗ | ✗ | +| ~0.9.x~ | ✗ | ✗ | Builds beyond the listed versions are not currently tested. +Bazel `0.20.0+` introduced breaking changes to the [C++ Toolchain API](https://github.com/bazelbuild/bazel/issues/6434) +which need to be addressed for consumers of this repo in a non-breaking manner. + ## Prerequisites On macOS, run `xcode-select --install` in Terminal. diff --git a/WORKSPACE b/WORKSPACE index 00e0fce..f3ff6de 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,11 +4,13 @@ workspace(name = "co_vsco_bazel_toolchains") load("//toolchains:repositories.bzl", "bazel_toolchains_repositories") bazel_toolchains_repositories() +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + # GTest -new_http_archive( +http_archive( name = "gtest", url = "https://github.com/google/googletest/archive/release-1.8.0.zip", sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf", - build_file = "build_files/gtest.BUILD", + build_file = "//build_files:gtest.BUILD", strip_prefix = "googletest-release-1.8.0/googletest", ) diff --git a/scripts/generate_workspace.py b/scripts/generate_workspace.py index 1300414..1ef3202 100755 --- a/scripts/generate_workspace.py +++ b/scripts/generate_workspace.py @@ -17,9 +17,9 @@ def print_invocation(self): def print_def(self): print """ def %(name)s(): - native.%(repo_type)s( + %(repo_type)s( name = '%(name)s', - build_file = str(Label('//build_files:%(name)s.BUILD')),""" % {'name': self.name, 'repo_type': self.repo_type} + build_file = str(Label('//build_files:%(name)s.BUILD')),""" % {'name': self.name, 'repo_type': self.repo_type} for key, value in self.args.iteritems(): print \ @@ -37,11 +37,11 @@ def get_archive_type(repo): def get_http_archives(revision, prefix, fetch_func): return [Repository( name = prefix + repo['platform'].lower(), - repo_type = 'new_http_archive', + repo_type = 'http_archive', urls = [repo['url']], sha256 = "'" + repo['sha256'] + "'", type = get_archive_type(repo), - ) for repo in fetch_func(revision)] + ) for repo in fetch_func(revision)] def get_git_repositories(revision, fetch_func): return [Repository( @@ -52,8 +52,8 @@ def get_git_repositories(revision, fetch_func): ) for repo in fetch_func(revision)] def print_workspace(revision): - repos = (get_http_archives(revision, 'org_chromium_clang_', chromium_repo.download_clang_info) + - get_http_archives(revision, 'org_chromium_sysroot_', chromium_repo.download_sysroot_info) + + repos = (get_http_archives(revision, 'org_chromium_clang_', chromium_repo.download_clang_info) + + get_http_archives(revision, 'org_chromium_sysroot_', chromium_repo.download_sysroot_info) + get_http_archives(revision, 'org_chromium_binutils_', chromium_repo.download_binutils_info) + get_git_repositories(revision, chromium_repo.download_toolchain_info)) @@ -62,6 +62,8 @@ def print_workspace(revision): print f.read() print '# Defines external repositories needed by bazel-toolchains.' print '# Chromium toolchain corresponds to Chromium %s.\n' % revision + print 'load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")' + print 'load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")\n' print 'def bazel_toolchains_repositories():' for repo in repos: repo.print_invocation() @@ -73,4 +75,4 @@ def print_workspace(revision): parser = argparse.ArgumentParser() parser.add_argument("-r", "--rev", action="store", required=True) args = parser.parse_args() - print_workspace(args.rev) \ No newline at end of file + print_workspace(args.rev) diff --git a/toolchains/repositories.bzl b/toolchains/repositories.bzl index b0a3e95..aa4e1c7 100644 --- a/toolchains/repositories.bzl +++ b/toolchains/repositories.bzl @@ -14,7 +14,10 @@ # limitations under the License. # Defines external repositories needed by bazel-toolchains. -# Chromium toolchain corresponds to Chromium 64.0.3282.167. +# Chromium toolchain corresponds to Chromium 65.0.3325.69. + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository") def bazel_toolchains_repositories(): org_chromium_clang_mac() @@ -25,23 +28,23 @@ def bazel_toolchains_repositories(): org_chromium_libcxxabi() def org_chromium_clang_mac(): - native.new_http_archive( + http_archive( name = 'org_chromium_clang_mac', build_file = str(Label('//build_files:org_chromium_clang_mac.BUILD')), - sha256 = '4f0aca6ec66281be94c3045550ae15a73befa59c32396112abda0030ef22e9b6', - urls = ['https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-318667-1.tgz'], + sha256 = '4b2a7a65ac1ee892b318c723eec8771f514bb306f346aa8216bb0006f19d87b7', + urls = ['https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-321529-2.tgz'], ) def org_chromium_clang_linux_x64(): - native.new_http_archive( + http_archive( name = 'org_chromium_clang_linux_x64', build_file = str(Label('//build_files:org_chromium_clang_linux_x64.BUILD')), - sha256 = 'e63e5fe3ec8eee4779812cd16aae0ddaf1256d2e8e93cdd5914a3d3e01355dc1', - urls = ['https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-318667-1.tgz'], + sha256 = '76d4eb1ad011e3127c4a9de9b9f5d4ac624b5a9395c4d7395c9e0a487b13daf6', + urls = ['https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-321529-2.tgz'], ) def org_chromium_sysroot_linux_x64(): - native.new_http_archive( + http_archive( name = 'org_chromium_sysroot_linux_x64', build_file = str(Label('//build_files:org_chromium_sysroot_linux_x64.BUILD')), sha256 = '84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3', @@ -49,16 +52,16 @@ def org_chromium_sysroot_linux_x64(): ) def org_chromium_binutils_linux_x64(): - native.new_http_archive( + http_archive( name = 'org_chromium_binutils_linux_x64', build_file = str(Label('//build_files:org_chromium_binutils_linux_x64.BUILD')), - sha256 = '24c3df44af5bd377c701ee31b9b704f2ea23456f20e63652c8235a10d7cf1be7', + sha256 = 'd3e03aa37dd59d6b3b0df4654b964ef5361d913d50c1e2724a6f1335762fcda6', type = 'tar.bz2', - urls = ['https://commondatastorage.googleapis.com/chromium-binutils/0cb5726d9701f8be6a81b199899de1de552922f2'], + urls = ['https://commondatastorage.googleapis.com/chromium-binutils/5230f6066998df2f4d61d5fa586152ab20cca300'], ) def org_chromium_libcxx(): - native.new_git_repository( + new_git_repository( name = 'org_chromium_libcxx', build_file = str(Label('//build_files:org_chromium_libcxx.BUILD')), commit = 'f56f1bba1ade4a408d403ff050d50e837bae47df', @@ -66,7 +69,7 @@ def org_chromium_libcxx(): ) def org_chromium_libcxxabi(): - native.new_git_repository( + new_git_repository( name = 'org_chromium_libcxxabi', build_file = str(Label('//build_files:org_chromium_libcxxabi.BUILD')), commit = '05ba3281482304ae8de31123a594972a495da06d', diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL index 21df58b..3979498 100644 --- a/tools/cpp/CROSSTOOL +++ b/tools/cpp/CROSSTOOL @@ -183,8 +183,11 @@ toolchain { compiler_flag: "external/org_chromium_clang_mac/lib/clang/6.0.0/include" compiler_flag: "-isystem" compiler_flag: "/usr/include" + compiler_flag: "-isystem" + compiler_flag: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" cxx_builtin_include_directory: "/usr/include" cxx_builtin_include_directory: "/System/Library/Frameworks" + cxx_builtin_include_directory: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" objcopy_embed_flag: "-I" objcopy_embed_flag: "binary"