Skip to content

Commit

Permalink
Bump protobuf version to 3.10.0 (bazelbuild#413)
Browse files Browse the repository at this point in the history
This change also does the following:

* Add fixes for --incompatible_load_{java|proto|python}_rules_from_bzl
* Consume zlib.BUILD from protobuf repository
* regenerate.py: load py_binary from rules_python
* Add rules_cc and rules_java
* Bump Bazel version to 0.29.1 in .travis.yml file

Travis changes:

* Remove dist: trusty (Ubuntu 14.04 is EOL, default is 16.04)
* Remove osx OS as it currently doesn't support Python: [1].

[1] travis-ci/travis-ci#2312
  • Loading branch information
davido authored and gkdn committed Oct 7, 2019
1 parent 9ab7cb8 commit d53c0d7
Show file tree
Hide file tree
Showing 36 changed files with 119 additions and 110 deletions.
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# trusty beta image has jdk8, gcc4.8.4
dist: trusty
sudo: required
# xcode8 has jdk8
osx_image: xcode8
# Not technically required but suppresses 'Ruby' in Job status message.
language: java

os:
- linux
- osx

env:
- BAZEL=0.22.0
- BAZEL=0.29.1

before_install:
- |
Expand Down
2 changes: 2 additions & 0 deletions closure/compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "compiler",
exports = ["@com_google_javascript_closure_compiler"],
Expand Down
4 changes: 1 addition & 3 deletions closure/compiler/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure/private:rule_test.bzl", "rule_test")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_binary", "closure_js_library")

closure_js_library(
name = "hello_lib",
Expand Down
4 changes: 1 addition & 3 deletions closure/compiler/test/closure_js_deps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_deps")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_binary", "closure_js_deps", "closure_js_library")

# This package tests the behavior of closure_js_deps. This package also tests
# the behavior runfiles with regard to closure_js_library, closure_js_binary,
Expand Down
3 changes: 1 addition & 2 deletions closure/compiler/test/exports_and_entry_points/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_binary", "closure_js_library")

################################################################################
# Assume we want to write a JavaScript program (not a library) that we compile
Expand Down
3 changes: 1 addition & 2 deletions closure/compiler/test/reports/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_binary", "closure_js_library")

# Property renaming reports are rarely used. But they can be used to minify
# JSON messages. However it's recommended that you use protobuf instead.
Expand Down
3 changes: 1 addition & 2 deletions closure/compiler/test/strict_dependency_checking/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_binary", "closure_js_library")

################################################################################
# Assume we're using traditional Google namespaces.
Expand Down
6 changes: 3 additions & 3 deletions closure/library/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# DO NOT EDIT -- bazel run //closure/library:regenerate -- "$PWD"

