aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Philipp Wollermann <philwo@google.com>2015-08-21 13:35:10 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-08-24 14:01:46 +0000
commitc8db70c7bc8f9cf916daac42010a4886b825fc63 (patch)
tree380733a12ad64d39fa1e1656b9845631942668c2 /tools
parentf99bb1c2c0de9e5e3c7b16e7e7a982a7c0bad815 (diff)
Improve the JDK and JRE filegroups to include all the necessary parts. Then fix the Skylark rules and tests that so far failed to declare dependencies on the JVM.
-- MOS_MIGRATED_REVID=101215495
Diffstat (limited to 'tools')
-rw-r--r--tools/build_rules/genproto.bzl27
-rw-r--r--tools/build_rules/java_rules_skylark.bzl8
-rw-r--r--tools/jdk/BUILD11
3 files changed, 30 insertions, 16 deletions
diff --git a/tools/build_rules/genproto.bzl b/tools/build_rules/genproto.bzl
index a2e2d735a9..d6e6a80bd5 100644
--- a/tools/build_rules/genproto.bzl
+++ b/tools/build_rules/genproto.bzl
@@ -32,7 +32,7 @@ def gensrcjar_impl(ctx):
ctx.action(
command=" && ".join(sub_commands),
- inputs=[ctx.file.src, proto_compiler, ctx.file._jar],
+ inputs=[ctx.file.src, proto_compiler, ctx.file._jar] + ctx.files._jdk,
outputs=[out],
mnemonic="GenProtoSrcJar",
use_default_shell_env = True)
@@ -40,17 +40,20 @@ def gensrcjar_impl(ctx):
gensrcjar = rule(
gensrcjar_impl,
attrs={
- "src": attr.label(allow_files=proto_filetype, single_file=True),
- # TODO(bazel-team): this should be a hidden attribute with a default
- # value, but Skylark needs to support select first.
- "_proto_compiler": attr.label(
- default=Label("//third_party:protoc"),
- allow_files=True,
- single_file=True),
- "_jar": attr.label(
- default=Label("//external:jar"),
- allow_files=True,
- single_file=True),
+ "src": attr.label(allow_files=proto_filetype, single_file=True),
+ # TODO(bazel-team): this should be a hidden attribute with a default
+ # value, but Skylark needs to support select first.
+ "_proto_compiler": attr.label(
+ default=Label("//third_party:protoc"),
+ allow_files=True,
+ single_file=True),
+ "_jar": attr.label(
+ default=Label("//tools/jdk:jar"),
+ allow_files=True,
+ single_file=True),
+ "_jdk": attr.label(
+ default=Label("//tools/jdk:jdk"),
+ allow_files=True),
},
outputs={"srcjar": "lib%{name}.srcjar"},
)
diff --git a/tools/build_rules/java_rules_skylark.bzl b/tools/build_rules/java_rules_skylark.bzl
index 8a59f87b38..21b344d72b 100644
--- a/tools/build_rules/java_rules_skylark.bzl
+++ b/tools/build_rules/java_rules_skylark.bzl
@@ -81,7 +81,7 @@ def java_library_impl(ctx):
"touch " + build_output + "\n")
ctx.action(
inputs = (sources + compile_time_jars_list + [sources_param_file] +
- ctx.files.resources + ctx.files.srcjars),
+ [ctx.file._jar] + ctx.files._jdk + ctx.files.resources + ctx.files.srcjars),
outputs = [class_jar],
mnemonic='Javac',
command=cmd,
@@ -116,7 +116,7 @@ def java_binary_impl(ctx):
"touch " + build_output + "\n")
ctx.action(
- inputs=list(library_result.runtime_jars) + [manifest],
+ inputs=list(library_result.runtime_jars) + [manifest] + ctx.files._jdk,
outputs=[deploy_jar],
mnemonic='Deployjar',
command=cmd,
@@ -167,8 +167,7 @@ def java_binary_impl(ctx):
]),
executable = True)
- runfiles = ctx.runfiles(files = [
- deploy_jar, executable] + ctx.files.jvm, collect_data = True)
+ runfiles = ctx.runfiles(files = [deploy_jar, executable] + ctx.files._jdk, collect_data = True)
files_to_build = set([deploy_jar, manifest, executable])
files_to_build += library_result.files
@@ -191,6 +190,7 @@ java_library_attrs = {
"_java": attr.label(default=Label("//tools/jdk:java"), single_file=True),
"_javac": attr.label(default=Label("//tools/jdk:javac"), single_file=True),
"_jar": attr.label(default=Label("//tools/jdk:jar"), single_file=True),
+ "_jdk": attr.label(default=Label("//tools/jdk:jdk"), allow_files=True),
"data": attr.label_list(allow_files=True, cfg=DATA_CFG),
"resources": attr.label_list(allow_files=True),
"srcs": attr.label_list(allow_files=java_filetype),
diff --git a/tools/jdk/BUILD b/tools/jdk/BUILD
index 87b3a0bc23..58db282c37 100644
--- a/tools/jdk/BUILD
+++ b/tools/jdk/BUILD
@@ -60,6 +60,17 @@ java_import(
)
# This one is just needed because of how filegroup redirection works.
+filegroup(name = "jre-null")
+
+filegroup(
+ name = "jre",
+ srcs = [
+ ":jre-null",
+ "//external:jre-default",
+ ],
+)
+
+# This one is just needed because of how filegroup redirection works.
filegroup(name = "jdk-null")
filegroup(