aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
diff options
context:
space:
mode:
authorGravatar Rumou Duan <rduan@google.com>2017-02-21 21:21:49 +0000
committerGravatar Irina Iancu <elenairina@google.com>2017-02-22 08:28:12 +0000
commit7463237970f82ace1864f461034d8570fba647f2 (patch)
treeec7e10e622ab5a5051ea7169c8a79af22bc807e7 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
parent34f47c81fc82bc9c6bd5f24c212d31555fe96bc9 (diff)
Crosstool compilation support for J2ObjcAspect.
Note that I also have to make some changes to cpp files to add the ability to specify a suffix for linked artifacts. This helps to avoid an artifact conflict between proto_library and J2ObjcAspect acting on proto_library, where both will create an archive file. J2ObjcAspect will simply generate a "_j2objc.a" archive instead of ".a" archive. -- PiperOrigin-RevId: 148135630 MOS_MIGRATED_REVID=148135630
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.java9
1 files changed, 8 insertions, 1 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 befcb82e13..92df63420e 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
@@ -344,9 +344,16 @@ public class CppHelper {
/** Returns the linked artifact for linux. */
public static Artifact getLinuxLinkedArtifact(RuleContext ruleContext, LinkTargetType linkType) {
+ return getLinuxLinkedArtifact(ruleContext, linkType, "");
+ }
+
+ /** Returns the linked artifact with the given suffix for linux. */
+ public static Artifact getLinuxLinkedArtifact(RuleContext ruleContext, LinkTargetType linkType,
+ String linkedArtifactNameSuffix) {
PathFragment name = new PathFragment(ruleContext.getLabel().getName());
if (linkType != LinkTargetType.EXECUTABLE) {
- name = name.replaceName("lib" + name.getBaseName() + linkType.getExtension());
+ name = name.replaceName(
+ "lib" + name.getBaseName() + linkedArtifactNameSuffix + linkType.getExtension());
}
return ruleContext.getBinArtifact(name);