diff options
author | 2017-10-10 09:38:47 +0200 | |
---|---|---|
committer | 2017-10-10 11:24:50 +0200 | |
commit | 95ee9cb0f1eeb96787387e8dbdb35eb6172b665f (patch) | |
tree | 98106d14ac6c2e423409dc562488612f8c34826c /src/main/java/com/google/devtools/build/lib/rules/apple | |
parent | d8a5753a8ce1d9cb6604c325836683f3325e42eb (diff) |
if --experimental_apple_mandatory_minimum_version is specified, make Apple rules only add the minimum version of the OS to the output directory name if the configuration is behind an AppleBinaryTransition, or if a minimum_os flag (such as --ios_minimum_os) is specified on the command line.
This is necessary so that the only time the minimum OS version affects the output directory name is when it's explicitly specified and therefore is accessible without looking at the xcode_config rule.
Progress towards #3424.
RELNOTES: None.
PiperOrigin-RevId: 171641295
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/apple')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java | 13 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java index 71c8508f65..c6ea84be26 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java @@ -388,6 +388,19 @@ public class AppleCommandLineOptions extends FragmentOptions { public boolean targetUsesAppleCrosstool; /** + * Returns whether the minimum OS version is explicitly set for the current platform. + */ + public boolean isMinimumOsVersionExplicitlySet() { + switch (applePlatformType) { + case IOS: return iosMinimumOs != null; + case MACOS: return macosMinimumOs != null; + case TVOS: return tvosMinimumOs != null; + case WATCHOS: return watchosMinimumOs != null; + default: throw new IllegalStateException(); + } + } + + /** * Returns the architecture implied by these options. * * <p> In contexts in which a configuration instance is present, prefer 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 d8cc719737..9ef221822f 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 @@ -590,7 +590,10 @@ public class AppleConfiguration extends BuildConfiguration.Fragment { if (!appleSplitCpu.isEmpty()) { components.add(applePlatformType.toString().toLowerCase()); components.add(appleSplitCpu); - components.add("min" + getMinimumOsForPlatformType(applePlatformType)); + + if (!isMandatoryMinimumVersion() || options.isMinimumOsVersionExplicitlySet()) { + components.add("min" + getMinimumOsForPlatformType(applePlatformType)); + } } if (shouldDistinguishOutputDirectory()) { components.add(configurationDistinguisher.getFileSystemName()); |