Skip to content

Commit

Permalink
Update to java_tools javac11 release 10.5 (bazelbuild#12647)
Browse files Browse the repository at this point in the history
* Java_tools javac11 v10.5 rc1.

* Regression tests for bazelbuild#12605

* Java_tools javac11 v10.5 release.
  • Loading branch information
comius authored and ulfjack committed Mar 5, 2021
1 parent 192b599 commit 49bc1eb
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 51 deletions.
72 changes: 36 additions & 36 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ distdir_tar(
# Keep in sync with the archives fetched as part of building bazel.
archives = [
"e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
"java_tools_javac11_linux-v10.4.zip",
"java_tools_javac11_windows-v10.4.zip",
"java_tools_javac11_darwin-v10.4.zip",
"java_tools_javac11_linux-v10.5.zip",
"java_tools_javac11_windows-v10.5.zip",
"java_tools_javac11_darwin-v10.5.zip",
"coverage_output_generator-v2.5.zip",
# bazelbuid/stardoc
"1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
Expand Down Expand Up @@ -187,9 +187,9 @@ distdir_tar(
dirname = "derived/distdir",
sha256 = {
"e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip": "fe2e04f91ce8c59d49d91b8102edc6627c6fa2906c1b0e7346f01419ec4f419d",
"java_tools_javac11_linux-v10.4.zip": "7debb49457db2f10990f759b6984c6d4ccb4917a9a9fd402a6f224b5fb0e8e36",
"java_tools_javac11_windows-v10.4.zip": "3a7d802ccefffa6ecf6e190aaae081cf27fc0275e2a8dad7d3a943c63a4d0edc",
"java_tools_javac11_darwin-v10.4.zip": "587a7bc34c95a217a941b01a5a1f8ee48114fbe87e05872a41b7e019e5297a8a",
"java_tools_javac11_linux-v10.5.zip": "355c27c603e8fc64bb0e2d7f809741f42576d5f4540f9ce28fd55922085af639",
"java_tools_javac11_windows-v10.5.zip": "0b4469ca1a9b3f26cb82fb0f4fd00096f0d839ec2fae097e7bdbb982e3a95a59",
"java_tools_javac11_darwin-v10.5.zip": "95aae0a32a170c72a68abb0b9dd6bac7ea3e08c504a5d8c6e8bf7ac51628c98f",
"coverage_output_generator-v2.5.zip": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
# bazelbuild/stardoc
"1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1",
Expand Down Expand Up @@ -230,14 +230,14 @@ distdir_tar(
"https://mirror.bazel.build/github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
"https://github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
],
"java_tools_javac11_linux-v10.4.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_linux-v10.4.zip",
"java_tools_javac11_linux-v10.5.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_linux-v10.5.zip",
],
"java_tools_javac11_windows-v10.4.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_windows-v10.4.zip",
"java_tools_javac11_windows-v10.5.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_windows-v10.5.zip",
],
"java_tools_javac11_darwin-v10.4.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_darwin-v10.4.zip",
"java_tools_javac11_darwin-v10.5.zip": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_darwin-v10.5.zip",
],
"coverage_output_generator-v2.5.zip": [
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip",
Expand Down Expand Up @@ -545,9 +545,9 @@ http_archive(
distdir_tar(
name = "test_WORKSPACE_files",
archives = [
"java_tools_javac11_linux-v10.4.zip",
"java_tools_javac11_windows-v10.4.zip",
"java_tools_javac11_darwin-v10.4.zip",
"java_tools_javac11_linux-v10.5.zip",
"java_tools_javac11_windows-v10.5.zip",
"java_tools_javac11_darwin-v10.5.zip",
"coverage_output_generator-v2.5.zip",
"zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz",
"zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz",
Expand Down Expand Up @@ -579,9 +579,9 @@ distdir_tar(
],
dirname = "test_WORKSPACE/distdir",
sha256 = {
"java_tools_javac11_linux-v10.4.zip": "7debb49457db2f10990f759b6984c6d4ccb4917a9a9fd402a6f224b5fb0e8e36",
"java_tools_javac11_windows-v10.4.zip": "3a7d802ccefffa6ecf6e190aaae081cf27fc0275e2a8dad7d3a943c63a4d0edc",
"java_tools_javac11_darwin-v10.4.zip": "587a7bc34c95a217a941b01a5a1f8ee48114fbe87e05872a41b7e019e5297a8a",
"java_tools_javac11_linux-v10.5.zip": "355c27c603e8fc64bb0e2d7f809741f42576d5f4540f9ce28fd55922085af639",
"java_tools_javac11_windows-v10.5.zip": "0b4469ca1a9b3f26cb82fb0f4fd00096f0d839ec2fae097e7bdbb982e3a95a59",
"java_tools_javac11_darwin-v10.5.zip": "95aae0a32a170c72a68abb0b9dd6bac7ea3e08c504a5d8c6e8bf7ac51628c98f",
"coverage_output_generator-v2.5.zip": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
"zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz": "a452f1b9682d9f83c1c14e54d1446e1c51b5173a3a05dcb013d380f9508562e4",
Expand Down Expand Up @@ -612,9 +612,9 @@ distdir_tar(
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz": "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
},
urls = {
"java_tools_javac11_linux-v10.4.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_linux-v10.4.zip"],
"java_tools_javac11_windows-v10.4.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_windows-v10.4.zip"],
"java_tools_javac11_darwin-v10.4.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_darwin-v10.4.zip"],
"java_tools_javac11_linux-v10.5.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_linux-v10.5.zip"],
"java_tools_javac11_windows-v10.5.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_windows-v10.5.zip"],
"java_tools_javac11_darwin-v10.5.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_darwin-v10.5.zip"],
"coverage_output_generator-v2.5.zip": ["https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip"],
"zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"],
"zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz"],
Expand Down Expand Up @@ -919,10 +919,10 @@ http_archive(
name = "remote_java_tools_linux_for_testing",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "7debb49457db2f10990f759b6984c6d4ccb4917a9a9fd402a6f224b5fb0e8e36",
sha256 = "355c27c603e8fc64bb0e2d7f809741f42576d5f4540f9ce28fd55922085af639",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_linux-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_linux-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_linux-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_linux-v10.5.zip",
],
)

