aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-02-01 17:14:58 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-02-02 09:57:56 +0000
commit47bde4012eb05674e2b100eb985de79db86573f4 (patch)
treee92d1266fdca29f9c5b6ecdf9b947eaf77c4a085 /src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
parentb99f0c75f7e74e65dfea667d19827df2bc69936e (diff)
Fills out some macOS support needed for the bundler.
This CL also changes some names from "MacOSX" to "macOS", such as the command line options, internal constants/enum values, and platform constants that are accessible from Skylark but are not let being used. It also adds some flags that are needed for completeness, like macos_minimum_os and macos_cpus. This change intentionally omits a few reference (such as "default_macosx_sdk_version" in "xcode_version") that are currently used in BUILD files in order to prevent those from breaking--I'll try to attack those later. This CL also does *not* add compiling/linking support for macOS. -- PiperOrigin-RevId: 146250799 MOS_MIGRATED_REVID=146250799
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
index 86620b4f2d..e074d2096e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
@@ -103,7 +103,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
private final DottedVersion watchosMinimumOs;
private final DottedVersion tvosSdkVersion;
private final DottedVersion tvosMinimumOs;
- private final DottedVersion macosXSdkVersion;
+ private final DottedVersion macosSdkVersion;
+ private final DottedVersion macosMinimumOs;
private final String iosCpu;
private final String appleSplitCpu;
private final PlatformType applePlatformType;
@@ -111,6 +112,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
private final ImmutableList<String> iosMultiCpus;
private final ImmutableList<String> watchosCpus;
private final ImmutableList<String> tvosCpus;
+ private final ImmutableList<String> macosCpus;
private final AppleBitcodeMode bitcodeMode;
private final Label xcodeConfigLabel;
private final boolean enableAppleCrosstool;
@@ -124,7 +126,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
DottedVersion watchosMinimumOs,
DottedVersion tvosSdkVersion,
DottedVersion tvosMinimumOs,
- DottedVersion macosXSdkVersion) {
+ DottedVersion macosSdkVersion,
+ DottedVersion macosMinimumOs) {
this.iosSdkVersion = Preconditions.checkNotNull(iosSdkVersion, "iosSdkVersion");
this.iosMinimumOs = Preconditions.checkNotNull(appleOptions.iosMinimumOs, "iosMinimumOs");
this.watchosSdkVersion =
@@ -135,9 +138,9 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
Preconditions.checkNotNull(tvosSdkVersion, "tvOsSdkVersion");
this.tvosMinimumOs =
Preconditions.checkNotNull(tvosMinimumOs, "tvOsMinimumOs");
-
- this.macosXSdkVersion =
- Preconditions.checkNotNull(macosXSdkVersion, "macOsXSdkVersion");
+ this.macosSdkVersion =
+ Preconditions.checkNotNull(macosSdkVersion, "macOsSdkVersion");
+ this.macosMinimumOs = Preconditions.checkNotNull(macosMinimumOs, "macOsMinimumOs");
this.xcodeVersion = xcodeVersion;
this.iosCpu = Preconditions.checkNotNull(appleOptions.iosCpu, "iosCpu");
@@ -153,6 +156,9 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
this.tvosCpus = (appleOptions.tvosCpus == null || appleOptions.tvosCpus.isEmpty())
? ImmutableList.of(AppleCommandLineOptions.DEFAULT_TVOS_CPU)
: ImmutableList.copyOf(appleOptions.tvosCpus);
+ this.macosCpus = (appleOptions.macosCpus == null || appleOptions.macosCpus.isEmpty())
+ ? ImmutableList.of(AppleCommandLineOptions.DEFAULT_MACOS_CPU)
+ : ImmutableList.copyOf(appleOptions.macosCpus);
this.bitcodeMode = appleOptions.appleBitcodeMode;
this.xcodeConfigLabel =
Preconditions.checkNotNull(appleOptions.xcodeVersionConfig, "xcodeConfigLabel");
@@ -185,6 +191,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
return tvosMinimumOs;
case WATCHOS:
return watchosMinimumOs;
+ case MACOS:
+ return macosMinimumOs;
default:
throw new IllegalArgumentException("Unhandled platform: " + platformType);
}
@@ -217,8 +225,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
case WATCHOS_DEVICE:
case WATCHOS_SIMULATOR:
return watchosSdkVersion;
- case MACOS_X:
- return macosXSdkVersion;
+ case MACOS:
+ return macosSdkVersion;
}
throw new AssertionError();
@@ -344,7 +352,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
return watchosCpus.get(0);
case TVOS:
return tvosCpus.get(0);
- // TODO(cparsons): Handle all platform types.
+ case MACOS:
+ return macosCpus.get(0);
default:
throw new IllegalArgumentException("Unhandled platform type " + applePlatformType);
}
@@ -388,6 +397,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
return watchosCpus;
case TVOS:
return tvosCpus;
+ case MACOS:
+ return macosCpus;
default:
throw new IllegalArgumentException("Unhandled platform type " + platformType);
}
@@ -446,6 +457,8 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
}
}
return Platform.TVOS_SIMULATOR;
+ case MACOS:
+ return Platform.MACOS;
default:
throw new IllegalArgumentException("Unsupported platform type " + platformType);
}
@@ -588,7 +601,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
.put("ios_sdk_version", iosSdkVersion)
.put("tvos_sdk_version", tvosSdkVersion)
.put("watchos_sdk_version", watchosSdkVersion)
- .put("macosx_sdk_version", macosXSdkVersion)
+ .put("macos_sdk_version", macosSdkVersion)
.build();
}
@@ -614,12 +627,14 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
? appleOptions.tvOsSdkVersion : xcodeVersionProperties.getDefaultTvosSdkVersion();
DottedVersion tvosMinimumOsVersion = (appleOptions.tvosMinimumOs != null)
? appleOptions.tvosMinimumOs : tvosSdkVersion;
- DottedVersion macosxSdkVersion = (appleOptions.macOsXSdkVersion != null)
- ? appleOptions.macOsXSdkVersion : xcodeVersionProperties.getDefaultMacosxSdkVersion();
+ DottedVersion macosSdkVersion = (appleOptions.macOsSdkVersion != null)
+ ? appleOptions.macOsSdkVersion : xcodeVersionProperties.getDefaultMacosSdkVersion();
+ DottedVersion macosMinimumOsVersion = (appleOptions.macosMinimumOs != null)
+ ? appleOptions.macosMinimumOs : macosSdkVersion;
AppleConfiguration configuration =
new AppleConfiguration(appleOptions, xcodeVersionProperties.getXcodeVersion().orNull(),
iosSdkVersion, watchosSdkVersion, watchosMinimumOsVersion,
- tvosSdkVersion, tvosMinimumOsVersion, macosxSdkVersion);
+ tvosSdkVersion, tvosMinimumOsVersion, macosSdkVersion, macosMinimumOsVersion);
validate(configuration);
return configuration;