blob: c99f398289eb9f639145e06c01e2d15c73d38266 [file] [log] [blame]
Carmelo Cascone395b2312019-06-18 17:34:16 -07001# We use the following rule to package the same JDK used for building and make
2# it available for external scripts as their JAVA_HOME, such as for `bazel run
3# onos-local`.
4
5# FIXME: @bazel_tools//tools/jdk:current_java_runtime should be fixed upstream
6# to include the missing JDK conf/security files, required by Karaf. The
7# workaround for now is to check in those files here and include them in the
8# produced JDK tar.
9
10genrule(
Carmelo Cascone3dcb7fd2019-06-26 14:08:36 -070011 name = "current_jdk_tar",
Carmelo Cascone395b2312019-06-18 17:34:16 -070012 srcs = [
13 "@bazel_tools//tools/jdk:current_java_runtime",
14 ":conf-security",
15 ],
Carmelo Cascone3dcb7fd2019-06-26 14:08:36 -070016 outs = ["current_jdk.tar.gz"],
17 cmd = "mkdir current_jdk && " +
18 "cp -r $(JAVABASE)/* current_jdk/ && " +
19 "cp -r tools/build/jdk/* current_jdk/ && " +
20 "tar -hczf $(location current_jdk.tar.gz) current_jdk",
Carmelo Cascone395b2312019-06-18 17:34:16 -070021 output_to_bindir = True,
22 toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
23 visibility = ["//visibility:public"],
24)
25
26filegroup(
27 name = "conf-security",
28 srcs = glob(["conf/security/**"]),
29)