blob: 84856ee8863fc50c79c1fff03eafa3e6b86b6265 [file] [log] [blame]
Carmelo Cascone395b2312019-06-18 17:34:16 -07001# 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
6load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
7
8default_java_toolchain(
9 name = "default_toolchain",
10 source_version = "11",
11 target_version = "11",
12 visibility = ["//visibility:public"],
13)
14
15alias(
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
30genrule(
31 name = "default_jdk_tar",
32 srcs = [
33 "@bazel_tools//tools/jdk:current_java_runtime",
34 ":conf-security",
35 ],
36 outs = ["default_jdk.tar.gz"],
37 cmd = "mkdir default_jdk && " +
38 "mv $(JAVABASE)/* default_jdk/ && " +
39 "mv tools/build/jdk/* default_jdk/ && " +
40 "tar -hczf $(location default_jdk.tar.gz) default_jdk",
41 output_to_bindir = True,
42 toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
43 visibility = ["//visibility:public"],
44)
45
46filegroup(
47 name = "conf-security",
48 srcs = glob(["conf/security/**"]),
49)