Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Fix a bug that allows to compile Tink for Java with Bazel 0.17.2 (lat…
Browse files Browse the repository at this point in the history
…est).

Kokoro hasn't failed because its macOS and Ubuntu machines are using old Bazel versions.

Related issues:
#131
#136
bazelbuild/bazel#5997
bazelbuild/bazel#5594

PiperOrigin-RevId: 215787620
GitOrigin-RevId: 7b978f1374938e4b839f8357fc50d36b7ab96be5
  • Loading branch information
thaidn authored and Tink Team committed Oct 4, 2018
1 parent d32ac27 commit 91b6f87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
1 change: 0 additions & 1 deletion docs/JAVA-HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Building Tink

* Install [Bazel](https://docs.bazel.build/versions/master/install.html).
Version 0.9.0 or newer are known to work correctly with Tink.

* To build Java, install Android SDK 23 or newer and set the ANDROID_HOME
environment variable to the path of your Android SDK. On macOS, the SDK is
Expand Down
16 changes: 5 additions & 11 deletions tools/javadoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _javadoc_library(ctx):

include_packages = ":".join(ctx.attr.root_packages)
javadoc_command = [
ctx.file._javadoc_binary.path,
"%s/bin/javadoc" % ctx.attr._jdk[java_common.JavaRuntimeInfo].java_home,
"-sourcepath srcs",
"-use",
"-subpackages",
Expand Down Expand Up @@ -72,7 +72,8 @@ def _javadoc_library(ctx):
if path_prefix in src.path:
prepare_srcs_command += "cp %s srcs/%s && " % (src.path, path_prefix)

jar_command = "%s cf %s -C tmp ." % (ctx.file._jar_binary.path, ctx.outputs.jar.path)
jar_binary = "%s/bin/jar" % ctx.attr._jdk[java_common.JavaRuntimeInfo].java_home
jar_command = "%s cf %s -C tmp ." % (jar_binary, ctx.outputs.jar.path)

ctx.actions.run_shell(
inputs = srcs + classpath + ctx.files._jdk,
Expand All @@ -94,17 +95,10 @@ javadoc_library = rule(
default = _android_jar,
allow_single_file = True,
),
"_javadoc_binary": attr.label(
default = Label("@local_jdk//:bin/javadoc"),
allow_single_file = True,
),
"_jar_binary": attr.label(
default = Label("@local_jdk//:bin/jar"),
allow_single_file = True,
),
"_jdk": attr.label(
default = Label("@local_jdk//:jdk-default"),
default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
allow_files = True,
providers = [java_common.JavaRuntimeInfo],
),
},
outputs = {"jar": "%{name}.jar"},
Expand Down

0 comments on commit 91b6f87

Please sign in to comment.