Carmelo Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 1 | # 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 | |
| 10 | genrule( |
Carmelo Cascone | 3dcb7fd | 2019-06-26 14:08:36 -0700 | [diff] [blame] | 11 | name = "current_jdk_tar", |
Carmelo Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 12 | srcs = [ |
| 13 | "@bazel_tools//tools/jdk:current_java_runtime", |
| 14 | ":conf-security", |
| 15 | ], |
Carmelo Cascone | 3dcb7fd | 2019-06-26 14:08:36 -0700 | [diff] [blame] | 16 | 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 Cascone | 395b231 | 2019-06-18 17:34:16 -0700 | [diff] [blame] | 21 | output_to_bindir = True, |
| 22 | toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"], |
| 23 | visibility = ["//visibility:public"], |
| 24 | ) |
| 25 | |
| 26 | filegroup( |
| 27 | name = "conf-security", |
| 28 | srcs = glob(["conf/security/**"]), |
| 29 | ) |