aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2017-03-14 14:57:53 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-03-14 19:50:28 +0000
commit6140817ad14fbc2a80c9f6e8556657d5156fb1b1 (patch)
treea33ca703127bb97611f1f4cb0b4e44506fc2c0a2 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
parent37c51ae72c5a23af0cd5325b1592057370f5b650 (diff)
apple_binary scopes link artifacts using child configuration for --experimental_objc_crosstool=all
-- PiperOrigin-RevId: 150066766 MOS_MIGRATED_REVID=150066766
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
index 92df63420e..3134aad034 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
@@ -342,13 +342,23 @@ public class CppHelper {
src.getRoot());
}
- /** Returns the linked artifact for linux. */
- public static Artifact getLinuxLinkedArtifact(RuleContext ruleContext, LinkTargetType linkType) {
- return getLinuxLinkedArtifact(ruleContext, linkType, "");
+ /**
+ * Returns the linked artifact for linux.
+ *
+ * @param ruleContext the ruleContext to be used to scope the artifact
+ * @param config the configuration to be used to scope the artifact
+ * @param linkType the type of artifact, used to determine extension
+ */
+ public static Artifact getLinuxLinkedArtifact(
+ RuleContext ruleContext, BuildConfiguration config, LinkTargetType linkType) {
+ return getLinuxLinkedArtifact(ruleContext, config, linkType, "");
}
/** Returns the linked artifact with the given suffix for linux. */
- public static Artifact getLinuxLinkedArtifact(RuleContext ruleContext, LinkTargetType linkType,
+ public static Artifact getLinuxLinkedArtifact(
+ RuleContext ruleContext,
+ BuildConfiguration config,
+ LinkTargetType linkType,
String linkedArtifactNameSuffix) {
PathFragment name = new PathFragment(ruleContext.getLabel().getName());
if (linkType != LinkTargetType.EXECUTABLE) {
@@ -356,7 +366,8 @@ public class CppHelper {
"lib" + name.getBaseName() + linkedArtifactNameSuffix + linkType.getExtension());
}
- return ruleContext.getBinArtifact(name);
+ return ruleContext.getPackageRelativeArtifact(
+ name, config.getBinDirectory(ruleContext.getRule().getRepository()));
}
/**