aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-03-13 14:32:59 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-03-13 14:46:02 +0000
commit00d7223e031b79fa77dcfccf8fccb2f10f30388a (patch)
tree7c84f70020b7ee9195a64cda75b32efb2c5e5f9f /src/main/java/com/google/devtools/build
parent0f5fbfdbae351c2d9ae5dd8c678e1e5211ac09f4 (diff)
RELNOTES: Allow users to set the simulated device, SDK, and environment from the command line when running an objc_binary or ios_application.
-- MOS_MIGRATED_REVID=88544811
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java3
4 files changed, 30 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
index b4c860554f..497955ea92 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
@@ -74,6 +74,10 @@ public class IosApplicationRule implements RuleDefinition {
${ATTRIBUTE_SIGNATURE}
<p>This rule produces an application bundle for iOS.</p>
+<p>When running an iOS application using the <code>run</code> command, environment variables that
+are prefixed with <code>IOS_</code> will be passed to the launched application, with the prefix
+stripped. For example, if you export <code>IOS_ENV=foo</code>, <code>ENV=foo</code> will be
+passed to the application.</p>
${IMPLICIT_OUTPUTS}
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 6ce8f86f99..2e42ff9bd4 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
@@ -31,7 +31,7 @@ public class
ObjcCommandLineOptions extends FragmentOptions {
@Option(name = "ios_sdk_version",
defaultValue = DEFAULT_SDK_VERSION,
- category = "undocumented",
+ category = "build",
help = "Specifies the version of the iOS SDK to use to build iOS applications."
)
public String iosSdkVersion;
@@ -40,16 +40,22 @@ public class
@Option(name = "ios_simulator_version",
defaultValue = "7.1",
- category = "undocumented",
- help = "The version of iOS to run on the simulator when running tests. This is ignored if the"
- + " ios_test rule specifies the target device.",
- deprecationWarning = "This flag is deprecated in favor of the target_device attribute and"
- + " will eventually removed.")
+ category = "run",
+ help = "The version of iOS to run on the simulator when running or testing. This is ignored "
+ + "for ios_test rules if a target device is specified in the rule.")
public String iosSimulatorVersion;
+ @Option(name = "ios_simulator_device",
+ defaultValue = "iPhone 6",
+ category = "run",
+ help = "The device to simulate when running an iOS application in the simulator, e.g. "
+ + "'iPhone 6'. You can get a list of devices by running 'xcrun simctl list devicetypes' "
+ + "on the machine the simulator will be run on.")
+ public String iosSimulatorDevice;
+
@Option(name = "ios_cpu",
defaultValue = "i386",
- category = "undocumented",
+ category = "build",
help = "Specifies to target CPU of iOS compilation.")
public String iosCpu;
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 bc2b862cbd..4f8b3f5f27 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
@@ -46,6 +46,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
private final String iosSdkVersion;
private final String iosMinimumOs;
private final String iosSimulatorVersion;
+ private final String iosSimulatorDevice;
private final String iosCpu;
private final String xcodeOptions;
private final boolean generateDebugSymbols;
@@ -67,6 +68,8 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
@Nullable Label gcovLabel) {
this.iosSdkVersion = Preconditions.checkNotNull(objcOptions.iosSdkVersion, "iosSdkVersion");
this.iosMinimumOs = Preconditions.checkNotNull(objcOptions.iosMinimumOs, "iosMinimumOs");
+ this.iosSimulatorDevice =
+ Preconditions.checkNotNull(objcOptions.iosSimulatorDevice, "iosSimulatorDevice");
this.iosSimulatorVersion =
Preconditions.checkNotNull(objcOptions.iosSimulatorVersion, "iosSimulatorVersion");
this.iosCpu = Preconditions.checkNotNull(objcOptions.iosCpu, "iosCpu");
@@ -91,6 +94,13 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
return iosMinimumOs;
}
+ /**
+ * Returns the type of device (e.g. 'iPhone 6') to simulate when running on the simulator.
+ */
+ public String getIosSimulatorDevice() {
+ return iosSimulatorDevice;
+ }
+
public String getIosSimulatorVersion() {
return iosSimulatorVersion;
}
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 8e571c3c77..6a6e74a830 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
@@ -287,9 +287,12 @@ public final class ReleaseBundlingSupport {
*/
ReleaseBundlingSupport registerGenerateRunnerScriptAction(Artifact runnerScript,
Artifact ipaInput) {
+ ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext);
ImmutableList<Substitution> substitutions = ImmutableList.of(
Substitution.of("%app_name%", ruleContext.getLabel().getName()),
Substitution.of("%ipa_file%", ipaInput.getRootRelativePath().getPathString()),
+ Substitution.of("%sim_device%", objcConfiguration.getIosSimulatorDevice()),
+ Substitution.of("%sdk_version%", objcConfiguration.getIosSimulatorVersion()),
Substitution.of("%iossim%", attributes.iossim().getRootRelativePath().getPathString()));
ruleContext.registerAction(