Skip to content

Commit

Permalink
Remove langtools jars
Browse files Browse the repository at this point in the history
Follow-up to #15303
  • Loading branch information
cushon committed Apr 22, 2022
1 parent 14b5c41 commit eddf708
Show file tree
Hide file tree
Showing 30 changed files with 12 additions and 561 deletions.
9 changes: 0 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,6 @@ dist_http_archive(
name = "build_bazel_rules_nodejs",
)

http_archive(
name = "java_tools_langtools_javac11",
sha256 = "cf0814fa002ef3d794582bb086516d8c9ed0958f83f19799cdb08949019fe4c7",
urls = [
"https://mirror.bazel.build/bazel_java_tools/jdk_langtools/langtools_jdk11_v2.zip",
],
)

dist_http_archive(
name = "platforms",
)
Expand Down Expand Up @@ -666,4 +658,3 @@ debian_deps()
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

1 change: 0 additions & 1 deletion scripts/packages/debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ License: Eclipse Distribution License 1.0
License: Eclipse Public License
License: Eclipse Public License Version 1.0
License: GNU GPL v2 with Classpath exception
License: GNU GPL v2 with Classpath exception (plus other licenses, see third_party/java/jdk/langtools/LICENSE file).
License: GNU GPL v2 with Classpath exception, portions MIT
License: MIT
License: MIT license
Expand Down
5 changes: 1 addition & 4 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ genrule(
"//third_party/ijar:transitive_sources",
"//third_party/java/jacoco:transitive_sources",
"//third_party/java/proguard:srcs",
"@java_tools_langtools_javac11//:srcs",
],
outs = ["java_tools_dist.zip"],
cmd = "zip -qXr $@ $$(echo $(SRCS) | sort)",
Expand All @@ -548,9 +547,7 @@ JAVA_TOOLS_DEPLOY_JARS = [

release_archive(
name = "jars_java_tools_zip",
srcs = JAVA_TOOLS_DEPLOY_JARS + [
"@java_tools_langtools_javac11//:javac_jar",
],
srcs = JAVA_TOOLS_DEPLOY_JARS,
package_dir = "java_tools",
visibility = ["//visibility:private"],
)
Expand Down
1 change: 0 additions & 1 deletion src/create_embedded_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
('*tools/cpp/BUILD.tools', lambda x: 'tools/cpp/BUILD'),
('*tools/cpp/runfiles/generated_*',
lambda x: 'tools/cpp/runfiles/' + os.path.basename(x)[len('generated_'):]),
('*BUILD.java_langtools', lambda x: 'third_party/java/jdk/langtools/BUILD'),
('*launcher.exe', lambda x: 'tools/launcher/launcher.exe'),
('*def_parser.exe', lambda x: 'tools/def_parser/def_parser.exe'),
('*zipper.exe', lambda x: 'tools/zip/zipper/zipper.exe'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ public void setupMockClient(MockToolsConfig config, List<String> workspaceConten
"java_toolchain_alias(name = 'current_java_toolchain')",
"java_runtime_alias(name = 'current_java_runtime')",
"java_host_runtime_alias(name = 'current_host_java_runtime')",
"filegroup(name='langtools', srcs=['jdk/lib/tools.jar'])",
"filegroup(name='bootclasspath', srcs=['jdk/jre/lib/rt.jar'])",
"filegroup(name='extdir', srcs=glob(['jdk/jre/lib/ext/*']))",
"filegroup(name='java', srcs = ['jdk/jre/bin/java'])",
Expand Down
11 changes: 0 additions & 11 deletions src/test/java/com/google/devtools/build/lib/blackbox/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ java_library(
"JavaToolsSetup.java",
],
data = [
":langtools-copy",
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner:Runner_deploy.jar",
"//src/tools/singlejar",
"//third_party/ijar",
"//third_party/java/jdk/langtools:test-srcs",
"@bazel_tools//tools/jdk:current_java_runtime",
],
visibility = [":tests"],
Expand All @@ -92,15 +90,6 @@ java_library(
],
)

# needed by java tools
genrule(
name = "langtools-copy",
testonly = 1,
srcs = ["//third_party/java/jdk/langtools:javac_jar"],
outs = ["langtools.jar"],
cmd = "cp $< $@",
)

java_library(
name = "cxx",
testonly = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,5 @@ public void setup(BlackBoxTestContext context) throws IOException {
Files.copy(buildFiles.get(0), buildFile);
assertThat(buildFile.toFile().setWritable(true)).isTrue();
}

String packageSubpath = JavaToolsSetup.class.getPackage().getName().replace('.', '/');
Path langToolsJar =
RunfilesUtil.find(String.format("io_bazel/src/test/java/%s/langtools.jar", packageSubpath));
Files.copy(langToolsJar, jdkDirectory.resolve("langtools.jar"));
PathUtils.writeBuild(
jdkDirectory, "filegroup(name = \"test-langtools\", srcs = [\"langtools.jar\"])");

PathUtils.copyTree(
RunfilesUtil.find("io_bazel/third_party/java/jdk/langtools/BUILD").getParent(),
context.getWorkDir().resolve("third_party/java/jdk/langtools"));
}
}
10 changes: 0 additions & 10 deletions src/test/shell/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ filegroup(
visibility = ["//src/test/shell:__pkg__"],
)

genrule(
name = "langtools-copy",
testonly = 1,
srcs = ["//third_party/java/jdk/langtools:javac_jar"],
outs = ["langtools.jar"],
cmd = "cp $< $@",
)

gen_workspace_stanza(
name = "rules_proto_stanza",
out = "rules_proto_stanza.txt",
Expand Down Expand Up @@ -51,7 +43,6 @@ filegroup(
"cc_api_rules.bzl",
"remote_helpers.sh",
"testing_server.py",
":langtools-copy",
"//examples:srcs",
"//src/conditions:srcs",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/genclass:GenClass_deploy.jar",
Expand All @@ -64,7 +55,6 @@ filegroup(
"//src/tools/singlejar",
"//third_party:srcs",
"//third_party/ijar",
"//third_party/java/jdk/langtools:test-srcs",
"//tools:srcs",
"@bazel_skylib//:test_deps",
"@bazel_tools//tools/jdk:current_java_runtime",
Expand Down
30 changes: 0 additions & 30 deletions src/test/shell/bazel/bazel_java_test_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,33 +186,6 @@ EOF
expect_log 'javabuilder = \["//:VanillaJavaBuilder"\]'
}

# Specific toolchain attributes - jvm_opts containing location function - can be overridden.
function test_default_java_toolchain_manualConfigurationWithLocation() {
cat > BUILD <<EOF
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain", "JDK9_JVM_OPTS")
default_java_toolchain(
name = "toolchain",
jvm_opts = [
# In JDK9 we have seen a ~30% slow down in JavaBuilder performance when using
# G1 collector and having compact strings enabled.
"-XX:+UseParallelOldGC",
"-XX:-CompactStrings",
# override the javac in the JDK.
"-Xbootclasspath/p:\$(location @remote_java_tools//:javac_jar)",
] + JDK9_JVM_OPTS,
tools = [
"@remote_java_tools//:javac_jar",
],
)
EOF

bazel build //:toolchain || fail "default_java_toolchain target failed to build"
bazel cquery --output=build //:toolchain >& $TEST_log || fail "failed to query //:toolchain"

expect_log 'jvm_opts = \["-XX:+UseParallelOldGC", "-XX:-CompactStrings", "-Xbootclasspath/p:$(location @remote_java_tools//:javac_jar)",'
expect_log 'tools = \["@remote_java_tools//:javac_jar"\]'
}

# JVM8_TOOLCHAIN_CONFIGURATION shall override Java 8 internal compiler classes.
function test_default_java_toolchain_jvm8Toolchain() {
cat > BUILD <<EOF
Expand All @@ -227,7 +200,6 @@ EOF
bazel query 'deps(//:jvm8_toolchain)' >& $TEST_log || fail "failed to query //:jvm8_toolchain"

expect_log ":JavaBuilder"
expect_log ":javac_jar"
expect_not_log ":VanillaJavaBuilder"
}

Expand All @@ -246,7 +218,6 @@ EOF

expect_log ":JavaBuilder"
expect_not_log ":VanillaJavaBuilder"
expect_not_log ":javac_jar"
}

# VANILLA_TOOLCHAIN_CONFIGURATION shall use VanillaJavaBuilder and not override any JDK internal compiler classes.
Expand All @@ -265,7 +236,6 @@ EOF

expect_log ":VanillaJavaBuilder"
expect_not_log ":JavaBuilder"
expect_not_log ":javac_jar"
}

# PREBUILT_TOOLCHAIN_CONFIGURATION shall use prebuilt ijar and singlejar binaries.
Expand Down
4 changes: 0 additions & 4 deletions src/test/shell/bazel/bazel_java_tools_dist_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ function test_java_tools_has_junitrunner() {
expect_path_in_java_tools "src/java_tools/junitrunner/java/com/google/testing/junit/runner/util"
}

function test_java_tools_has_javac() {
expect_path_in_java_tools "javac-9+181-r4173-1.srcjar"
}

function test_java_tools_has_jacocoagent() {
expect_path_in_java_tools "third_party/java/jacoco/org.jacoco.agent-.*-sources.jar"
expect_path_in_java_tools "third_party/java/jacoco/org.jacoco.core-.*-sources.jar"
Expand Down
4 changes: 0 additions & 4 deletions src/test/shell/bazel/bazel_java_tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ function test_java_tools_has_Runner() {
expect_path_in_java_tools "java_tools/Runner_deploy.jar"
}

function test_java_tools_has_javac() {
expect_path_in_java_tools "java_tools/javac-9+181-r4173-1.jar"
}

function test_java_tools_has_Jacoco() {
expect_path_in_java_tools "java_tools/JacocoCoverage_jarjar_deploy.jar"
}
Expand Down
14 changes: 0 additions & 14 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ if [[ $PLATFORM =~ msys ]]; then
else
jdk_dir="${TEST_SRCDIR}/local_jdk"
fi
langtools="$(rlocation io_bazel/src/test/shell/bazel/langtools.jar)"

# Tools directory location
tools_dir="$(dirname $(rlocation io_bazel/tools/BUILD))"
langtools_dir="$(dirname $(rlocation io_bazel/third_party/java/jdk/langtools/BUILD))"

# Platforms
default_host_platform="@local_config_platform//:host"
Expand Down Expand Up @@ -135,14 +133,6 @@ function copy_tools_directory() {
if [ -f tools/build_defs/repo/BUILD.repo ]; then
cp tools/build_defs/repo/BUILD.repo tools/build_defs/repo/BUILD
fi
# To support custom langtools
cp ${langtools} tools/jdk/langtools.jar
cat >>tools/jdk/BUILD <<'EOF'
filegroup(name = "test-langtools", srcs = ["langtools.jar"])
EOF

mkdir -p third_party/java/jdk/langtools
cp -R ${langtools_dir}/* third_party/java/jdk/langtools

chmod -R +w .
}
Expand Down Expand Up @@ -606,13 +596,9 @@ function create_new_workspace() {
workspaces+=(${new_workspace_dir})
cd ${new_workspace_dir}
mkdir tools
mkdir -p third_party/java/jdk/langtools

copy_tools_directory

[ -e third_party/java/jdk/langtools/javac-9+181-r4173-1.jar ] \
|| ln -s "${langtools_path}" third_party/java/jdk/langtools/javac-9+181-r4173-1.jar

write_workspace_file "WORKSPACE" "$WORKSPACE_NAME"

maybe_setup_python_windows_tools
Expand Down
7 changes: 3 additions & 4 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ filegroup(
"//third_party/java/jacoco:srcs",
"//third_party/java/javapoet:srcs",
"//third_party/java/jcommander:srcs",
"//third_party/java/jdk/langtools:srcs",
"//third_party/java/proguard:srcs",
"//third_party/javascript/bootstrap:srcs",
"//third_party/jaxb:srcs",
Expand Down Expand Up @@ -500,7 +499,7 @@ distrib_jar_filegroup(
distrib_jar_filegroup(
name = "guava-failureaccess-jar",
srcs = [
"guava/failureaccess-1.0.1.jar",
"guava/failureaccess-1.0.1.jar",
],
enable_distributions = ["debian"],
)
Expand Down Expand Up @@ -633,8 +632,8 @@ distrib_java_import(
name = "netty_tcnative",
enable_distributions = ["debian"],
jars = [
"netty_tcnative/netty-tcnative-classes-2.0.51.Final.jar",
":netty_tcnative/netty-tcnative-filtered.jar",
"netty_tcnative/netty-tcnative-classes-2.0.51.Final.jar",
":netty_tcnative/netty-tcnative-filtered.jar",
],
)

Expand Down
2 changes: 0 additions & 2 deletions third_party/ijar/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ sh_test(
"$(JAVABASE)/bin/jar",
"$(JAVABASE)/bin/javap",
"$(location //third_party/ijar)",
"$(location //third_party/java/jdk/langtools:javac_jar)",
# We assume unzip and zip to be on the path
"unzip",
"zip",
Expand Down Expand Up @@ -48,7 +47,6 @@ sh_test(
# wrong.
"libwrongcentraldir.jar",
"@bazel_tools//tools/jdk:current_java_runtime",
"//third_party/java/jdk/langtools:javac_jar",
],
shard_count = 5,
tags = ["zip"],
Expand Down
2 changes: 0 additions & 2 deletions third_party/ijar/test/ijar_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ JAVAP=$1
shift
IJAR=$1
shift
LANGTOOLS8=$1
shift
UNZIP=$1
shift
ZIP=$1
Expand Down
10 changes: 0 additions & 10 deletions third_party/java/jdk/README.md

This file was deleted.

54 changes: 0 additions & 54 deletions third_party/java/jdk/langtools/BUILD

This file was deleted.

Loading

0 comments on commit eddf708

Please sign in to comment.