aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.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/objc/IntermediateArtifacts.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/objc/IntermediateArtifacts.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
index e9b795b4c1..620010edd4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
@@ -21,6 +21,7 @@ import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.rules.cpp.CppCompileAction.DotdFile;
+import com.google.devtools.build.lib.rules.cpp.CppHelper;
import com.google.devtools.build.lib.rules.cpp.CppModuleMap;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
@@ -80,6 +81,13 @@ public final class IntermediateArtifacts {
}
/**
+ * Returns the archive file name suffix.
+ */
+ public String archiveFileNameSuffix() {
+ return archiveFileNameSuffix;
+ }
+
+ /**
* Returns the location of this target's generated entitlements file.
*/
public Artifact entitlements() {
@@ -243,7 +251,7 @@ public final class IntermediateArtifacts {
* The {@code .a} file which contains all the compiled sources for a rule.
*/
public Artifact archive() {
- // The path will be RULE_PACKAGE/libRULEBASENAME.a
+ // The path will be {RULE_PACKAGE}/lib{RULEBASENAME}{SUFFIX}.a
String basename = new PathFragment(ruleContext.getLabel().getName()).getBaseName();
return scopedArtifact(new PathFragment(String.format(
"lib%s%s.a", basename, archiveFileNameSuffix)));
@@ -263,8 +271,7 @@ public final class IntermediateArtifacts {
*/
public Artifact objFile(Artifact source) {
if (source.isTreeArtifact()) {
- PathFragment rootRelativePath = source.getRootRelativePath().replaceName("obj_files");
- return ruleContext.getTreeArtifact(rootRelativePath, ruleContext.getBinOrGenfilesDirectory());
+ return CppHelper.getCompileOutputTreeArtifact(ruleContext, source);
} else {
return inUniqueObjsDir(source, ".o");
}