load("@rules_python//python:defs.bzl", "py_binary")
load("//closure:defs.bzl", "closure_css_library", "closure_js_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

load("//closure:defs.bzl", "closure_css_library")
load("//closure:defs.bzl", "closure_js_library")

closure_js_library(
name = "library",
exports = [
Expand Down
4 changes: 4 additions & 0 deletions closure/library/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ def main(basejs, outdir):
else:
builds[build].insert(
0, 'load("//closure:defs.bzl", "closure_js_library")')

builds[build].insert(
0, 'load("@rules_python//python:defs.bzl", "py_binary")')

builds[build].insert(0, 'licenses(["notice"])')
builds[build].insert(
0, 'package(default_visibility = ["//visibility:public"])')
Expand Down
1 change: 1 addition & 0 deletions closure/protobuf/closure_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Utilities for building JavaScript Protocol Buffers.
"""

load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load("//closure/compiler:closure_js_library.bzl", "create_closure_js_library")
load("//closure/private:defs.bzl", "CLOSURE_JS_TOOLCHAIN_ATTRS", "unfurl")

Expand Down
1 change: 1 addition & 0 deletions closure/protobuf/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package(default_testonly = True)

licenses(["notice"]) # Apache 2.0

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//closure/compiler:closure_js_library.bzl", "closure_js_library")
load("//closure/protobuf:closure_proto_library.bzl", "closure_proto_library")
load("//closure/testing:closure_js_test.bzl", "closure_js_test")
Expand Down
62 changes: 53 additions & 9 deletions closure/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def rules_closure_dependencies(
omit_org_ow2_asm_tree = False,
omit_org_ow2_asm_util = False,
omit_phantomjs = False,
omit_rules_cc = False,
omit_rules_java = False,
omit_rules_proto = False,
omit_rules_python = False,
omit_zlib = False):
"""Imports dependencies for Closure Rules."""
if omit_com_google_protobuf_java:
Expand Down Expand Up @@ -194,6 +198,14 @@ def rules_closure_dependencies(
org_ow2_asm_util()
if not omit_phantomjs:
phantomjs()
if not omit_rules_cc:
rules_cc()
if not omit_rules_java:
rules_java()
if not omit_rules_proto:
rules_proto()
if not omit_rules_python:
rules_python()
if not omit_zlib:
zlib()

Expand Down Expand Up @@ -726,23 +738,23 @@ def com_google_jsinterop_annotations():
def com_google_protobuf():
http_archive(
name = "com_google_protobuf",
strip_prefix = "protobuf-3.9.0",
sha256 = "2ee9dcec820352671eb83e081295ba43f7a4157181dad549024d7070d079cf65",
strip_prefix = "protobuf-3.10.0",
sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed",
urls = [
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.9.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.9.0.tar.gz",
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.10.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
],
)

def com_google_protobuf_js():
http_archive(
name = "com_google_protobuf_js",
strip_prefix = "protobuf-3.9.0/js",
strip_prefix = "protobuf-3.10.0/js",
urls = [
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.9.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.9.0.tar.gz",
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.10.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
],
sha256 = "2ee9dcec820352671eb83e081295ba43f7a4157181dad549024d7070d079cf65",
sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed",
build_file = str(Label("//closure/protobuf:protobuf_js.BUILD")),
)

Expand Down Expand Up @@ -1022,10 +1034,42 @@ def phantomjs():
macos_sha256 = "538cf488219ab27e309eafc629e2bcee9976990fe90b1ec334f541779150f8c1",
)

def rules_cc():
http_archive(
name = "rules_cc",
sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"],
)

def rules_java():
http_archive(
name = "rules_java",
sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
)

def rules_proto():
http_archive(
name = "rules_proto",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
urls = ["https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz"],
)

def rules_python():
http_archive(
name = "rules_python",
sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
)

def zlib():
http_archive(
name = "zlib",
build_file = "@io_bazel_rules_closure//:third_party/zlib.BUILD",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
Expand Down
5 changes: 1 addition & 4 deletions closure/stylesheets/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ package(default_testonly = True)
licenses(["notice"]) # Apache 2.0

load("//closure/private:file_test.bzl", "file_test")
load("//closure:defs.bzl", "closure_css_binary")
load("//closure:defs.bzl", "closure_css_library")
load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_css_binary", "closure_css_library", "closure_js_binary", "closure_js_library")

closure_css_library(
name = "hello_lib",
Expand Down
4 changes: 2 additions & 2 deletions closure/templates/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_proto_library")
load("@rules_java//java:defs.bzl", "java_library")
load("//closure:defs.bzl", "closure_js_library", "closure_js_proto_library")

java_library(
name = "templates",
Expand Down
4 changes: 3 additions & 1 deletion closure/templates/closure_java_template_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"""Utilities for compiling Closure Templates to Java.
"""

load("@rules_java//java:defs.bzl", "java_library")

_SOY_COMPILER_BIN = "@com_google_template_soy//:SoyParseInfoGenerator"
_SOY_LIBRARY = "@com_google_template_soy//:com_google_template_soy"

Expand Down Expand Up @@ -77,7 +79,7 @@ def closure_java_template_library(

# Now, wrap them in a Java library, and expose the Soy files as resources.
java_srcs = outs + extra_outs
native.java_library(
java_library(
name = name,
srcs = java_srcs or None,
exports = [str(Label(_SOY_LIBRARY))],
Expand Down
7 changes: 1 addition & 6 deletions closure/templates/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ package(default_testonly = True)

licenses(["notice"]) # Apache 2.0

load("//closure:defs.bzl", "closure_js_binary")
load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_proto_library")
load("//closure:defs.bzl", "closure_js_template_library")
load("//closure:defs.bzl", "closure_js_test")
load("//closure:defs.bzl", "closure_java_template_library")
load("//closure:defs.bzl", "closure_java_template_library", "closure_js_library", "closure_js_proto_library", "closure_js_template_library", "closure_js_test")
load("//closure/private:file_test.bzl", "file_test")

closure_js_proto_library(
Expand Down
4 changes: 1 addition & 3 deletions closure/testing/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ package(default_testonly = True)

licenses(["notice"]) # Apache 2.0

load("//closure:defs.bzl", "closure_js_library")
load("//closure:defs.bzl", "closure_js_test")
load("//closure:defs.bzl", "files_equal_test")
load("//closure:defs.bzl", "closure_js_library", "closure_js_test")

closure_js_library(
name = "arithmetic_lib",
Expand Down
2 changes: 2 additions & 0 deletions java/com/google/javascript/jscomp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "jscomp",
srcs = [
Expand Down
3 changes: 3 additions & 0 deletions java/io/bazel/rules/closure/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

licenses(["notice"]) # Apache 2.0

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_proto_library")

java_binary(
name = "ClosureWorker",
srcs = ["ClosureWorker.java"],
Expand Down
2 changes: 2 additions & 0 deletions java/io/bazel/rules/closure/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "http",
srcs = glob(["*.java"]),
Expand Down
2 changes: 2 additions & 0 deletions java/io/bazel/rules/closure/http/filter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "filter",
srcs = glob(["*.java"]),
Expand Down
3 changes: 3 additions & 0 deletions java/io/bazel/rules/closure/webfiles/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

licenses(["notice"]) # Apache 2.0

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_library", "java_proto_library")

java_library(
name = "webfiles",
srcs = glob(["*.java"]),
Expand Down
2 changes: 2 additions & 0 deletions java/io/bazel/rules/closure/webfiles/compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "compiler",
srcs = glob(["*.java"]),
Expand Down
6 changes: 4 additions & 2 deletions java/io/bazel/rules/closure/webfiles/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//closure:defs.bzl", "closure_java_template_library")

licenses(["notice"]) # Apache 2.0

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_proto_library")
load("//closure:defs.bzl", "closure_java_template_library")

java_library(
name = "server",
srcs = glob(["*.java"]),
Expand Down
3 changes: 3 additions & 0 deletions java/io/bazel/rules/closure/worker/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

licenses(["notice"]) # Apache 2.0

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_library", "java_proto_library")

java_library(
name = "worker",
srcs = glob(["*.java"]),
Expand Down
2 changes: 2 additions & 0 deletions java/org/jsoup/nodes/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")

java_library(
name = "nodes",
srcs = ["Html5Printer.java"],
Expand Down
2 changes: 2 additions & 0 deletions javatests/com/google/javascript/jscomp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_test")

java_test(
name = "DiagnosticsTest",
size = "small",
Expand Down
2 changes: 2 additions & 0 deletions javatests/io/bazel/rules/closure/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_test")

java_test(
name = "TarjanTest",
size = "small",
Expand Down
Loading

0 comments on commit d53c0d7

Please sign in to comment.