Skip to content

Commit

Permalink
feat(java): bump Java version to 11 (#5223)
Browse files Browse the repository at this point in the history
* feat(java): bump Java version to 11

* chore: delete unused jar

* fix(java): remove mentions of javac_jar from release
  • Loading branch information
shahms committed Feb 22, 2022
1 parent e8886d5 commit f4af9da
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ build --host_copt=-w
# Ensure environment variables are static across machines; allows for cross-user caching.
build --experimental_strict_action_env

# By default, compile for Java 8, run on Java 11
build --java_language_version=8
build --tool_java_language_version=8
# By default, compile for Java 11, run on Java 11
build --java_language_version=11
build --tool_java_language_version=11
build --java_runtime_version=remotejdk_11
build --tool_java_runtime_version=remotejdk_11

Expand Down
27 changes: 23 additions & 4 deletions kythe/java/com/google/devtools/kythe/analyzers/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ java_library(
"SourceText.java",
"TreeContext.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
":plugin",
"//kythe/java/com/google/devtools/kythe/analyzers/base:config",
Expand All @@ -38,7 +45,6 @@ java_library(
"//kythe/proto:common_java_proto",
"//kythe/proto:storage_java_proto",
"//third_party/guava",
"//third_party/javac",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_beust_jcommander",
"@maven//:com_google_code_findbugs_jsr305",
Expand All @@ -49,23 +55,31 @@ java_library(
java_library(
name = "source_text",
srcs = ["SourceText.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/platform/java/helpers",
"//kythe/java/com/google/devtools/kythe/util:position_mappings",
"//kythe/java/com/google/devtools/kythe/util:span",
"//third_party/javac",
],
)

java_library(
name = "plugin",
srcs = ["Plugin.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/analyzers/base:entryset",
"//kythe/java/com/google/devtools/kythe/platform/java/helpers",
"//kythe/java/com/google/devtools/kythe/util:span",
"//kythe/proto:storage_java_proto",
"//third_party/javac",
],
)

Expand Down Expand Up @@ -101,6 +115,12 @@ java_library(
"AutoValuePlugin.java",
"ResolvedAutoValue.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
":plugin",
"//kythe/java/com/google/devtools/kythe/analyzers/base:entryset",
Expand All @@ -109,6 +129,5 @@ java_library(
"//kythe/java/com/google/devtools/kythe/common:autovalue",
"//kythe/proto:storage_java_proto",
"//third_party/guava",
"//third_party/javac",
],
)
9 changes: 7 additions & 2 deletions kythe/java/com/google/devtools/kythe/extractors/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ java_library(
"UsageAsInputReportingFileManager.java",
"UsageAsInputReportingJavaFileObject.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/common:flogger",
"//kythe/java/com/google/devtools/kythe/extractors/shared",
Expand All @@ -24,7 +31,6 @@ java_library(
"//kythe/proto:java_java_proto",
"//kythe/proto:storage_java_proto",
"//third_party/guava",
"//third_party/javac",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
Expand All @@ -41,7 +47,6 @@ java_library(
deps = [
"//kythe/java/com/google/devtools/kythe/platform/java/filemanager:forwarding_standard_java_file_manager",
"//third_party/guava",
"//third_party/javac",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ exports_files(["javac-wrapper.sh"])
java_binary(
name = "javac_extractor",
srcs = ["Javac8Wrapper.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
main_class = "com.google.devtools.kythe.extractors.java.standalone.Javac8Wrapper",
visibility = ["//visibility:public"],
deps = [
Expand All @@ -17,7 +22,6 @@ java_binary(
"//kythe/java/com/google/devtools/kythe/extractors/shared:environment",
"//kythe/proto:storage_java_proto",
"//third_party/guava",
"//third_party/javac",
],
)

Expand All @@ -40,6 +44,9 @@ java_binary(
java_library(
name = "abstract_javac_wrapper",
srcs = ["AbstractJavacWrapper.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/extractors/java",
"//kythe/java/com/google/devtools/kythe/extractors/shared",
Expand All @@ -48,7 +55,6 @@ java_library(
"//kythe/java/com/google/devtools/kythe/util:json",
"//kythe/proto:analysis_java_proto",
"//third_party/guava",
"//third_party/javac",
"@maven//:com_google_flogger_flogger",
],
)
Expand Down
11 changes: 9 additions & 2 deletions kythe/java/com/google/devtools/kythe/platform/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ java_library(
"JavacAnalysisDriver.java",
"JavacAnalyzer.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
],
deps = [
":options",
"//kythe/java/com/google/devtools/kythe/common:flogger",
Expand All @@ -20,7 +23,6 @@ java_library(
"//kythe/proto:analysis_java_proto",
"//kythe/proto:storage_java_proto",
"//third_party/guava",
"//third_party/javac",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_google_code_findbugs_jsr305",
"@maven//:org_checkerframework_checker_qual",
Expand All @@ -30,11 +32,16 @@ java_library(
java_library(
name = "options",
srcs = ["JavacOptionsUtils.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
"//kythe/proto:analysis_java_proto",
"//kythe/proto:java_java_proto",
"//third_party/guava",
"//third_party/javac",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_google_code_findbugs_jsr305",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ package(default_visibility = ["//kythe:default_visibility"])
java_library(
name = "forwarding_standard_java_file_manager",
srcs = ["ForwardingStandardJavaFileManager.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/common:flogger",
"//third_party/guava",
"//third_party/javac",
],
)

Expand All @@ -22,6 +24,9 @@ java_library(
"JavaFileStore.java",
"JavaFileStoreBasedFileManager.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
],
deps = [
":filetree",
":forwarding_standard_java_file_manager",
Expand All @@ -30,7 +35,6 @@ java_library(
"//kythe/java/com/google/devtools/kythe/platform/shared:file_data",
"//kythe/proto:analysis_java_proto",
"//kythe/proto:java_java_proto",
"//third_party/javac",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_google_guava_guava",
Expand All @@ -41,6 +45,11 @@ java_library(
java_library(
name = "path_filemanager",
srcs = ["CompilationUnitPathFileManager.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
":forwarding_standard_java_file_manager",
"//kythe/java/com/google/devtools/kythe/common:flogger",
Expand All @@ -49,7 +58,6 @@ java_library(
"//kythe/java/com/google/devtools/kythe/platform/shared/filesystem",
"//kythe/proto:analysis_java_proto",
"//kythe/proto:java_java_proto",
"//third_party/javac",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_google_guava_guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ java_library(
"SignatureGenerator.java",
"SyntaxPreservingScanner.java",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
deps = [
"//kythe/java/com/google/devtools/kythe/common:flogger",
"//kythe/java/com/google/devtools/kythe/util:span",
"//third_party/guava",
"//third_party/javac",
"@com_google_protobuf//:protobuf_java",
"@maven//:com_google_code_findbugs_jsr305",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ java_test(
java_library(
name = "test_plugin",
srcs = ["TestPlugin.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
visibility = ["//kythe/javatests/com/google/devtools/kythe/analyzers/java:__subpackages__"],
deps = [
"//kythe/java/com/google/devtools/kythe/analyzers/base:entryset",
"//kythe/java/com/google/devtools/kythe/analyzers/java:plugin",
"//kythe/java/com/google/devtools/kythe/common:autoservice",
"//kythe/proto:storage_java_proto",
"//third_party/javac",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ java_binary(
"testdata/processor/SillyProcessor.java",
],
create_executable = 0,
deps = ["//third_party/javac"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ java_test(
name = "options_utils_test",
size = "small",
srcs = ["OptionsTest.java"],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
],
test_class = "com.google.devtools.kythe.platform.java.OptionsTest",
deps = [
"//kythe/java/com/google/devtools/kythe/platform/java:options",
"//kythe/proto:analysis_java_proto",
"//kythe/proto:java_java_proto",
"//third_party/guava",
"//third_party/javac",
"//third_party/truth",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:protobuf_java",
Expand Down
2 changes: 0 additions & 2 deletions kythe/release/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ docker_build(
"//kythe/java/com/google/devtools/kythe/analyzers/java:indexer_deploy.jar",
"//kythe/java/com/google/devtools/kythe/analyzers/jvm:class_file_indexer_deploy.jar",
"//kythe/java/com/google/devtools/kythe/extractors/java/standalone:javac_extractor_deploy.jar",
"//third_party/javac:javac_jar",
],
image_name = "google/kythe",
tags = ["manual"],
Expand Down Expand Up @@ -141,7 +140,6 @@ sh_test(
"//kythe/testdata:entries",
"//kythe/testdata:test.kzip",
"//third_party/guava",
"//third_party/javac:javac_jar",
"@com_github_stedolan_jq//:jq",
],
tags = [
Expand Down
3 changes: 1 addition & 2 deletions kythe/release/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ RUN echo 'exec /kythe/bin/c++_indexer.bin --flush_after_each_entry --ignore_unim

# Java
ADD kythe/java/com/google/devtools/kythe/analyzers/java/indexer_deploy.jar /kythe/bin/java_indexer_deploy.jar
ADD third_party/javac/javac-9+181-r4173-1.jar /kythe/bin/javac9.jar
RUN echo 'exec java -Xbootclasspath/p:/kythe/bin/javac9.jar -jar /kythe/bin/java_indexer_deploy.jar "$@"' > /kythe/bin/java_indexer
RUN echo 'exec java -jar /kythe/bin/java_indexer_deploy.jar "$@"' > /kythe/bin/java_indexer

# Go
ADD kythe/go/indexer/cmd/go_indexer/go_indexer /kythe/bin/go_indexer
Expand Down
8 changes: 0 additions & 8 deletions kythe/release/release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export TMPDIR=${TEST_TMPDIR:?}
SHASUM_TOOL="$PWD/$1"
shift

JAVA_LANGTOOLS="$PWD/$(ls third_party/javac/javac*.jar)"

TEST_PORT=9898
ADDR=localhost:$TEST_PORT
TEST_REPOSRCDIR="$PWD"
Expand Down Expand Up @@ -62,12 +60,6 @@ tools/triples < "$TEST_REPOSRCDIR/kythe/testdata/test.entries" >/dev/null

rm -rf "$TMPDIR/java_compilation"
export KYTHE_OUTPUT_FILE="$TMPDIR/java_compilation/util.kzip"
if (java -version |& head -1 | grep 1.8 >/dev/null);
then
export KYTHE_JAVA_RUNTIME_OPTIONS="-Xbootclasspath/p:$JAVA_LANGTOOLS"
else
export KYTHE_JAVA_RUNTIME_OPTIONS="-Xbootclasspath/a:$JAVA_LANGTOOLS"
fi
JAVAC_EXTRACTOR_JAR=$PWD/extractors/javac_extractor.jar \
KYTHE_ROOT_DIRECTORY="$TEST_REPOSRCDIR" \
KYTHE_EXTRACT_ONLY=1 \
Expand Down
11 changes: 0 additions & 11 deletions third_party/javac/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ filegroup(
srcs = ["LICENSE"],
)

java_import(
name = "javac",
jars = [":javac_jar"],
neverlink = True,
)

java_import(
name = "javac9",
jars = [
Expand All @@ -24,11 +18,6 @@ java_import(
neverlink = True,
)

filegroup(
name = "javac_jar",
srcs = ["javac-9+181-r4173-1.jar"],
)

filegroup(
name = "jdk_compiler_jar",
srcs = ["jdk_compiler.jar"],
Expand Down
Binary file removed third_party/javac/javac-9+181-r4173-1.jar
Binary file not shown.

0 comments on commit f4af9da

Please sign in to comment.