Enforce build with Java 11 for all by default
- Build with JDK11 and language levels (source and target) are now
enforced in .bazelrc, which depends on our own Java toolchain (defined
in tools/build/bazel/BUILD)
- Easymock bumped to v4.0.2 with support for Java 11 (minor API changes)
- The minimum required Bazel version is now 0.27.*
Change-Id: I0bb6dfe7fc1ea134b5a53dd249c369d58259688c
diff --git a/tools/build/bazel/BUILD b/tools/build/bazel/BUILD
index d819d63..cf20246 100644
--- a/tools/build/bazel/BUILD
+++ b/tools/build/bazel/BUILD
@@ -1,3 +1,17 @@
+load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
+
+# This is where we define the language source and target values passed to javac
+# when building ONOS. This toolchain should be used when invoking bazel build
+# (see onos/.bazelrc)
+default_java_toolchain(
+ name = "default_toolchain",
+ source_version = "11",
+ target_version = "11",
+ visibility = [
+ "//visibility:public",
+ ],
+)
+
py_binary(
name = "osgi_feature_bundler",
srcs = ["osgi_feature_bundler.py"],
diff --git a/tools/build/bazel/bazel_version.bzl b/tools/build/bazel/bazel_version.bzl
index 49434bf..9a0046e 100644
--- a/tools/build/bazel/bazel_version.bzl
+++ b/tools/build/bazel/bazel_version.bzl
@@ -16,12 +16,12 @@
def check_bazel_version():
if "bazel_version" not in dir(native):
- fail("\nBazel version is too old; please use 0.23.* official release!\n\n")
+ fail("\nBazel version is too old; please use 0.27.* official release!\n\n")
elif not native.bazel_version:
- print("\nBazel is not a release version; please use 0.23.* official release!\n\n")
+ print("\nBazel is not a release version; please use 0.27.* official release!\n\n")
return
versions = native.bazel_version.split(".")
- if not int(versions[1]) >= 23:
- fail("\nBazel version %s is not supported; please use 0.23.* official release!\n\n" %
+ if not int(versions[1]) >= 27:
+ fail("\nBazel version %s is not supported; please use 0.27.* official release!\n\n" %
native.bazel_version)
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index c177993..086ebea 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Wed, 29 May 2019 22:17:30 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Mon, 17 Jun 2019 19:13:01 GMT. Do not edit this file manually. *****
# ***** Use onos-lib-gen *****
load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION")
@@ -295,9 +295,9 @@
if "easymock" not in native.existing_rules():
java_import_external(
name = "easymock",
- jar_sha256 = "0557c9fa845c951bdbe3940b605346a212172c64328277428297ef1fc6308e8f",
+ jar_sha256 = "104370107ef64d115e642cbdc14cea438a8d076f5aee9a9cb7882dc9a8ed4123",
licenses = ["notice"],
- jar_urls = ["http://repo1.maven.org/maven2/org/easymock/easymock/3.6/easymock-3.6.jar"], )
+ jar_urls = ["http://repo1.maven.org/maven2/org/easymock/easymock/4.0.2/easymock-4.0.2.jar"], )
if "antlr" not in native.existing_rules():
java_import_external(
name = "antlr",
@@ -1353,7 +1353,7 @@
artifact_map["@commons_pool//:commons_pool"] = "mvn:commons-pool:commons-pool:jar:1.6"
artifact_map["@commons_text//:commons_text"] = "mvn:org.apache.commons:commons-text:jar:1.3"
artifact_map["@concurrent_trees//:concurrent_trees"] = "mvn:com.googlecode.concurrent-trees:concurrent-trees:jar:2.6.1"
-artifact_map["@easymock//:easymock"] = "mvn:org.easymock:easymock:jar:3.6"
+artifact_map["@easymock//:easymock"] = "mvn:org.easymock:easymock:jar:4.0.2"
artifact_map["@antlr//:antlr"] = "mvn:antlr:antlr:jar:NON-OSGI:2.7.7"
artifact_map["@ganymed_ssh2//:ganymed_ssh2"] = "mvn:ch.ethz.ganymed:ganymed-ssh2:jar:NON-OSGI:262"
artifact_map["@gmetric4j//:gmetric4j"] = "mvn:info.ganglia.gmetric4j:gmetric4j:jar:1.0.10"
diff --git a/tools/build/bazel/osgi_java_library.bzl b/tools/build/bazel/osgi_java_library.bzl
index 3720064..8296fcf 100644
--- a/tools/build/bazel/osgi_java_library.bzl
+++ b/tools/build/bazel/osgi_java_library.bzl
@@ -448,7 +448,7 @@
if import_packages == None:
import_packages = "*"
tests_name = name + "-tests"
- tests_jar_deps = list(depset(deps + test_deps)) + [name]
+ tests_jar_deps = depset(deps + test_deps).to_list() + [name]
all_test_deps = tests_jar_deps + [tests_name]
web_xml = _webapp()