aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2017-08-28 22:43:32 +0200
committerGravatar Vladimir Moskva <vladmos@google.com>2017-08-29 13:32:14 +0200
commit03755ea2a9830d94fdb23baa3b37bb11c2faa392 (patch)
tree0884dfe0d360aed55e8febc2b02d1271a71894d7 /src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java
parent8c76d5f82d290b46d67189bcc8bd08a441094da1 (diff)
Automated rollback of commit 363413110f3a63a11d900864be1852adbaed2899.
*** Reason for rollback *** Breaks //src/test/shell/bazel:bazel_bootstrap_distfile_test: INFO: You can skip this first step by providing a path to the bazel binary as second argument: INFO: ./compile.sh compile /path/to/bazel 🍃 Building Bazel from scratch...... 🍃 Building Bazel with Bazel. .WARNING: /tmp/bazel_cHivhPBc/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_cHivhPBc/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions. ERROR: in target '//external:cc_toolchain': error loading package '@local_config_cc//': Extension file not found. Unable to load file '@local_config_cc//:dummy_toolchain.bzl': file doesn't exist or isn't a file. INFO: Elapsed time: 3.343s ERROR: Could not build Bazel Found by git bisect. *** Original change description *** Add a new toolchain type for c++. In order to do this, PlatformConfiguration is made a legal configuration fragment for every rule class. Add a default "dummy" c++ toolchain to prevent resolution errors when legacy toolchain selection logic is used. Add toolchain mocks to java and shell tests. PiperOrigin-RevId: 166750885
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java
index 45c967e551..d93c5a6dea 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java
@@ -26,7 +26,6 @@ import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.RuleClass;
import java.util.List;
-import javax.annotation.Nullable;
/** Helper class to manage rules' use of platforms. */
public class PlatformSemantics {
@@ -41,22 +40,19 @@ public class PlatformSemantics {
@Override
public List<Label> resolve(
Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
- // rule may be null for tests
- if (rule == null || rule.getRuleClassObject().getRequiredToolchains().isEmpty()) {
- return ImmutableList.of();
+ if (rule.getRuleClassObject().getRequiredToolchains().isEmpty()) {
+ return null;
}
return configuration.getFragment(PlatformConfiguration.class).getTargetPlatforms();
}
};
/** Implementation for the :execution_platform attribute. */
- @Nullable
public static final Attribute.LateBoundLabel<BuildConfiguration> EXECUTION_PLATFORM =
new Attribute.LateBoundLabel<BuildConfiguration>(PlatformConfiguration.class) {
@Override
public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
- // rule may be null for tests
- if (rule == null || rule.getRuleClassObject().getRequiredToolchains().isEmpty()) {
+ if (rule.getRuleClassObject().getRequiredToolchains().isEmpty()) {
return null;
}
return configuration.getFragment(PlatformConfiguration.class).getExecutionPlatform();