Expand All @@ -931,10 +931,10 @@ http_archive(
name = "remote_java_tools_windows_for_testing",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "3a7d802ccefffa6ecf6e190aaae081cf27fc0275e2a8dad7d3a943c63a4d0edc",
sha256 = "0b4469ca1a9b3f26cb82fb0f4fd00096f0d839ec2fae097e7bdbb982e3a95a59",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_windows-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_windows-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_windows-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_windows-v10.5.zip",
],
)

Expand All @@ -943,10 +943,10 @@ http_archive(
name = "remote_java_tools_darwin_for_testing",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "587a7bc34c95a217a941b01a5a1f8ee48114fbe87e05872a41b7e019e5297a8a",
sha256 = "95aae0a32a170c72a68abb0b9dd6bac7ea3e08c504a5d8c6e8bf7ac51628c98f",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_darwin-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_darwin-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_darwin-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_darwin-v10.5.zip",
],
)

Expand All @@ -955,9 +955,9 @@ http_archive(
name = "remote_java_tools_javac11_test_linux",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "7debb49457db2f10990f759b6984c6d4ccb4917a9a9fd402a6f224b5fb0e8e36",
sha256 = "355c27c603e8fc64bb0e2d7f809741f42576d5f4540f9ce28fd55922085af639",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_linux-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_linux-v10.5.zip",
],
)

