aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2017-03-20 10:58:09 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-20 11:47:18 +0000
commit2cea8bc6e17b4df623ed73155c6be7a97cfbe957 (patch)
tree494ad5216c01e551eafdbc674bf07faad985ff77 /src/main/java/com/google/devtools/build/lib/rules
parente7213406cd5d67c1ff3a16e4a21e7a87852c7051 (diff)
Support aliases in the --experimental_stl attribute.
-- PiperOrigin-RevId: 150610613 MOS_MIGRATED_REVID=150610613
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java17
2 files changed, 17 insertions, 4 deletions
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 e960d9f978..868834db81 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
@@ -293,6 +293,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
private final Label staticRuntimeLibsLabel;
private final Label dynamicRuntimeLibsLabel;
private final Label ccToolchainLabel;
+ private final Label stlLabel;
private final PathFragment sysroot;
private final PathFragment runtimeSysroot;
@@ -356,6 +357,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
this.targetOS = toolchain.getCcTargetOs();
this.crosstoolTop = params.crosstoolTop;
this.ccToolchainLabel = params.ccToolchainLabel;
+ this.stlLabel = params.stlLabel;
this.compilationMode = params.commonOptions.compilationMode;
this.useLLVMCoverageMap = params.commonOptions.useLLVMCoverageMapFormat;
this.lipoContextCollector = cppOptions.lipoCollector;
@@ -1616,7 +1618,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
* otherwise.
*/
public Label getStl() {
- return cppOptions.stl;
+ return stlLabel;
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
index 9067be9ef0..ca6c26ff26 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfigurationLoader.java
@@ -93,6 +93,7 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
protected final CppOptions cppOptions;
protected final Label crosstoolTop;
protected final Label ccToolchainLabel;
+ protected final Label stlLabel;
protected final Path fdoZip;
CppConfigurationParameters(CrosstoolConfig.CToolchain toolchain,
@@ -100,7 +101,8 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
BuildOptions buildOptions,
Path fdoZip,
Label crosstoolTop,
- Label ccToolchainLabel) {
+ Label ccToolchainLabel,
+ Label stlLabel) {
this.toolchain = toolchain;
this.cacheKeySuffix = cacheKeySuffix;
this.commonOptions = buildOptions.get(BuildConfiguration.Options.class);
@@ -108,6 +110,7 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
this.fdoZip = fdoZip;
this.crosstoolTop = crosstoolTop;
this.ccToolchainLabel = ccToolchainLabel;
+ this.stlLabel = stlLabel;
}
}
@@ -125,6 +128,15 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
return null;
}
+ CppOptions cppOptions = options.get(CppOptions.class);
+ Label stlLabel = null;
+ if (cppOptions.stl != null) {
+ stlLabel = RedirectChaser.followRedirects(env, cppOptions.stl, "stl");
+ if (stlLabel == null) {
+ return null;
+ }
+ }
+
CrosstoolConfigurationLoader.CrosstoolFile file =
CrosstoolConfigurationLoader.readCrosstool(env, crosstoolTopLabel);
if (file == null) {
@@ -135,7 +147,6 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
// FDO
// TODO(bazel-team): move this to CppConfiguration.prepareHook
- CppOptions cppOptions = options.get(CppOptions.class);
Path fdoZip;
if (cppOptions.fdoOptimize == null) {
fdoZip = null;
@@ -211,6 +222,6 @@ public class CppConfigurationLoader implements ConfigurationFragmentFactory {
}
return new CppConfigurationParameters(toolchain, file.getMd5(), options,
- fdoZip, crosstoolTopLabel, ccToolchainLabel);
+ fdoZip, crosstoolTopLabel, ccToolchainLabel, stlLabel);
}
}