aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-05-10 14:18:03 -0400
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-05-11 10:43:04 -0400
commitd7297887c764e9a9ee906202d988bd353e5f5ecf (patch)
treee49ad15967bbf9b0e76d4ed549b3be4abda076bf /src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
parent36ce4b433e19498a78c34540d5a166d4e0006b22 (diff)
Automated g4 rollback of commit 6879d7ceff0e118fdecb0cabe5134979030b7cb8.
*** Reason for rollback *** Fixes memory issue that caused this CL to be rolled back. *** Original change description *** Automated g4 rollback of commit cbbb423663b154d82e3dfa5e9a56839583987999. *** Reason for rollback *** Need to roll this back as part of http://b/38171368 *** Original change description *** RELNOTES: Effectively remove sysroot from CppConfiguration and allow it to use select statements. PiperOrigin-RevId: 155651879
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
index 26d4c38b67..89beafe21d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
@@ -75,7 +75,8 @@ public final class CcToolchainProvider
NestedSetBuilder.<Pair<String, String>>emptySet(Order.COMPILE_ORDER),
null,
ImmutableMap.<String, String>of(),
- ImmutableList.<PathFragment>of());
+ ImmutableList.<PathFragment>of(),
+ null);
@Nullable private final CppConfiguration cppConfiguration;
private final NestedSet<Artifact> crosstool;
@@ -102,6 +103,7 @@ public final class CcToolchainProvider
@Nullable private final Artifact linkDynamicLibraryTool;
private final ImmutableMap<String, String> environment;
private final ImmutableList<PathFragment> builtInIncludeDirectories;
+ @Nullable private final PathFragment sysroot;
public CcToolchainProvider(
@Nullable CppConfiguration cppConfiguration,
@@ -128,7 +130,8 @@ public final class CcToolchainProvider
NestedSet<Pair<String, String>> coverageEnvironment,
Artifact linkDynamicLibraryTool,
ImmutableMap<String, String> environment,
- ImmutableList<PathFragment> builtInIncludeDirectories) {
+ ImmutableList<PathFragment> builtInIncludeDirectories,
+ @Nullable PathFragment sysroot) {
super(SKYLARK_CONSTRUCTOR, ImmutableMap.<String, Object>of());
this.cppConfiguration = cppConfiguration;
this.crosstool = Preconditions.checkNotNull(crosstool);
@@ -155,6 +158,7 @@ public final class CcToolchainProvider
this.linkDynamicLibraryTool = linkDynamicLibraryTool;
this.environment = environment;
this.builtInIncludeDirectories = builtInIncludeDirectories;
+ this.sysroot = sysroot;
}
@SkylarkCallable(
@@ -352,7 +356,7 @@ public final class CcToolchainProvider
+ "this method returns <code>None</code>."
)
public PathFragment getSysroot() {
- return cppConfiguration.getSysroot();
+ return sysroot;
}
@SkylarkCallable(
@@ -362,7 +366,7 @@ public final class CcToolchainProvider
+ "rules. These should be appended to the command line after filtering."
)
public ImmutableList<String> getUnfilteredCompilerOptions(Iterable<String> features) {
- return cppConfiguration.getUnfilteredCompilerOptions(features);
+ return cppConfiguration.getUnfilteredCompilerOptions(features, sysroot);
}
@SkylarkCallable(
@@ -373,6 +377,6 @@ public final class CcToolchainProvider
+ "inferred from the command-line options."
)
public ImmutableList<String> getLinkOptions() {
- return cppConfiguration.getLinkOptions();
+ return cppConfiguration.getLinkOptions(sysroot);
}
}