aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java26
2 files changed, 21 insertions, 19 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 5143691164..615193d837 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
@@ -45,8 +45,7 @@ import javax.annotation.Nullable;
/** Information about a C++ compiler used by the <code>cc_*</code> rules. */
@Immutable
@AutoCodec
-public final class CcToolchainProvider extends ToolchainInfo
- implements CcToolchainProviderApi<PathFragment> {
+public final class CcToolchainProvider extends ToolchainInfo implements CcToolchainProviderApi {
public static final String SKYLARK_NAME = "CcToolchainInfo";
/** An empty toolchain to be returned in the error case (instead of null). */
@@ -289,6 +288,13 @@ public final class CcToolchainProvider extends ToolchainInfo
}
@Override
+ public ImmutableList<String> getBuiltInIncludeDirectoriesAsStrings() {
+ return builtInIncludeDirectories
+ .stream()
+ .map(PathFragment::getSafePathString)
+ .collect(ImmutableList.toImmutableList());
+ }
+
public ImmutableList<PathFragment> getBuiltInIncludeDirectories() {
return builtInIncludeDirectories;
}
@@ -582,8 +588,8 @@ public final class CcToolchainProvider extends ToolchainInfo
}
@Override
- public PathFragment getSysroot() {
- return sysroot;
+ public String getSysroot() {
+ return sysroot != null ? sysroot.getPathString() : null;
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java
index fefb424a57..cb6287e612 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java
@@ -20,28 +20,24 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
import com.google.devtools.build.lib.syntax.EvalException;
-/**
- * Information about the C++ toolchain.
- */
+/** Information about the C++ toolchain. */
@SkylarkModule(name = "CcToolchainInfo", doc = "Information about the C++ compiler being used.")
-public interface CcToolchainProviderApi<PathFragmentT> extends ToolchainInfoApi {
+public interface CcToolchainProviderApi extends ToolchainInfoApi {
@SkylarkCallable(
name = "built_in_include_directories",
doc = "Returns the list of built-in directories of the compiler.",
- structField = true
- )
- public ImmutableList<PathFragmentT> getBuiltInIncludeDirectories();
+ structField = true)
+ public ImmutableList<String> getBuiltInIncludeDirectoriesAsStrings();
@SkylarkCallable(
- name = "sysroot",
- structField = true,
- doc =
- "Returns the sysroot to be used. If the toolchain compiler does not support "
- + "different sysroots, or the sysroot is the same as the default sysroot, then "
- + "this method returns <code>None</code>."
- )
- public PathFragmentT getSysroot();
+ name = "sysroot",
+ structField = true,
+ doc =
+ "Returns the sysroot to be used. If the toolchain compiler does not support "
+ + "different sysroots, or the sysroot is the same as the default sysroot, then "
+ + "this method returns <code>None</code>.")
+ public String getSysroot();
@SkylarkCallable(name = "compiler", structField = true, doc = "C++ compiler.",
allowReturnNones = true)