Expand All @@ -966,9 +966,9 @@ http_archive(
name = "remote_java_tools_javac11_test_windows",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "3a7d802ccefffa6ecf6e190aaae081cf27fc0275e2a8dad7d3a943c63a4d0edc",
sha256 = "0b4469ca1a9b3f26cb82fb0f4fd00096f0d839ec2fae097e7bdbb982e3a95a59",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_windows-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_windows-v10.5.zip",
],
)

Expand All @@ -977,9 +977,9 @@ http_archive(
name = "remote_java_tools_javac11_test_darwin",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "587a7bc34c95a217a941b01a5a1f8ee48114fbe87e05872a41b7e019e5297a8a",
sha256 = "95aae0a32a170c72a68abb0b9dd6bac7ea3e08c504a5d8c6e8bf7ac51628c98f",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_darwin-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_darwin-v10.5.zip",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,32 +163,32 @@ maybe(
maybe(
http_archive,
name = "remote_java_tools_linux",
sha256 = "7debb49457db2f10990f759b6984c6d4ccb4917a9a9fd402a6f224b5fb0e8e36",
sha256 = "355c27c603e8fc64bb0e2d7f809741f42576d5f4540f9ce28fd55922085af639",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_linux-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_linux-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_linux-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_linux-v10.5.zip",
],
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
http_archive,
name = "remote_java_tools_windows",
sha256 = "3a7d802ccefffa6ecf6e190aaae081cf27fc0275e2a8dad7d3a943c63a4d0edc",
sha256 = "0b4469ca1a9b3f26cb82fb0f4fd00096f0d839ec2fae097e7bdbb982e3a95a59",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_windows-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_windows-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_windows-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_windows-v10.5.zip",
],
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
http_archive,
name = "remote_java_tools_darwin",
sha256 = "587a7bc34c95a217a941b01a5a1f8ee48114fbe87e05872a41b7e019e5297a8a",
sha256 = "95aae0a32a170c72a68abb0b9dd6bac7ea3e08c504a5d8c6e8bf7ac51628c98f",
urls = [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.4/java_tools_javac11_darwin-v10.4.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.4/java_tools_javac11_darwin-v10.4.zip",
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.5/java_tools_javac11_darwin-v10.5.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.5/java_tools_javac11_darwin-v10.5.zip",
],
)

Expand Down
100 changes: 100 additions & 0 deletions src/test/shell/bazel/bazel_java14_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,104 @@ EOF
expect_log "0"
}

# Regression test for https://github.com/bazelbuild/bazel/issues/12605
function test_java15_plugins() {
mkdir -p java/main
cat >java/main/BUILD <<EOF
java_library(
name = "Anno",
srcs = ["Anno.java"],
)
java_plugin(
name = "Proc",
srcs = ["Proc.java"],
deps = [":Anno"],
processor_class = "ex.Proc",
generates_api = True,
)
java_library(
name = "C1",
srcs = ["C1.java"],
deps = [":Anno"],
plugins = [":Proc"],
)
java_library(
name = "C2",
srcs = ["C2.java"],
deps = [":C1"],
)
EOF

cat >java/main/C1.java <<EOF
package ex;
public class C1 {
@Anno
@Deprecated
public void m() {}
}
EOF


cat >java/main/C2.java <<EOF
package ex;
public class C2 {
public void m() {
new C1().m();
}
}
EOF

cat >java/main/Anno.java <<EOF
package ex;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface Anno {}
EOF

cat >java/main/Proc.java <<EOF
package ex;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.tools.Diagnostic.Kind;
@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedAnnotationTypes("ex.Anno")
public class Proc extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Elements els = processingEnv.getElementUtils();
for (Element el : roundEnv.getElementsAnnotatedWith(Anno.class)) {
if (els.isDeprecated(el)) {
processingEnv.getMessager().printMessage(Kind.WARNING, "deprecated");
}
}
return true;
}
}
EOF

bazel build //java/main:C2 &>"${TEST_log}" || fail "Expected to build"
}

run_suite "Tests new Java 14 language features"
Loading

0 comments on commit 49bc1eb

Please sign in to comment.