diff options
author | Chuck Hays <haysc@google.com> | 2015-10-07 03:54:16 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-10-07 03:57:20 +0300 |
commit | c608d6b02be0d524adc2e5048df81e29da032c00 (patch) | |
tree | bc7bbafbe4cc0f8e39a5f77c5d7728ac3e6b4a5b /util | |
parent | 1aec2cbad22084333a3b42ebf6993d8d8eaca86e (diff) |
Updating Bazel outputs to work on other platforms.
Bazel on Mac requires some alterations to the generated build files.
This change updates generate_build_files.py to emit suitable Bazel
files. This will require some tweaks to projects that build with Bazel.
Change-Id: I3d68ec754b8abaa41a348f86c32434477f2c5e1c
Reviewed-on: https://boringssl-review.googlesource.com/6146
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/generate_build_files.py | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/util/generate_build_files.py b/util/generate_build_files.py index 2eae98ac..9254590a 100644 --- a/util/generate_build_files.py +++ b/util/generate_build_files.py @@ -190,7 +190,7 @@ class Bazel(object): out.write(']\n') def WriteFiles(self, files, asm_outputs): - with open('BUILD.generated', 'w+') as out: + with open('BUILD.generated.bzl', 'w+') as out: out.write(self.header) self.PrintVariableSection(out, 'ssl_headers', files['ssl_headers']) @@ -209,7 +209,7 @@ class Bazel(object): self.PrintVariableSection( out, 'crypto_sources_%s' % arch, asm_files) - with open('BUILD.generated_tests', 'w+') as out: + with open('BUILD.generated_tests.bzl', 'w+') as out: out.write(self.header) out.write('test_support_sources = [\n') @@ -217,8 +217,12 @@ class Bazel(object): if os.path.basename(filename) == 'malloc.cc': continue out.write(' "%s",\n' % filename) - out.write('] + glob(["src/crypto/test/*.h"])\n\n') + out.write(']\n\n') + + out.write('def create_tests(copts):\n') + out.write(' test_support_sources_complete = test_support_sources + \\\n') + out.write(' native.glob(["src/crypto/test/*.h"])\n') name_counts = {} for test in files['tests']: name = os.path.basename(test[0]) @@ -245,39 +249,39 @@ class Bazel(object): else: raise ValueError("Can't find source for %s" % test[0]) - out.write('cc_test(\n') - out.write(' name = "%s",\n' % name) - out.write(' size = "small",\n') - out.write(' srcs = ["%s"] + test_support_sources,\n' % src) + out.write(' native.cc_test(\n') + out.write(' name = "%s",\n' % name) + out.write(' size = "small",\n') + out.write(' srcs = ["%s"] + test_support_sources_complete,\n' % src) data_files = [] if len(test) > 1: - out.write(' args = [\n') + out.write(' args = [\n') for arg in test[1:]: if '/' in arg: - out.write(' "$(location src/%s)",\n' % arg) + out.write(' "$(location src/%s)",\n' % arg) data_files.append('src/%s' % arg) else: - out.write(' "%s",\n' % arg) - out.write(' ],\n') + out.write(' "%s",\n' % arg) + out.write(' ],\n') - out.write(' copts = boringssl_copts,\n') + out.write(' copts = copts,\n') if len(data_files) > 0: - out.write(' data = [\n') + out.write(' data = [\n') for filename in data_files: - out.write(' "%s",\n' % filename) - out.write(' ],\n') + out.write(' "%s",\n' % filename) + out.write(' ],\n') if 'ssl/' in test[0]: - out.write(' deps = [\n') - out.write(' ":crypto",\n') - out.write(' ":ssl",\n') - out.write(' ],\n') + out.write(' deps = [\n') + out.write(' ":crypto",\n') + out.write(' ":ssl",\n') + out.write(' ],\n') else: - out.write(' deps = [":crypto"],\n') - out.write(')\n') + out.write(' deps = [":crypto"],\n') + out.write(' )\n') def FindCMakeFiles(directory): |