aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-10-15 07:10:15 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2015-10-15 10:59:38 +0000
commit1e2a30b0e4fdcf240b5e8e77e7188f813348e988 (patch)
tree96e00de663f9a9bc4d15928f1d60b52e81af5bf3 /src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
parentc82224f4945118392488e508f179cdf1918491bd (diff)
Introduce --override_workspace_root blaze flag to hand-set workspace_root and mainGroup in xcodeproj.
RELNOTES: Adds --override_workspace_root blaze flag to hand-set workspace_root and mainGroup in xcodeproj. -- MOS_MIGRATED_REVID=105484952
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
index 50f73c1900..abeccdc0fe 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
@@ -79,6 +79,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
private final ConfigurationDistinguisher configurationDistinguisher;
@Nullable private final String signingCertName;
@Nullable private final Path clientWorkspaceRoot;
+ private final String xcodeOverrideWorkspaceRoot;
// We only load these labels if the mode which uses them is enabled. That is known as part of the
// BuildConfiguration. This label needs to be part of a configuration because only configurations
@@ -120,6 +121,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
this.configurationDistinguisher = objcOptions.configurationDistinguisher;
this.clientWorkspaceRoot = directories != null ? directories.getWorkspace() : null;
this.signingCertName = objcOptions.iosSigningCertName;
+ this.xcodeOverrideWorkspaceRoot = objcOptions.xcodeOverrideWorkspaceRoot;
}
public Map<String, String> getEnvironmentForDarwin() {
@@ -330,11 +332,21 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
}
/**
- * Returns the absolute path of the root of Bazel client workspace. Null if passed-in
- * {@link BlazeDirectories} is null or Bazel fails to find the workspace root directory.
+ * Returns the path to be used for workspace_root (and path of pbxGroup mainGroup) in xcodeproj.
+ * This usually will be the absolute path of the root of Bazel client workspace or null if
+ * passed-in {@link BlazeDirectories} is null or Bazel fails to find the workspace root directory.
+ * It can also be overridden by the {@code --xcode_override_workspace_root} flag, in which case
+ * the path can be absolute or relative.
*/
- @Nullable public Path getClientWorkspaceRoot() {
- return this.clientWorkspaceRoot;
+ @Nullable
+ public String getXcodeWorkspaceRoot() {
+ if (!this.xcodeOverrideWorkspaceRoot.isEmpty()) {
+ return this.xcodeOverrideWorkspaceRoot;
+ }
+ if (this.clientWorkspaceRoot == null) {
+ return null;
+ }
+ return this.clientWorkspaceRoot.getPathString();
}
/**