Skip to content

Commit 72058be

Browse files
hvadehracopybara-github
authored andcommitted
Drop deprecated fields from JavaInfo
- `transitive_deps` is an alias for `transitive_compile_time_jars` - `transitive_runtime_deps` is an alias for `transitive_runtime_jars` RELNOTES[INC]: Drop deprecated 'transitive_deps', 'transitive_runtime_deps' from JavaInfo PiperOrigin-RevId: 555098491 Change-Id: I9edf7d4c82b69a8016d2bcde0fdb57f7d82cacf5
1 parent 4e525df commit 72058be

File tree

5 files changed

+14
-47
lines changed

5 files changed

+14
-47
lines changed

src/main/java/com/google/devtools/build/lib/rules/java/JavaInfo.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,19 @@ public boolean isNeverlink() {
362362

363363
@Override
364364
public Depset /*<Artifact>*/ getTransitiveRuntimeJars() {
365-
return getTransitiveRuntimeDeps();
365+
return Depset.of(
366+
Artifact.class,
367+
getProviderAsNestedSet(
368+
JavaCompilationArgsProvider.class, JavaCompilationArgsProvider::getRuntimeJars));
366369
}
367370

368371
@Override
369372
public Depset /*<Artifact>*/ getTransitiveCompileTimeJars() {
370-
return getTransitiveDeps();
373+
return Depset.of(
374+
Artifact.class,
375+
getProviderAsNestedSet(
376+
JavaCompilationArgsProvider.class,
377+
JavaCompilationArgsProvider::getTransitiveCompileTimeJars));
371378
}
372379

373380
@Override
@@ -430,22 +437,9 @@ public ImmutableList<Artifact> getDirectRuntimeJars() {
430437
return directRuntimeJars;
431438
}
432439

433-
@Override
434-
public Depset /*<Artifact>*/ getTransitiveDeps() {
435-
return Depset.of(
436-
Artifact.class,
437-
getProviderAsNestedSet(
438-
JavaCompilationArgsProvider.class,
439-
JavaCompilationArgsProvider::getTransitiveCompileTimeJars));
440-
}
440+
/*<Artifact>*/
441441

442-
@Override
443-
public Depset /*<Artifact>*/ getTransitiveRuntimeDeps() {
444-
return Depset.of(
445-
Artifact.class,
446-
getProviderAsNestedSet(
447-
JavaCompilationArgsProvider.class, JavaCompilationArgsProvider::getRuntimeJars));
448-
}
442+
/*<Artifact>*/
449443

450444
@Override
451445
public Depset /*<Artifact>*/ getTransitiveSourceJars() {

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/java/JavaInfoApi.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,6 @@ public interface JavaInfoApi<
122122
structField = true)
123123
Sequence<FileT> getRuntimeOutputJars();
124124

125-
@StarlarkMethod(
126-
name = "transitive_deps",
127-
doc =
128-
"Deprecated: Please use <code><a class=\"anchor\" "
129-
+ "href=\"#transitive_compile_time_jars\">JavaInfo.transitive_compile_time_jars</a></code>"
130-
+ " instead. It returns the same value.",
131-
structField = true)
132-
Depset /*<FileT>*/ getTransitiveDeps();
133-
134-
@StarlarkMethod(
135-
name = "transitive_runtime_deps",
136-
doc =
137-
"Deprecated: please use <code><a class=\"anchor\""
138-
+ " href=\"#transitive_runtime_jars\">JavaInfo.transitive_runtime_jars"
139-
+ "</a></code> instead. It returns the same value",
140-
structField = true)
141-
Depset /*<FileT>*/ getTransitiveRuntimeDeps();
142-
143125
@StarlarkMethod(
144126
name = "transitive_source_jars",
145127
doc =

src/main/starlark/builtins_bzl/common/java/java_info.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ def merge(
152152
java_outputs = depset(java_outputs).to_list()
153153
result = {
154154
"transitive_runtime_jars": transitive_runtime_jars,
155-
"transitive_runtime_deps": transitive_runtime_jars, # deprecated
156155
"transitive_compile_time_jars": transitive_compile_time_jars,
157-
"transitive_deps": transitive_compile_time_jars, # deprecated
158156
"compile_jars": depset(order = "preorder", transitive = compile_jars),
159157
"full_compile_jars": depset(order = "preorder", transitive = full_compile_jars),
160158
"_transitive_full_compile_time_jars": depset(order = "preorder", transitive = _transitive_full_compile_time_jars),
@@ -204,9 +202,7 @@ def to_java_binary_info(java_info):
204202
"""
205203
result = {
206204
"transitive_runtime_jars": depset(),
207-
"transitive_runtime_deps": depset(), # deprecated
208205
"transitive_compile_time_jars": depset(),
209-
"transitive_deps": depset(), # deprecated
210206
"compile_jars": depset(),
211207
"full_compile_jars": depset(),
212208
"_transitive_full_compile_time_jars": depset(),
@@ -449,7 +445,6 @@ def java_info_for_compilation(
449445
result.update(
450446
runtime_output_jars = direct_runtime_jars,
451447
transitive_runtime_jars = transitive_runtime_jars,
452-
transitive_runtime_deps = transitive_runtime_jars,
453448
transitive_source_jars = depset(
454449
direct = [source_jar],
455450
# only differs from the usual java_info.transitive_source_jars in the order of deps
@@ -566,7 +561,6 @@ def _javainfo_init_base(
566561
)]
567562
result = {
568563
"transitive_compile_time_jars": transitive_compile_time_jars,
569-
"transitive_deps": transitive_compile_time_jars, # deprecated
570564
"compile_jars": depset(
571565
order = "preorder",
572566
direct = [compile_jar] if compile_jar else [],
@@ -724,7 +718,6 @@ def _javainfo_init(
724718
)
725719
result.update(
726720
transitive_runtime_jars = transitive_runtime_jars,
727-
transitive_runtime_deps = transitive_runtime_jars, # deprecated
728721
transitive_source_jars = depset(
729722
direct = [source_jar] if source_jar else [],
730723
# TODO(hvd): native also adds source jars from deps, but this should be unnecessary
@@ -770,8 +763,6 @@ JavaInfo, _new_javainfo = provider(
770763
"outputs": "Deprecated: use java_outputs.",
771764
"annotation_processing": "Deprecated: Please use plugins instead.",
772765
"runtime_output_jars": "([File]) A list of runtime Jars created by this Java/Java-like target.",
773-
"transitive_deps": "Deprecated: Please use transitive_compile_time_jars instead.",
774-
"transitive_runtime_deps": "Deprecated: please use transitive_runtime_jars instead.",
775766
"transitive_source_jars": "(depset[File]) The Jars of all source files in the transitive closure.",
776767
"transitive_native_libraries": """(depset[LibraryToLink]) The transitive set of CC native
777768
libraries required by the target.""",

src/test/java/com/google/devtools/build/lib/rules/java/JavaStarlarkApiTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ public void testJavaInfoGetTransitiveDeps() throws Exception {
18431843
"foo/extension.bzl",
18441844
"result = provider()",
18451845
"def _impl(ctx):",
1846-
" return [result(property = ctx.attr.dep[JavaInfo].transitive_deps)]",
1846+
" return [result(property = ctx.attr.dep[JavaInfo].transitive_compile_time_jars)]",
18471847
"my_rule = rule(_impl, attrs = { 'dep' : attr.label() })");
18481848

18491849
scratch.file(
@@ -1875,7 +1875,7 @@ public void testJavaInfoGetTransitiveRuntimeDeps() throws Exception {
18751875
"foo/extension.bzl",
18761876
"result = provider()",
18771877
"def _impl(ctx):",
1878-
" return [result(property = ctx.attr.dep[JavaInfo].transitive_runtime_deps)]",
1878+
" return [result(property = ctx.attr.dep[JavaInfo].transitive_runtime_jars)]",
18791879
"my_rule = rule(_impl, attrs = { 'dep' : attr.label() })");
18801880

18811881
scratch.file(

src/test/java/com/google/devtools/build/lib/rules/java/proto/StarlarkJavaLiteProtoLibraryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public void testJavaProtosExposeStarlarkProviders() throws Exception {
318318
/* doAnalysis= */ true,
319319
new EventBus());
320320
// Implicitly check that `update()` above didn't throw an exception. This implicitly checks that
321-
// ctx.attr.dep.java.{transitive_deps, outputs}, above, is defined.
321+
// ctx.attr.dep.java.{transitive_compile_time_jars, outputs}, above, is defined.
322322
}
323323

324324
@Test

0 commit comments

Comments
 (0)