Skip to content

Commit ddde9b3

Browse files
authored
Revert "Create jdeps output from classpath entries (#1376)" (#1388)
Intellij needs full jars to be able to attach sources, and providing ijars with jdeps is degrading experience when someone already uses full jars
1 parent 470cd83 commit ddde9b3

File tree

13 files changed

+7
-144
lines changed

13 files changed

+7
-144
lines changed

scala/private/common_outputs.bzl

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ common_outputs = {
66
"manifest": "%{name}_MANIFEST.MF",
77
"statsfile": "%{name}.statsfile",
88
"diagnosticsfile": "%{name}.diagnosticsproto",
9-
"jdeps": "%{name}.jdep",
109
}

scala/private/phases/phase_compile.bzl

+1-5
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def _compile_or_empty(
193193
manifest,
194194
ctx.outputs.statsfile,
195195
ctx.outputs.diagnosticsfile,
196-
ctx.outputs.jdeps,
197196
sources,
198197
jars,
199198
all_srcjars,
@@ -270,7 +269,6 @@ rm -f {jar_output}
270269
# ensures that empty src targets still emit a statsfile and a diagnosticsfile
271270
touch {statsfile}
272271
touch {diagnosticsfile}
273-
touch {jdepsfile}
274272
""" + ijar_cmd
275273

276274
cmd = cmd.format(
@@ -279,10 +277,9 @@ touch {jdepsfile}
279277
zipper = ctx.executable._zipper.path,
280278
statsfile = ctx.outputs.statsfile.path,
281279
diagnosticsfile = ctx.outputs.diagnosticsfile.path,
282-
jdepsfile = ctx.outputs.jdeps.path,
283280
)
284281

285-
outs = [ctx.outputs.jar, ctx.outputs.statsfile, ctx.outputs.diagnosticsfile, ctx.outputs.jdeps]
282+
outs = [ctx.outputs.jar, ctx.outputs.statsfile, ctx.outputs.diagnosticsfile]
286283
inputs = ctx.files.resources + [ctx.outputs.manifest]
287284

288285
ctx.actions.run_shell(
@@ -306,7 +303,6 @@ def _create_scala_compilation_provider(ctx, ijar, source_jar, deps_providers):
306303
compile_jar = ijar,
307304
source_jar = source_jar,
308305
deps = deps_providers,
309-
jdeps = ctx.outputs.jdeps,
310306
exports = exports,
311307
runtime_deps = runtime_deps,
312308
neverlink = ctx.attr.neverlink,

scala/private/rule_impls.bzl

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def compile_scala(
3939
manifest,
4040
statsfile,
4141
diagnosticsfile,
42-
jdepsPath,
4342
sources,
4443
cjars,
4544
all_srcjars,
@@ -80,7 +79,6 @@ def compile_scala(
8079
args.add("--Manifest", manifest)
8180
args.add("--PrintCompileTime", print_compile_time)
8281
args.add("--ExpectJavaOutput", expect_java_output)
83-
args.add("--JDepsFilePath", jdepsPath)
8482
args.add("--StrictDepsMode", dependency_info.strict_deps_mode)
8583
args.add("--UnusedDependencyCheckerMode", dependency_info.unused_deps_mode)
8684
args.add("--DependencyTrackingMethod", dependency_info.dependency_tracking_method)
@@ -111,7 +109,7 @@ def compile_scala(
111109
if dependency_info.unused_deps_mode != "off":
112110
args.add_all("--UnusedDepsIgnoredTargets", unused_dependency_checker_ignored_targets)
113111

114-
outs = [output, statsfile, diagnosticsfile, jdepsPath]
112+
outs = [output, statsfile, diagnosticsfile]
115113

116114
ins = depset(
117115
direct = [manifest] + sources + classpath_resources + resources + resource_jars,

scala_proto/private/scala_proto_aspect.bzl

-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def _compile_sources(ctx, toolchain, proto, src_jars, deps, stamp_label):
8989
write_manifest_file(ctx.actions, manifest, None)
9090
statsfile = ctx.actions.declare_file(ctx.label.name + "_scalac.statsfile")
9191
diagnosticsfile = ctx.actions.declare_file(ctx.label.name + "_scalac.diagnosticsproto")
92-
jdepsfile = ctx.actions.declare_file(ctx.label.name + ".jdeps")
9392
compile_deps = deps + _compile_deps(ctx, toolchain)
9493
merged_deps = java_common.merge(compile_deps)
9594

@@ -104,7 +103,6 @@ def _compile_sources(ctx, toolchain, proto, src_jars, deps, stamp_label):
104103
manifest,
105104
statsfile,
106105
diagnosticsfile,
107-
jdepsfile,
108106
sources = [],
109107
cjars = merged_deps.compile_jars,
110108
all_srcjars = depset(src_jars),
@@ -129,7 +127,6 @@ def _compile_sources(ctx, toolchain, proto, src_jars, deps, stamp_label):
129127
output_jar = output,
130128
compile_jar = output,
131129
deps = compile_deps,
132-
jdeps = jdepsfile,
133130
exports = compile_deps,
134131
runtime_deps = compile_deps,
135132
)

src/java/io/bazel/rulesscala/jdeps/BUILD

-11
This file was deleted.

src/java/io/bazel/rulesscala/jdeps/JdepsWriter.java

-33
This file was deleted.

src/java/io/bazel/rulesscala/scalac/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ java_binary(
1515
deps = [
1616
"//scala/private/toolchain_deps:scala_compile_classpath",
1717
"//src/java/io/bazel/rulesscala/io_utils",
18-
"//src/java/io/bazel/rulesscala/jdeps",
1918
"//third_party/bazel/src/main/protobuf:worker_protocol_java_proto",
2019
"@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar",
2120
"@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker",

src/java/io/bazel/rulesscala/scalac/CompileOptions.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public class CompileOptions {
2424
public final String[] unusedDepsIgnoredTargets;
2525
public final String[] indirectJars;
2626
public final String[] indirectTargets;
27-
public final String jdepsFilePath;
2827
public final String strictDepsMode;
2928
public final String unusedDependencyCheckerMode;
3029
public final String currentTarget;
@@ -61,7 +60,6 @@ public CompileOptions(String[] lines) {
6160
indirectJars = args.getOrEmpty("IndirectJars");
6261
indirectTargets = args.getOrEmpty("IndirectTargets");
6362

64-
jdepsFilePath = args.getSingleOrError("JDepsFilePath");
6563
strictDepsMode = args.getSingleOrError("StrictDepsMode");
6664
unusedDependencyCheckerMode = args.getSingleOrError("UnusedDependencyCheckerMode");
6765
currentTarget = args.getSingleOrError("CurrentTarget");
@@ -77,7 +75,7 @@ public CompileOptions(String[] lines) {
7775

7876
static final class Args {
7977

80-
private static final String[] EMPTY = new String[]{};
78+
private static final String[] EMPTY = new String[] {};
8179
private final Map<String, String[]> index = new LinkedHashMap<>();
8280

8381
Args(String[] lines) {

src/java/io/bazel/rulesscala/scalac/ScalacWorker.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@
44

55
import io.bazel.rulesscala.io_utils.StreamCopy;
66
import io.bazel.rulesscala.jar.JarCreator;
7-
import io.bazel.rulesscala.jdeps.JdepsWriter;
87
import io.bazel.rulesscala.worker.Worker;
9-
import java.io.File;
10-
import java.io.FileOutputStream;
11-
import java.io.IOException;
12-
import java.io.InputStream;
13-
import java.io.OutputStream;
14-
import java.nio.file.FileVisitResult;
15-
import java.nio.file.Files;
16-
import java.nio.file.Path;
17-
import java.nio.file.Paths;
18-
import java.nio.file.SimpleFileVisitor;
8+
import java.io.*;
9+
import java.nio.file.*;
1910
import java.nio.file.attribute.BasicFileAttributes;
2011
import java.util.ArrayList;
2112
import java.util.Arrays;
@@ -70,8 +61,6 @@ public void work(String[] args) throws Exception {
7061
compileScalaSources(ops, scalaSources, classes);
7162
}
7263

73-
JdepsWriter.write(ops.jdepsFilePath, ops.currentTarget, ops.classpath);
74-
7564
/** Copy the resources */
7665
copyResources(ops.resourceSources, ops.resourceTargets, classes);
7766

@@ -106,7 +95,7 @@ private static String[] collectSrcJarSources(
10695
}
10796

10897
private static List<File> filterFilesByExtension(List<File> files, String extension) {
109-
List<File> filtered = new ArrayList<>();
98+
List<File> filtered = new ArrayList<File>();
11099
for (File f : files) {
111100
if (f.toString().endsWith(extension)) {
112101
filtered.add(f);
@@ -249,7 +238,7 @@ private static String[] getPluginParamsFrom(CompileOptions ops) {
249238
}
250239

251240
private static void compileScalaSources(CompileOptions ops, String[] scalaSources, Path classes)
252-
throws IOException {
241+
throws IllegalAccessException, IOException {
253242

254243
String[] pluginArgs = buildPluginArgs(ops.plugins);
255244
String[] pluginParams = getPluginParamsFrom(ops);

src/java/io/bazel/rulesscala/scalac/ScalacWorker3.java

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package io.bazel.rulesscala.scalac;
22

33
import static java.io.File.pathSeparator;
4-
5-
import io.bazel.rulesscala.jdeps.JdepsWriter;
64
import scala.Tuple2;
75
import io.bazel.rulesscala.io_utils.StreamCopy;
86
import io.bazel.rulesscala.jar.JarCreator;
@@ -78,8 +76,6 @@ public void work(String[] args) throws Exception {
7876
compileScalaSources(ops, scalaSources, tmpPath);
7977
}
8078

81-
JdepsWriter.write(ops.jdepsFilePath, ops.currentTarget, ops.classpath);
82-
8379
/** Copy the resources */
8480
copyResources(ops.resourceSources, ops.resourceTargets, tmpPath);
8581

test/src/main/java/rulesscala/test/jdeps/BUILD

-13
This file was deleted.

test/src/main/java/rulesscala/test/jdeps/JdepsWriterTest.java

-45
This file was deleted.

twitter_scrooge/twitter_scrooge.bzl

-7
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,6 @@ def _compile_generated_scala(
248248
label.name + "_scalac.diagnosticsproto",
249249
sibling = scrooge_jar,
250250
)
251-
252-
jdepsFile = ctx.actions.declare_file(
253-
label.name + ".jdeps",
254-
sibling = scrooge_jar,
255-
)
256-
257251
all_deps = _concat_lists(deps_java_info, implicit_deps)
258252
merged_deps = java_common.merge(all_deps)
259253

@@ -268,7 +262,6 @@ def _compile_generated_scala(
268262
manifest,
269263
statsfile,
270264
diagnosticsfile,
271-
jdepsFile,
272265
sources = [],
273266
cjars = merged_deps.transitive_compile_time_jars,
274267
all_srcjars = depset([scrooge_jar]),

0 commit comments

Comments
 (0)