aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-09-04 14:49:14 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-04 16:32:23 +0000
commit29a173a05df7926e5530175b2e6835f2e9b19d0b (patch)
treeabd1605239794217307f52ef5ea7638211bb62f7
parent2e0edabc71b03fa4df42c6cd645b84cd49a88293 (diff)
*** Reason for rollback *** Breaks a few thousand targets in the depot. It's weird, but I confirmed manually that this rollback fixes the issue. *** Original change description *** Distinguish between user-supplied ios_cpu and the default, and don't propagate the default to the XCode project control. -- MOS_MIGRATED_REVID=102340901
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java29
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java6
3 files changed, 5 insertions, 46 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
index 8873baca38..c4f70e36fe 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
@@ -15,8 +15,6 @@
package com.google.devtools.build.lib.rules.objc;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration.LabelConverter;
@@ -69,11 +67,10 @@ public class ObjcCommandLineOptions extends FragmentOptions {
+ "on the machine the simulator will be run on.")
public String iosSimulatorDevice;
- // TODO(bazel-team): Consider using optional for values like these.
@Option(name = "ios_cpu",
- defaultValue = "",
+ defaultValue = DEFAULT_IOS_CPU,
category = "build",
- help = "The target CPU for iOS compilation.")
+ help = "Specifies to target CPU of iOS compilation.")
public String iosCpu;
@Option(name = "xcode_options",
@@ -190,33 +187,13 @@ public class ObjcCommandLineOptions extends FragmentOptions {
}
}
- /**
- * Returns the value of the ios_cpu flag, or a default value if none was specified.
- */
- public String getIosCpu() {
- if ("".equals(iosCpu)) {
- return DEFAULT_IOS_CPU;
- } else {
- return iosCpu;
- }
- }
-
- /**
- * Returns the value of the ios_cpu flag, if it was specified.
- * This is to distinguish between the default cpu used by the build tools and the cpu explicitly
- * requested by user configuration.
- */
- public Optional<String> getConfiguredIosCpu() {
- return Strings.isNullOrEmpty(iosCpu) ? Optional.<String>absent() : Optional.of(iosCpu);
- }
-
private Platform getPlatform() {
for (String architecture : iosMultiCpus) {
if (Platform.forArch(architecture) == Platform.DEVICE) {
return Platform.DEVICE;
}
}
- return Platform.forArch(getIosCpu());
+ return Platform.forArch(iosCpu);
}
@Override
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 826f22d977..299bc290f8 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
@@ -58,7 +58,6 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
private final String iosSimulatorVersion;
private final String iosSimulatorDevice;
private final String iosCpu;
- private final Optional<String> configuredIosCpu;
private final String xcodeOptions;
private final Optional<String> xcodeVersionOverride;
private final boolean generateDebugSymbols;
@@ -94,9 +93,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
Preconditions.checkNotNull(objcOptions.iosSimulatorDevice, "iosSimulatorDevice");
this.iosSimulatorVersion =
Preconditions.checkNotNull(objcOptions.iosSimulatorVersion, "iosSimulatorVersion");
- this.iosCpu = Preconditions.checkNotNull(objcOptions.getIosCpu(), "iosCpu");
- this.configuredIosCpu =
- Preconditions.checkNotNull(objcOptions.getConfiguredIosCpu(), "configuredIosCpu");
+ this.iosCpu = Preconditions.checkNotNull(objcOptions.iosCpu, "iosCpu");
this.xcodeOptions = Preconditions.checkNotNull(objcOptions.xcodeOptions, "xcodeOptions");
this.generateDebugSymbols = objcOptions.generateDebugSymbols;
this.runMemleaks = objcOptions.runMemleaks;
@@ -150,22 +147,11 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
return iosSimulatorVersion;
}
- /**
- * Returns the ios_cpu value to use.
- */
public String getIosCpu() {
return iosCpu;
}
/**
- * Returns the ios_cpu value set by the configuration (that is, by a command-line flag
- * or by an ios_multi_cpu split configuration), if it is present.
- */
- public Optional<String> getConfiguredIosCpu() {
- return configuredIosCpu;
- }
-
- /**
* Returns the platform of the configuration for the current bundle, based on configured
* architectures (for example, {@code i386} maps to {@link Platform#SIMULATOR}).
*
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
index d0015fcd70..45f9726009 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
@@ -234,11 +234,7 @@ public final class XcodeSupport {
List<String> multiCpus = objcConfiguration.getIosMultiCpus();
if (multiCpus.isEmpty()) {
- // Only add a CPU architecture if one was explicitly configured.
- // Otherwise, the XCode generation tools will supply a default for XCode.
- if (objcConfiguration.getConfiguredIosCpu().isPresent()) {
- builder.addCpuArchitecture(objcConfiguration.getConfiguredIosCpu().get());
- }
+ builder.addCpuArchitecture(objcConfiguration.getIosCpu());
} else {
builder.addAllCpuArchitecture(multiCpus);
}