From 43bc404c4983a902964573ab13b44a6bde7920b3 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Fri, 30 Oct 2015 18:32:25 +0000 Subject: Strict matching of architecture name to ios platform. Also refactor Platform into a new .apple package, as it is not relevant for solely objc rules. -- MOS_MIGRATED_REVID=106709486 --- .../devtools/build/xcode/bundlemerge/BundleMerging.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/objc_tools') diff --git a/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java b/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java index 4523db2d26..c402f60a96 100644 --- a/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java +++ b/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java @@ -87,6 +87,21 @@ public final class BundleMerging { private static final String INFOPLIST_FILENAME = "Info.plist"; private static final String PKGINFO_FILENAME = "PkgInfo"; + /** + * A hack needed briefly to maintain backwards compatibility during rename of {@link Platform} + * enums. Except for backwards-compatible names, falls back to usage of {@link Platform#valueOf}. + */ + // TODO(bazel-team): Remove this hack. + private static Platform platformFromName(String platformName) { + if ("SIMULATOR".equals(platformName)) { + return Platform.IOS_SIMULATOR; + } else if ("DEVICE".equals(platformName)) { + return Platform.IOS_DEVICE; + } else { + return Platform.valueOf(platformName); + } + } + /** * Adds merge artifacts from the given {@code control} into builders that collect merge zips and * individual files. {@code bundleRoot} is prepended to each path, except the paths in the merge @@ -113,7 +128,7 @@ public final class BundleMerging { sourcePlistFiles, PlistMerging.automaticEntries( control.getTargetDeviceFamilyList(), - Platform.valueOf(control.getPlatform()), + platformFromName(control.getPlatform()), control.getSdkVersion(), control.getMinimumOsVersion()), substitutionMap.build(), -- cgit v1.2.3