aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2015-09-08 22:32:13 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-09-09 12:06:03 +0000
commit1343a77a94d0ea5cb63aa7ae7ea1cdda7080dd5d (patch)
treede3a79e0bb1c808b11be420c4f1bc401838a157f /src/main/java/com/google/devtools/build/lib/rules
parent2fc8bf242c81d3305dd18753902442a30b0c1d91 (diff)
Base .entitlements (and related extension) files on the full target label as opposed to treating the label name as a file (which the extension is stripped from).
This prevents this functionality from breaking if the target contains what looks like an extension (e.g. test.foo) -- MOS_MIGRATED_REVID=102600479
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java13
2 files changed, 23 insertions, 6 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 0a1d3b9efd..ff6b573aee 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
@@ -58,6 +58,22 @@ final class IntermediateArtifacts {
}
/**
+ * Returns a derived artifact in the bin directory obtained by appending some extension to the
+ * main label name; the result artifact is placed in a unique "entitlements" directory.
+ * For example, if this artifact is for a target Foo with extension ".extension", the result
+ * artifact will be located at {target_base_path}/entitlements/Foo.extension.
+ */
+ public Artifact appendExtensionForEntitlementArtifact(String extension) {
+ PathFragment entitlementsDirectory = ruleContext.getUniqueDirectory("entitlements");
+ Artifact artifact =
+ ruleContext.getDerivedArtifact(
+ entitlementsDirectory.replaceName(
+ entitlementsDirectory.getBaseName() + extension),
+ ruleContext.getConfiguration().getBinDirectory());
+ return artifact;
+ }
+
+ /**
* Returns a derived artifact in the bin directory obtained by appending some extension to the end
* of the given {@link PathFragment}.
*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 787604d8f8..61d22adcac 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -48,7 +48,6 @@ import com.google.devtools.build.lib.packages.ImplicitOutputsFunction.SafeImplic
import com.google.devtools.build.lib.packages.Type;
import com.google.devtools.build.lib.rules.objc.BundleSupport.ExtraActoolArgs;
import com.google.devtools.build.lib.shell.ShellUtils;
-import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.XcodeprojBuildSetting;
import java.util.List;
@@ -331,19 +330,21 @@ public final class ReleaseBundlingSupport {
}
private Artifact registerBundleSigningActions(Artifact ipaOutput) {
- PathFragment entitlementsDirectory = ruleContext.getUniqueDirectory("entitlements");
+ IntermediateArtifacts intermediateArtifacts =
+ ObjcRuleClasses.intermediateArtifacts(ruleContext);
Artifact teamPrefixFile =
- ruleContext.getRelatedArtifact(entitlementsDirectory, ".team_prefix_file");
+ intermediateArtifacts.appendExtensionForEntitlementArtifact(".team_prefix_file");
registerExtractTeamPrefixAction(teamPrefixFile);
Artifact entitlementsNeedingSubstitution = attributes.entitlements();
if (entitlementsNeedingSubstitution == null) {
- entitlementsNeedingSubstitution = ruleContext.getRelatedArtifact(
- entitlementsDirectory, ".entitlements_with_variables");
+ entitlementsNeedingSubstitution =
+ intermediateArtifacts.appendExtensionForEntitlementArtifact(
+ ".entitlements_with_variables");
registerExtractEntitlementsAction(entitlementsNeedingSubstitution);
}
Artifact entitlements =
- ruleContext.getRelatedArtifact(entitlementsDirectory, ".entitlements");
+ intermediateArtifacts.appendExtensionForEntitlementArtifact(".entitlements");
registerEntitlementsVariableSubstitutionAction(
entitlementsNeedingSubstitution, entitlements, teamPrefixFile);
Artifact ipaUnsigned = ruleContext.getImplicitOutputArtifact(IPA_UNSIGNED);