diff options
author | 2015-05-07 11:06:42 +0000 | |
---|---|---|
committer | 2015-05-07 14:05:38 +0000 | |
commit | 6c3bf7456aa7ccd370667cb7bc3373fc528e7beb (patch) | |
tree | ffe09db159719803f901c18c45227d5ce2388707 | |
parent | 2673816381e6c8d7540b01c85a9dc8009de804b0 (diff) |
Update command that builds storyboards to pass correct options
The command used to compile storyboards for iOS targets was
leaving off the --target-device options, which would result
in an empty compiled storyboard. This commit updates the
command constructed so that it does pass those options and
builds non-empty storyboards.
--
Change-Id: Ief6aed6f61099fa19ec7846d2321b40f8fce1ab2
MOS_MIGRATED_REVID=93016471
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java index 1e600823ab..e392ced916 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java @@ -100,7 +100,8 @@ final class BundleSupport { * Creates a new bundle support with no special {@code actool} arguments. * * @param ruleContext context this bundle is constructed in - * @param targetDeviceFamilies device families used in asset catalogue construction + * @param targetDeviceFamilies device families used in asset catalogue construction and storyboard + * compilation * @param bundling bundle information as configured for this rule */ public BundleSupport( @@ -112,7 +113,8 @@ final class BundleSupport { * Creates a new bundle support. * * @param ruleContext context this bundle is constructed in - * @param targetDeviceFamilies device families used in asset catalogue construction + * @param targetDeviceFamilies device families used in asset catalogue construction and storyboard + * compilation * @param bundling bundle information as configured for this rule * @param extraActoolArgs any additional parameters to be used for invoking {@code actool} */ @@ -205,22 +207,31 @@ final class BundleSupport { ruleContext.registerAction( ObjcActionsBuilder.spawnJavaOnDarwinActionBuilder(attributes.ibtoolzipDeployJar()) .setMnemonic("StoryboardCompile") - .setCommandLine(CustomCommandLine.builder() - // The next three arguments are positional, - // i.e. they don't have flags before them. - .addPath(zipOutput.getExecPath()) - .add(archiveRoot) - .addPath(ObjcActionsBuilder.IBTOOL) - - .add("--minimum-deployment-target").add(bundling.getMinimumOsVersion()) - .addPath(storyboardInput.getExecPath()) - .build()) + .setCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, storyboardInput)) .addOutput(zipOutput) .addInput(storyboardInput) .build(ruleContext)); } } + private CommandLine ibActionsCommandLine(String archiveRoot, Artifact zipOutput, + Artifact storyboardInput) { + CustomCommandLine.Builder commandLine = CustomCommandLine.builder() + // The next three arguments are positional, i.e. they don't have flags before them. + .addPath(zipOutput.getExecPath()) + .add(archiveRoot) + .addPath(ObjcActionsBuilder.IBTOOL) + .add("--minimum-deployment-target").add(bundling.getMinimumOsVersion()); + + for (TargetDeviceFamily targetDeviceFamily : targetDeviceFamilies) { + commandLine.add("--target-device").add(targetDeviceFamily.name().toLowerCase(Locale.US)); + } + + return commandLine + .addPath(storyboardInput.getExecPath()) + .build(); + } + private void registerMomczipActions(ObjcProvider objcProvider) { ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext); IntermediateArtifacts intermediateArtifacts = |