aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2017-01-27 22:09:35 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-01-30 09:01:45 +0000
commiteca58b17371f0539db0c444d69414b53e817e885 (patch)
treea7d96e7f86470b2cb2fc81e1ca3774a40b8f1cc2 /src
parent669e7f2cbe72aa96504e8f94d5ce65f5534fa627 (diff)
Remove --ios_multi_cpus (simulator & device) restriction on the objc_bundle_library rule
-- PiperOrigin-RevId: 145834899 MOS_MIGRATED_REVID=145834899
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBundleLibrary.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java4
3 files changed, 22 insertions, 21 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 b6cfa5528c..ab2bc95fa0 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
@@ -131,7 +131,13 @@ final class BundleSupport {
return this;
}
- private void validatePlatform() {
+ /**
+ * Validates the platform for this build is either simulator or device, and does not
+ * contain architectures for both platforms.
+ *
+ * @return this bundle support
+ */
+ public BundleSupport validatePlatform() {
Platform platform = null;
for (String architecture : appleConfiguration.getIosMultiCpus()) {
if (platform == null) {
@@ -143,9 +149,16 @@ final class BundleSupport {
appleConfiguration.getIosMultiCpus()));
}
}
+ return this;
}
- private void validateResources(ObjcProvider objcProvider) {
+ /**
+ * Validates that resources defined in this rule and its dependencies and written to this
+ * bundle are legal (for example that they are not mapped to the same bundle location).
+ *
+ * @return this bundle support
+ */
+ public BundleSupport validateResources(ObjcProvider objcProvider) {
Map<String, Artifact> bundlePathToFile = new HashMap<>();
NestedSet<Artifact> artifacts = objcProvider.get(STRINGS);
@@ -187,25 +200,8 @@ final class BundleSupport {
bundlePathToFile.put(bundlePath, bundled);
}
}
-
// TODO(bazel-team): Do the same validation for storyboards and datamodels which could also be
// generated by genrules or doubly defined.
- }
-
- /**
- * Validates bundle support.
- * <ul>
- * <li>Validates that resources defined in this rule and its dependencies and written to this
- * bundle are legal (for example that they are not mapped to the same bundle location)
- * <li>Validates the platform for this build is either simulator or device, and does not
- * contain architectures for both platforms
- * </ul>
- *
- * @return this bundle support
- */
- BundleSupport validate(ObjcProvider objcProvider) {
- validatePlatform();
- validateResources(objcProvider);
return this;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBundleLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBundleLibrary.java
index c7ae890d47..46b0a21af1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBundleLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBundleLibrary.java
@@ -58,13 +58,16 @@ public class ObjcBundleLibrary implements RuleConfiguredTargetFactory {
}
AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
+
+ // Platform is purposefully not validated on this BundleSupport. Multi-arch validation and
+ // resource de-duplication should only take place at the level of the bundling rule.
new BundleSupport(ruleContext,
appleConfiguration,
appleConfiguration.getMultiArchPlatform(PlatformType.IOS),
bundling,
new ExtraActoolArgs())
+ .validateResources(common.getObjcProvider())
.registerActions(common.getObjcProvider())
- .validate(common.getObjcProvider())
.addXcodeSettings(xcodeProviderBuilder);
if (ruleContext.hasErrors()) {
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 661994ad8d..fc2a6ad46d 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
@@ -281,7 +281,9 @@ public final class ReleaseBundlingSupport {
* @return this release bundling support
*/
ReleaseBundlingSupport validateResources() {
- bundleSupport.validate(objcProvider);
+ bundleSupport
+ .validatePlatform()
+ .validateResources(objcProvider);
return this;
}