Skip to content

Commit c587350

Browse files
comiuscopybara-github
authored andcommitted
Rename CcInfo#transitive_native_libraries to _legacy_transitive_native_libraries
This is needed to convert CcInfo to Starlark without causing a major regression. Mark the field as legacy, because we'll need to eventually clean it up. Upgrade rules_java, that support both old and new field location. PiperOrigin-RevId: 792196604 Change-Id: I1b26336b6f234bd3cb123c213e68daee19c2e50f
1 parent e83f5e9 commit c587350

File tree

8 files changed

+14
-15
lines changed

8 files changed

+14
-15
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bazel_dep(name = "grpc", version = "1.73.1", repo_name = "com_github_grpc_grpc")
2626
bazel_dep(name = "platforms", version = "1.0.0")
2727
bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")
2828
bazel_dep(name = "rules_graalvm", version = "0.11.1")
29-
bazel_dep(name = "rules_java", version = "8.14.0")
29+
bazel_dep(name = "rules_java", version = "8.15.0")
3030
bazel_dep(name = "rules_jvm_external", version = "6.5")
3131
bazel_dep(name = "rules_license", version = "1.0.0")
3232
bazel_dep(name = "rules_pkg", version = "1.0.1")

MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MODULE.tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use_repo(buildozer_binary, "buildozer_binary")
3838
# Dependencies used to auto-load removed symbols and rules from Bazel (due to Starlarkification)
3939
# See also: --incompatible_autoload_externally, AutoloadSymbols
4040
bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")
41-
bazel_dep(name = "rules_java", version = "8.14.0")
41+
bazel_dep(name = "rules_java", version = "8.15.0")
4242
bazel_dep(name = "rules_cc", version = "0.1.2")
4343
bazel_dep(name = "rules_python", version = "1.3.0")
4444
bazel_dep(name = "rules_shell", version = "0.3.0")

src/main/java/com/google/devtools/build/lib/rules/cpp/CcInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public StarlarkInfo getCcDebugInfoContextFromStarlark(StarlarkThread thread)
8585
}
8686

8787
@Override
88-
public Depset getCcTransitiveNativeLibraries(StarlarkThread thread) throws EvalException {
89-
CcModule.checkPrivateStarlarkificationAllowlist(thread);
88+
public Depset getCcTransitiveNativeLibraries() {
9089
return Depset.of(
9190
StarlarkInfo.class,
9291
CcNativeLibraryInfo.getTransitiveCcNativeLibraries(getCcNativeLibraryInfo()));

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcInfoApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public interface CcInfoApi<FileT extends FileApi> extends StructApi {
6262
throws EvalException;
6363

6464
@StarlarkMethod(
65-
name = "transitive_native_libraries",
65+
name = "_legacy_transitive_native_libraries",
6666
documented = false,
67-
doc = "Returns a depset of the transitive native libraries",
68-
useStarlarkThread = true)
69-
Depset getCcTransitiveNativeLibraries(StarlarkThread thread) throws EvalException;
67+
structField = true,
68+
doc = "Returns a depset of the transitive native libraries")
69+
Depset getCcTransitiveNativeLibraries() throws EvalException;
7070

7171
/** The provider implementing this can construct CcInfo objects. */
7272
@StarlarkBuiltin(

src/main/starlark/builtins_bzl/common/cc/cc_common.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,13 @@ def _merge_cc_infos(*, direct_cc_infos = [], cc_infos = []):
345345
direct_cc_compilation_contexts.append(cc_info.compilation_context)
346346
cc_linking_contexts.append(cc_info.linking_context)
347347
cc_debug_info_contexts.append(cc_info.debug_context())
348-
transitive_native_cc_libraries.append(cc_info.transitive_native_libraries())
348+
transitive_native_cc_libraries.append(cc_info._legacy_transitive_native_libraries)
349349

350350
for cc_info in cc_infos:
351351
cc_compilation_contexts.append(cc_info.compilation_context)
352352
cc_linking_contexts.append(cc_info.linking_context)
353353
cc_debug_info_contexts.append(cc_info.debug_context())
354-
transitive_native_cc_libraries.append(cc_info.transitive_native_libraries())
354+
transitive_native_cc_libraries.append(cc_info._legacy_transitive_native_libraries)
355355

356356
return CcInfo(
357357
compilation_context = cc_common_internal.merge_compilation_contexts(compilation_contexts = direct_cc_compilation_contexts, non_exported_compilation_contexts = cc_compilation_contexts),

src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _get_dynamic_library_for_runtime_or_none(library, linking_statically):
297297
return library.dynamic_library
298298

299299
def _collect_native_cc_libraries(deps, libraries):
300-
transitive_libraries = [dep[CcInfo].transitive_native_libraries() for dep in deps if CcInfo in dep]
300+
transitive_libraries = [dep[CcInfo]._legacy_transitive_native_libraries for dep in deps if CcInfo in dep]
301301
return CcNativeLibraryInfo(libraries_to_link = depset(direct = libraries, transitive = transitive_libraries))
302302

303303
def _build_linking_context_from_libraries(ctx, libraries):

src/test/tools/bzlmod/MODULE.bazel.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)