Skip to content

Commit

Permalink
Automated rollback of commit 2a28909.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

We're no longer going with this approach.

*** Original change description ***

Add RunfilesLibraryInfo

The new provider marks runfiles libraries as such and will be used by
both Bazel itself and language rules to emit additional information
required for executable targets to find their runfiles in the presence
of repository mappings.

Work towards bazelbuild#16124

Closes bazelbuild#16125.

PiperOrigin-RevId: 483622668
Change-Id: I599d588cbed27c08466cc1311779925bd39a77fc
  • Loading branch information
Wyverald authored and copybara-github committed Oct 25, 2022
1 parent 1eff0f9 commit 4e66d93
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 148 deletions.
11 changes: 0 additions & 11 deletions src/main/java/com/google/devtools/build/lib/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ java_library(
":rule_configured_object_value",
":rule_definition_environment",
":run_environment_info",
":runfiles_library_info",
":starlark/args",
":starlark/bazel_build_api_globals",
":starlark/function_transition_util",
Expand Down Expand Up @@ -1033,16 +1032,6 @@ java_library(
],
)

java_library(
name = "runfiles_library_info",
srcs = ["RunfilesLibraryInfo.java"],
deps = [
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/starlarkbuildapi",
],
)

java_library(
name = "rule_definition_environment",
srcs = ["RuleDefinitionEnvironment.java"],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.devtools.build.lib.analysis.DefaultInfo;
import com.google.devtools.build.lib.analysis.OutputGroupInfo;
import com.google.devtools.build.lib.analysis.RunEnvironmentInfo;
import com.google.devtools.build.lib.analysis.RunfilesLibraryInfo;
import com.google.devtools.build.lib.packages.StarlarkLibrary;
import com.google.devtools.build.lib.packages.StarlarkLibrary.SelectLibrary;
import com.google.devtools.build.lib.packages.StructProvider;
Expand Down Expand Up @@ -49,6 +48,5 @@ public static void addPredeclared(ImmutableMap.Builder<String, Object> predeclar
predeclared.put("Actions", ActionsProvider.INSTANCE);
predeclared.put("DefaultInfo", DefaultInfo.PROVIDER);
predeclared.put("RunEnvironmentInfo", RunEnvironmentInfo.PROVIDER);
predeclared.put("RunfilesLibraryInfo", RunfilesLibraryInfo.PROVIDER);
}
}

This file was deleted.

1 change: 0 additions & 1 deletion src/test/java/com/google/devtools/build/lib/starlark/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ java_test(
"//src/main/java/com/google/devtools/build/lib/analysis:file_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:resolved_toolchain_context",
"//src/main/java/com/google/devtools/build/lib/analysis:run_environment_info",
"//src/main/java/com/google/devtools/build/lib/analysis:runfiles_library_info",
"//src/main/java/com/google/devtools/build/lib/analysis:starlark/args",
"//src/main/java/com/google/devtools/build/lib/analysis:starlark/starlark_exec_group_collection",
"//src/main/java/com/google/devtools/build/lib/analysis:test/analysis_test_result_info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
import com.google.devtools.build.lib.analysis.OutputGroupInfo;
import com.google.devtools.build.lib.analysis.RunEnvironmentInfo;
import com.google.devtools.build.lib.analysis.RunfilesLibraryInfo;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.config.StarlarkDefinedConfigTransition;
import com.google.devtools.build.lib.analysis.configuredtargets.FileConfiguredTarget;
Expand Down Expand Up @@ -3653,34 +3652,4 @@ public void nonExecutableStarlarkRuleReturningTestEnvironmentProducesAWarning()
+ " non-test target has no effect",
ImmutableSet.of(EventKind.WARNING));
}

@Test
public void runfilesLibraryInfoCanBeReturnedAndQueried() throws Exception {
scratch.file(
"examples/rules.bzl",
"def my_runfiles_library_impl(ctx):",
" return [RunfilesLibraryInfo()]",
"my_runfiles_library = rule(implementation = my_runfiles_library_impl)",
"def language_rule_impl(ctx):",
" if RunfilesLibraryInfo not in ctx.attr.dep:",
" fail('dep does not advertise RunfilesLibraryInfo')",
"language_rule = rule(",
" implementation = language_rule_impl,",
" attrs = {'dep': attr.label()},",
")");
scratch.file(
"examples/BUILD",
"load(':rules.bzl', 'language_rule', 'my_runfiles_library')",
"my_runfiles_library(name = 'runfiles_library')",
"language_rule(",
" name = 'target',",
" dep = ':runfiles_library',",
")");

ConfiguredTarget runfilesLibrary = getConfiguredTarget("//examples:runfiles_library");
assertThat(runfilesLibrary.get(RunfilesLibraryInfo.PROVIDER)).isNotNull();

// Succeeds only if targets can be queried for the presence of RunfilesLibraryInfo in Starlark.
getConfiguredTarget("//examples:target");
}
}

0 comments on commit 4e66d93

Please sign in to comment.