Carmelo Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 1 | # This is where we define the JDK used to build ONOS, as well as the language |
| 2 | # source and target values passed to javac. The :default_toolchain and |
| 3 | # :default_jdk are expected to be passed as arguments when invoking bazel build |
| 4 | # (see onos/.bazelrc) |
| 5 | |
| 6 | load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain") |
| 7 | |
| 8 | default_java_toolchain( |
| 9 | name = "default_toolchain", |
| 10 | source_version = "11", |
| 11 | target_version = "11", |
| 12 | visibility = ["//visibility:public"], |
| 13 | ) |
| 14 | |
| 15 | alias( |
| 16 | name = "default_jdk", |
| 17 | actual = "@bazel_tools//tools/jdk:remote_jdk11", |
| 18 | visibility = ["//visibility:public"], |
| 19 | ) |
| 20 | |
| 21 | # We use the following rule to package the same JDK used for building and make |
| 22 | # it available for external scripts as their JAVA_HOME, such as for `bazel run |
| 23 | # onos-local`. |
| 24 | |
| 25 | # FIXME: @bazel_tools//tools/jdk:current_java_runtime should be fixed upstream |
| 26 | # to include the missing JDK conf/security files, required by Karaf. The |
| 27 | # workaround for now is to check in those files here and include them in the |
| 28 | # produced JDK tar. |
| 29 | |
| 30 | genrule( |
Carmelo Cascone | 3dcb7fd | 2019-06-26 14:08:36 -0700 | [diff] [blame] | 31 | name = "current_jdk_tar", |
Carmelo Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 32 | srcs = [ |
| 33 | "@bazel_tools//tools/jdk:current_java_runtime", |
| 34 | ":conf-security", |
| 35 | ], |
Carmelo Cascone | 3dcb7fd | 2019-06-26 14:08:36 -0700 | [diff] [blame] | 36 | outs = ["current_jdk.tar.gz"], |
| 37 | cmd = "mkdir current_jdk && " + |
| 38 | "cp -r $(JAVABASE)/* current_jdk/ && " + |
| 39 | "cp -r tools/build/jdk/* current_jdk/ && " + |
| 40 | "tar -hczf $(location current_jdk.tar.gz) current_jdk", |
Carmelo Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 41 | output_to_bindir = True, |
| 42 | toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"], |
| 43 | visibility = ["//visibility:public"], |
| 44 | ) |
| 45 | |
| 46 | filegroup( |
| 47 | name = "conf-security", |
| 48 | srcs = glob(["conf/security/**"]), |
| 49 | ) |