diff options
Diffstat (limited to 'src/main/java/com/google')
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; } |