diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc')
6 files changed, 27 insertions, 27 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java index 690207b3ab..bc26cf74ed 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java @@ -142,11 +142,11 @@ public class AppleBinary implements RuleConfiguredTargetFactory { .registerCombineArchitecturesAction( binariesToLipo.build(), ruleIntermediateArtifacts.combinedArchitectureBinary(), - appleConfiguration.getIosCpuPlatform()) + appleConfiguration.getPlatform(PlatformType.IOS)) .registerCombineArchitecturesAction( archivesToLipo.build(), ruleContext.getImplicitOutputArtifact(AppleBinaryRule.LIPO_ARCHIVE), - appleConfiguration.getIosCpuPlatform()); + appleConfiguration.getPlatform(PlatformType.IOS)); RuleConfiguredTargetBuilder targetBuilder = ObjcRuleClasses.ruleConfiguredTarget(ruleContext, filesToBuild.build()); 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 abbeba537c..bb816ba2be 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 @@ -36,6 +36,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.AppleToolchain; import com.google.devtools.build.lib.rules.apple.Platform; +import com.google.devtools.build.lib.rules.apple.Platform.PlatformType; import com.google.devtools.build.lib.rules.objc.XcodeProvider.Builder; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.PathFragment; @@ -137,8 +138,8 @@ final class BundleSupport { Platform platform = null; for (String architecture : appleConfiguration.getIosMultiCpus()) { if (platform == null) { - platform = Platform.forIosArch(architecture); - } else if (platform != Platform.forIosArch(architecture)) { + platform = Platform.forTarget(PlatformType.IOS, architecture); + } else if (platform != Platform.forTarget(PlatformType.IOS, architecture)) { ruleContext.ruleError( String.format("In builds which require bundling, --ios_multi_cpus does not currently " + "allow values for both simulator and device builds. Flag was %s", diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java index 8c60aaa1ed..fb420384c5 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java @@ -81,6 +81,7 @@ import com.google.devtools.build.lib.packages.TargetUtils; import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.AppleToolchain; import com.google.devtools.build.lib.rules.apple.Platform; +import com.google.devtools.build.lib.rules.apple.Platform.PlatformType; import com.google.devtools.build.lib.rules.cpp.CppModuleMap; import com.google.devtools.build.lib.rules.cpp.CppModuleMapAction; import com.google.devtools.build.lib.rules.cpp.LinkerInputs; @@ -522,7 +523,7 @@ public final class CompilationSupport { // TODO(bazel-team): Remote private headers from inputs once they're added to the provider. ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("ObjcCompile") .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(commandLine.build()) @@ -652,7 +653,7 @@ public final class CompilationSupport { ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("SwiftCompile") .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(commandLine.build()) @@ -722,7 +723,7 @@ public final class CompilationSupport { commandLine.add(commonFrameworkFlags(objcProvider, appleConfiguration)); ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("SwiftModuleMerge") .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(commandLine.build()) @@ -756,13 +757,13 @@ public final class CompilationSupport { /*makeExecutable=*/ false)); actions.add(ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("ObjcLink") .setExecutable(libtool(ruleContext)) .setCommandLine(new CustomCommandLine.Builder() .add("-static") .add("-filelist").add(objList.getExecPathString()) - .add("-arch_only").add(appleConfiguration.getIosCpu()) + .add("-arch_only").add(appleConfiguration.getSingleArchitecture(PlatformType.IOS)) .add("-syslibroot").add(AppleToolchain.sdkDir()) .add("-o").add(archive.getExecPathString()) .build()) @@ -787,12 +788,12 @@ public final class CompilationSupport { ImmutableList<Artifact> objcLibraries = objcLibraries(objcProvider); ImmutableList<Artifact> ccLibraries = ccLibraries(objcProvider); ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("ObjcLink") .setExecutable(libtool(ruleContext)) .setCommandLine(new CustomCommandLine.Builder() .add("-static") - .add("-arch_only").add(appleConfiguration.getIosCpu()) + .add("-arch_only").add(appleConfiguration.getSingleArchitecture(PlatformType.IOS)) .add("-syslibroot").add(AppleToolchain.sdkDir()) .add("-o").add(outputArchive.getExecPathString()) .addExecPaths(objcLibraries) @@ -990,7 +991,7 @@ public final class CompilationSupport { linkmap); ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("ObjcLink") .setShellCommand(ImmutableList.of("/bin/bash", "-c")) .setCommandLine(new SingleArgCommandLine(commandLine)) @@ -1024,7 +1025,7 @@ public final class CompilationSupport { ruleContext.registerAction( ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("ObjcBinarySymbolStrip") .setExecutable(xcrunwrapper(ruleContext)) .setCommandLine(symbolStripCommandLine(stripArgs, binaryToLink, strippedBinary)) @@ -1293,7 +1294,7 @@ public final class CompilationSupport { commandLine, ParameterFile.ParameterFileType.UNQUOTED, ISO_8859_1)); ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder( - ruleContext, appleConfiguration.getIosCpuPlatform()) + ruleContext, appleConfiguration.getPlatform(PlatformType.IOS)) .setMnemonic("DummyPruner") .setExecutable(pruner) .addInput(dummyArchive) @@ -1508,7 +1509,8 @@ public final class CompilationSupport { */ @VisibleForTesting static String swiftTarget(AppleConfiguration configuration) { - return configuration.getIosCpu() + "-apple-ios" + configuration.getIosSdkVersion(); + return configuration.getSingleArchitecture(PlatformType.IOS) + + "-apple-ios" + configuration.getIosSdkVersion(); } /** @@ -1518,7 +1520,7 @@ public final class CompilationSupport { ObjcProvider provider, ObjcConfiguration objcConfiguration, AppleConfiguration appleConfiguration) { ImmutableList.Builder<String> builder = new ImmutableList.Builder<>(); - Platform platform = Platform.forIosArch(appleConfiguration.getIosCpu()); + Platform platform = appleConfiguration.getPlatform(PlatformType.IOS); if (platform == Platform.IOS_SIMULATOR) { builder.add("-mios-simulator-version-min=" + objcConfiguration.getMinimumOs()); } else { @@ -1530,7 +1532,7 @@ public final class CompilationSupport { } return builder - .add("-arch", appleConfiguration.getIosCpu()) + .add("-arch", appleConfiguration.getSingleArchitecture(PlatformType.IOS)) .add("-isysroot", AppleToolchain.sdkDir()) // TODO(bazel-team): Pass framework search paths to Xcodegen. .addAll(commonFrameworkFlags(provider, appleConfiguration)) @@ -1550,7 +1552,7 @@ public final class CompilationSupport { */ static Iterable<String> commonFrameworkNames( ObjcProvider provider, AppleConfiguration appleConfiguration) { - Platform platform = Platform.forIosArch(appleConfiguration.getIosCpu()); + Platform platform = appleConfiguration.getPlatform(PlatformType.IOS); return new ImmutableList.Builder<String>() .add(AppleToolchain.sdkFrameworkDir(platform, appleConfiguration)) @@ -1578,7 +1580,7 @@ public final class CompilationSupport { private static List<String> platformSpecificCompileFlagsForClang( AppleConfiguration configuration) { - switch (Platform.forIosArch(configuration.getIosCpu())) { + switch (configuration.getPlatform(PlatformType.IOS)) { case IOS_DEVICE: return ImmutableList.of(); case IOS_SIMULATOR: diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java index 4c089de70c..f6a0c938d2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java @@ -52,6 +52,7 @@ import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.AppleToolchain; import com.google.devtools.build.lib.rules.apple.AppleToolchain.RequiresXcodeConfigRule; import com.google.devtools.build.lib.rules.apple.Platform; +import com.google.devtools.build.lib.rules.apple.Platform.PlatformType; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.syntax.Type; import com.google.devtools.build.lib.util.FileType; @@ -187,7 +188,7 @@ public class ObjcRuleClasses { AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class); return spawnAppleEnvActionBuilder(ruleContext, - Platform.forIosArch(appleConfiguration.getIosCpu())); + Platform.forTarget(PlatformType.IOS, appleConfiguration.getIosCpu())); } /** 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 f4fb0338e2..868303e70a 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 @@ -820,7 +820,7 @@ public final class ReleaseBundlingSupport { AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class); new LipoSupport(ruleContext).registerCombineArchitecturesAction(linkedBinaries(), - resultingLinkedBinary, appleConfiguration.getIosCpuPlatform()); + resultingLinkedBinary, appleConfiguration.getPlatform(PlatformType.IOS)); } private NestedSet<Artifact> linkedBinaries() { diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java index 802fc8f658..61ac5a6af3 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java @@ -30,6 +30,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.packages.ImplicitOutputsFunction.SafeImplicitOutputsFunction; import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher; +import com.google.devtools.build.lib.rules.apple.Platform.PlatformType; import com.google.devtools.build.lib.rules.objc.XcodeProvider.Builder; import com.google.devtools.build.lib.rules.objc.XcodeProvider.Project; import com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos; @@ -271,12 +272,7 @@ public final class XcodeSupport { this.project = project; this.pbxproj = pbxproj; this.workspaceRoot = objcConfiguration.getXcodeWorkspaceRoot(); - List<String> multiCpus = appleConfiguration.getIosMultiCpus(); - if (multiCpus.isEmpty()) { - this.appleCpus = ImmutableList.of(appleConfiguration.getIosCpu()); - } else { - this.appleCpus = multiCpus; - } + this.appleCpus = appleConfiguration.getArchitectures(PlatformType.IOS); this.minimumOs = objcConfiguration.getMinimumOs().toString(); this.generateDebugSymbols = objcConfiguration.generateDebugSymbols() || objcConfiguration.generateDsym(); |