Skip to content

Commit

Permalink
Bazel Fixes/Deprecations, Mojave Fixes, Chromium Bump 65.0.3325.69 (#18)
Browse files Browse the repository at this point in the history
* Remove usage of deprecated native repository rules

* fix: outdated bazel target syntax (missing //)

* fix: OSX Mojave missing includes
* Adds XCode includes to the includes path for missing headers

* feat: modify build matrix to deprecate old bazel versions
* non-backwards compatibility with Bazel < 0.12.0

* fix: fix generate_workspace inline with Bazel deprecations

* feat: Chromium 65.0.3325.69
* small version bump to include bazel deprecations
  • Loading branch information
promiseofcake authored Jan 14, 2019
1 parent 7074e07 commit 519efd0
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 40 deletions.
18 changes: 7 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dist: trusty
sudo: required

osx_image: xcode8.3
language: java

Expand All @@ -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;
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
16 changes: 9 additions & 7 deletions scripts/generate_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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(
Expand All @@ -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))

Expand All @@ -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()
Expand All @@ -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)
print_workspace(args.rev)
29 changes: 16 additions & 13 deletions toolchains/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -25,48 +28,48 @@ 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',
urls = ['https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz'],
)

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',
remote = 'https://chromium.googlesource.com/chromium/llvm-project/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',
Expand Down
3 changes: 3 additions & 0 deletions tools/cpp/CROSSTOOL
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 519efd0

Please sign in to comment.