aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java10
3 files changed, 23 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 4340be6eb2..05327fdb6c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -154,6 +154,14 @@ public final class BuildConfiguration {
}
/**
+ * Returns the roots used for the "all labels in the configuration must be reachable from the
+ * labels provided on the command line" sanity check.
+ */
+ public Iterable<Label> getSanityCheckRoots() {
+ return ImmutableList.of();
+ }
+
+ /**
* Returns a multimap of all labels that should be implicitly loaded from labels that were
* specified as options, keyed by the name to be displayed to the user if something goes wrong.
* The returned set only contains labels that were derived from command-line options; the
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index e9a89c782c..87e3e97ca0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -2002,6 +2002,17 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
}
@Override
+ public Iterable<Label> getSanityCheckRoots() {
+ ImmutableList.Builder<Label> result = ImmutableList.builder();
+ result.add(cppOptions.crosstoolTop);
+ if (cppOptions.libcTop != null) {
+ result.add(cppOptions.libcTop.getLabel());
+ }
+
+ return result.build();
+ }
+
+ @Override
public String getOutputDirectoryName() {
String lipoSuffix;
if (getLipoMode() != LipoMode.OFF && !isAutoFdoLipo()) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
index 62bee585b6..075811797b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfigurationFragmentFunction.java
@@ -79,7 +79,7 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
if (env.valuesMissing()) {
return null;
}
- sanityCheck(fragment, buildOptions, packageProvider);
+ sanityCheck(fragment, packageProvider);
if (env.valuesMissing()) {
return null;
}
@@ -101,7 +101,6 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
*/
private static void sanityCheck(
Fragment fragment,
- BuildOptions buildOptions,
PackageProviderForConfigurations packageProvider)
throws InvalidConfigurationException, InterruptedException {
if (fragment == null) {
@@ -114,14 +113,13 @@ public final class ConfigurationFragmentFunction implements SkyFunction {
// Sanity check that the implicit labels are all in the transitive closure of explicit ones.
// This also registers all targets in the cache entry and validates them on subsequent requests.
Set<Label> reachableLabels = new HashSet<>();
- for (Map.Entry<String, Label> entry : buildOptions.getAllLabels().entries()) {
- Label label = entry.getValue();
+ for (Label root : fragment.getSanityCheckRoots()) {
try {
- collectAllTransitiveLabels(packageProvider, reachableLabels, label);
+ collectAllTransitiveLabels(packageProvider, reachableLabels, root);
} catch (NoSuchThingException e) {
packageProvider.getEventHandler().handle(Event.error(e.getMessage()));
throw new InvalidConfigurationException(
- String.format("Failed to load required %s target: '%s'", entry.getKey(), label));
+ String.format("Failed to load transitive closure of '%s': %s", root, e.getMessage()));
}
}
if (packageProvider.valuesMissing()) {