aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/apple
diff options
context:
space:
mode:
authorGravatar cparsons <cparsons@google.com>2018-05-25 14:55:00 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-25 14:56:16 -0700
commite29c1830c88822639b32a13bac659eea9e4587ac (patch)
tree56fa18bd6e37a5cea484db723dcfeea5f07cf4c0 /src/main/java/com/google/devtools/build/lib/rules/apple
parentf7dea27d9d01951f0c9f61728751943e8c1c4abd (diff)
Start migration of apple skylark build API
RELNOTES: None. PiperOrigin-RevId: 198107604
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.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java56
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java84
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java59
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfigProvider.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/apple/cpp/AppleCcToolchain.java2
8 files changed, 62 insertions, 202 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 da57b6ae74..42f6949455 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
@@ -29,10 +29,8 @@ import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec;
import com.google.devtools.build.lib.skyframe.serialization.SerializationContext;
import com.google.devtools.build.lib.skyframe.serialization.SerializationException;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleBitcodeModeApi;
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkValue;
import com.google.devtools.common.options.Converters.CommaSeparatedOptionListConverter;
import com.google.devtools.common.options.EnumConverter;
import com.google.devtools.common.options.Option;
@@ -402,19 +400,8 @@ public class AppleCommandLineOptions extends FragmentOptions {
* <p>This is a build-wide value, as bitcode mode needs to be consistent among a target and its
* compiled dependencies.
*/
- @SkylarkModule(
- name = "apple_bitcode_mode",
- category = SkylarkModuleCategory.NONE,
- doc =
- "The Bitcode mode to use when compiling Objective-C and Swift code on Apple platforms. "
- + "Possible values are:<br><ul>"
- + "<li><code>'none'</code></li>"
- + "<li><code>'embedded'</code></li>"
- + "<li><code>'embedded_markers'</code></li>"
- + "</ul>"
- )
@Immutable
- public enum AppleBitcodeMode implements SkylarkValue {
+ public enum AppleBitcodeMode implements AppleBitcodeModeApi {
/** Do not compile bitcode. */
NONE("none", ImmutableList.<String>of()),
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 55b9b01a1e..22333bb41a 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
@@ -32,22 +32,16 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions.AppleBitcodeMode;
import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleConfigurationApi;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
/** A configuration containing flags required for Apple platforms and tools. */
@AutoCodec
-@SkylarkModule(
- name = "apple",
- doc = "A configuration fragment for Apple platforms.",
- category = SkylarkModuleCategory.CONFIGURATION_FRAGMENT
-)
@Immutable
-public class AppleConfiguration extends BuildConfiguration.Fragment {
+public class AppleConfiguration extends BuildConfiguration.Fragment
+ implements AppleConfigurationApi<PlatformType> {
/**
* Environment variable name for the xcode version. The value of this environment variable should
* be set to the version (for example, "7.2") of xcode to use when invoking part of the apple
@@ -165,10 +159,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
* platform or cpu for all actions spawned in this configuration; it is appropriate for
* identifying the target cpu of iOS compile and link actions within this configuration.
*/
- @SkylarkCallable(
- name = "ios_cpu",
- doc = "<b>Deprecated. Use <a href='#single_arch_cpu'>single_arch_cpu</a> instead.</b> "
- + "The value of ios_cpu for this configuration.")
+ @Override
public String getIosCpu() {
return iosCpu;
}
@@ -190,15 +181,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
* <li>Use the default.
* </ol>
*/
- @SkylarkCallable(
- name = "single_arch_cpu",
- structField = true,
- doc =
- "The single \"effective\" architecture for this configuration (e.g., <code>i386</code> or "
- + "<code>arm64</code>) in the context of rule logic that is only concerned with a "
- + "single architecture (such as <code>objc_library</code>, which registers "
- + "single-architecture compile actions)."
- )
+ @Override
public String getSingleArchitecture() {
if (!Strings.isNullOrEmpty(appleSplitCpu)) {
return appleSplitCpu;
@@ -272,13 +255,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
* the context of rule logic which is only concerned with a single architecture (such as in {@code
* objc_library}, which registers single-architecture compile actions).
*/
- @SkylarkCallable(
- name = "single_arch_platform",
- doc = "The platform of the current configuration. This should only be invoked in a context "
- + "where only a single architecture may be supported; consider "
- + "<a href='#multi_arch_platform'>multi_arch_platform</a> for other cases.",
- structField = true
- )
+ @Override
public ApplePlatform getSingleArchPlatform() {
return ApplePlatform.forTarget(applePlatformType, getSingleArchitecture());
}
@@ -296,12 +273,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
* Otherwise, this will return a simulator platform.
*/
// TODO(bazel-team): This should support returning multiple platforms.
- @SkylarkCallable(
- name = "multi_arch_platform",
- doc = "The platform of the current configuration for the given platform type. This should only "
- + "be invoked in a context where multiple architectures may be supported; consider "
- + "<a href='#single_arch_platform'>single_arch_platform</a> for other cases."
- )
+ @Override
public ApplePlatform getMultiArchPlatform(PlatformType platformType) {
List<String> architectures = getMultiArchitectures(platformType);
switch (platformType) {
@@ -342,11 +314,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
* #getMultiArchPlatform(PlatformType)}.
*/
// TODO(b/28754442): Deprecate for more general skylark-exposed platform retrieval.
- @SkylarkCallable(
- name = "ios_cpu_platform",
- doc = "<b>Deprecated. Use <a href='#single_arch_platform'>single_arch_platform</a> or "
- + "<a href='#multi_arch_platform'>multi_arch_platform</a> instead.</b> "
- + "The platform given by the ios_cpu flag.")
+ @Override
public ApplePlatform getIosCpuPlatform() {
return ApplePlatform.forTarget(PlatformType.IOS, iosCpu);
}
@@ -393,13 +361,7 @@ public class AppleConfiguration extends BuildConfiguration.Fragment {
*
* @see AppleBitcodeMode
*/
- @SkylarkCallable(
- name = "bitcode_mode",
- doc = "Returns the Bitcode mode to use for compilation steps.<p>"
- + "This field is only valid for device builds; for simulator builds, it always returns "
- + "<code>'none'</code>.",
- structField = true
- )
+ @Override
public AppleBitcodeMode getBitcodeMode() {
if (hasValidSingleArchPlatform() && getSingleArchPlatform().isDevice()) {
return bitcodeMode;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java b/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java
index cc8fb96b30..561843acb0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java
@@ -22,45 +22,16 @@ import com.google.devtools.build.lib.packages.Info;
import com.google.devtools.build.lib.packages.NativeProvider;
import com.google.devtools.build.lib.packages.Provider;
import com.google.devtools.build.lib.packages.SkylarkInfo;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.ApplePlatformApi;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.ApplePlatformTypeApi;
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkValue;
import java.util.HashMap;
import java.util.Locale;
import javax.annotation.Nullable;
/** An enum that can be used to distinguish between various apple platforms. */
-@SkylarkModule(
- name = "apple_platform",
- category = SkylarkModuleCategory.NONE,
- doc = "Corresponds to Xcode's notion of a platform as would be found in "
- + "<code>Xcode.app/Contents/Developer/Platforms</code>. Each platform represents an Apple "
- + "platform type (such as iOS or tvOS) combined with one or more related CPU "
- + "architectures. For example, the iOS simulator platform supports <code>x86_64</code> and "
- + "<code>i386</code> architectures.<p>"
- + "Specific instances of this type can be retrieved from the fields of the "
- + "<a href='apple_common.html#platform'>apple_common.platform</a> struct:<br><ul>"
- + "<li><code>apple_common.platform.ios_device</code></li>"
- + "<li><code>apple_common.platform.ios_simulator</code></li>"
- + "<li><code>apple_common.platform.macos</code></li>"
- + "<li><code>apple_common.platform.tvos_device</code></li>"
- + "<li><code>apple_common.platform.tvos_simulator</code></li>"
- + "<li><code>apple_common.platform.watchos_device</code></li>"
- + "<li><code>apple_common.platform.watchos_simulator</code></li>"
- + "</ul><p>"
- + "More commonly, however, the <a href='apple.html'>apple</a> configuration fragment has "
- + "fields/methods that allow rules to determine the platform for which a target is being "
- + "built.<p>"
- + "Example:<br>"
- + "<pre class='language-python'>\n"
- + "p = apple_common.platform.ios_device\n"
- + "print(p.name_in_plist) # 'iPhoneOS'\n"
- + "</pre>"
-)
@Immutable
-public enum ApplePlatform implements SkylarkValue {
+public enum ApplePlatform implements ApplePlatformApi {
IOS_DEVICE("ios_device", "iPhoneOS", PlatformType.IOS, true),
IOS_SIMULATOR("ios_simulator", "iPhoneSimulator", PlatformType.IOS, false),
MACOS("macos", "MacOSX", PlatformType.MACOS, true),
@@ -100,40 +71,17 @@ public enum ApplePlatform implements SkylarkValue {
this.isDevice = isDevice;
}
- /** Returns the platform type of this platform. */
- @SkylarkCallable(
- name = "platform_type",
- doc = "Returns the platform type of this platform.",
- structField = true
- )
+ @Override
public PlatformType getType() {
return platformType;
}
- /**
- * Returns true if this platform is a device platform, or false if this is a simulator platform.
- */
- @SkylarkCallable(
- name = "is_device",
- doc = "Returns <code>True</code> if this platform is a device platform or <code>False</code> "
- + "if it is a simulator platform.",
- structField = true
- )
+ @Override
public boolean isDevice() {
return isDevice;
}
- /**
- * Returns the name of the "platform" as it appears in the CFBundleSupportedPlatforms plist
- * setting.
- */
- @SkylarkCallable(name = "name_in_plist", structField = true,
- doc = "The name of the platform as it appears in the <code>CFBundleSupportedPlatforms</code> "
- + "entry of an Info.plist file and in Xcode's platforms directory, without the extension "
- + "(for example, <code>iPhoneOS</code> or <code>iPhoneSimulator</code>).<br>"
- + "This name, when converted to lowercase (e.g., <code>iphoneos</code>, "
- + "<code>iphonesimulator</code>), can be passed to Xcode's command-line tools like "
- + "<code>ibtool</code> and <code>actool</code> when they expect a platform name.")
+ @Override
public String getNameInPlist() {
return nameInPlist;
}
@@ -246,26 +194,8 @@ public enum ApplePlatform implements SkylarkValue {
* platform type (for example, watchOS) together with a cpu value (for example, armv7).
*/
// TODO(cparsons): Use these values in static retrieval methods in this class.
- @SkylarkModule(
- name = "apple_platform_type",
- category = SkylarkModuleCategory.NONE,
- doc = "Describes an Apple \"platform type\", such as iOS, macOS, tvOS, or watchOS. This is "
- + "distinct from a \"platform\", which is the platform type combined with one or more CPU "
- + "architectures.<p>"
- + "Specific instances of this type can be retrieved by accessing the fields of the "
- + "<a href='apple_common.html#platform_type'>apple_common.platform_type</a>:<br><ul>"
- + "<li><code>apple_common.platform_type.ios</code></li>"
- + "<li><code>apple_common.platform_type.macos</code></li>"
- + "<li><code>apple_common.platform_type.tvos</code></li>"
- + "<li><code>apple_common.platform_type.watchos</code></li>"
- + "</ul><p>"
- + "Likewise, the platform type of an existing platform value can be retrieved using its "
- + "<code>platform_type</code> field.<p>"
- + "Platform types can be converted to a lowercase string (e.g., <code>ios</code> or "
- + "<code>macos</code>) using the <a href='globals.html#str'>str</a> function."
- )
@Immutable
- public enum PlatformType implements SkylarkValue {
+ public enum PlatformType implements ApplePlatformTypeApi {
IOS("ios"),
WATCHOS("watchos"),
TVOS("tvos"),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
index cf6cbf5be6..21e3ffba45 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
@@ -27,18 +27,13 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.Attribute.LabelLateBoundDefault;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleToolchainApi;
/**
* Utility class for resolving items for the Apple toolchain (such as common tool flags, and paths).
*/
-@SkylarkModule(
- name = "apple_toolchain",
- doc = "Utilities for resolving items from the Apple toolchain."
-)
@Immutable
-public class AppleToolchain {
+public class AppleToolchain implements AppleToolchainApi<AppleConfiguration> {
// These next two strings are shared secrets with the xcrunwrapper.sh to allow
// expansion of DeveloperDir and SDKRoot and runtime, since they aren't known
@@ -82,10 +77,6 @@ public class AppleToolchain {
/**
* Returns the platform directory inside of Xcode for a given configuration.
*/
- @SkylarkCallable(
- name = "sdk_dir",
- doc = "Returns the platform directory inside of Xcode for a given configuration."
- )
public static String sdkDir() {
return SDKROOT_DIR;
}
@@ -93,31 +84,23 @@ public class AppleToolchain {
/**
* Returns the Developer directory inside of Xcode for a given configuration.
*/
- @SkylarkCallable(
- name = "developer_dir",
- doc = "Returns the Developer directory inside of Xcode for a given configuration."
- )
public static String developerDir() {
return DEVELOPER_DIR;
}
/**
- * Returns the platform frameworks directory inside of Xcode for a given {@link ApplePlatform}.
+ * Returns the platform frameworks directory inside of Xcode for a given configuration.
*/
- public static String platformDeveloperFrameworkDir(ApplePlatform platform) {
- String platformDir = platformDir(platform.getNameInPlist());
- return platformDir + "/Developer/Library/Frameworks";
+ public static String platformDeveloperFrameworkDir(AppleConfiguration configuration) {
+ return platformDeveloperFrameworkDir(configuration.getSingleArchPlatform());
}
/**
- * Returns the platform frameworks directory inside of Xcode for a given configuration.
+ * Returns the platform frameworks directory inside of Xcode for a given {@link ApplePlatform}.
*/
- @SkylarkCallable(
- name = "platform_developer_framework_dir",
- doc = "Returns the platform frameworks directory inside of Xcode for a given configuration."
- )
- public static String platformFrameworkDirFromConfig(AppleConfiguration configuration) {
- return platformDeveloperFrameworkDir(configuration.getSingleArchPlatform());
+ public static String platformDeveloperFrameworkDir(ApplePlatform platform) {
+ String platformDir = platformDir(platform.getNameInPlist());
+ return platformDir + "/Developer/Library/Frameworks";
}
/** Returns the SDK frameworks directory inside of Xcode for a given configuration. */
@@ -157,6 +140,30 @@ public class AppleToolchain {
}
/**
+ * Returns the platform directory inside of Xcode for a given configuration.
+ */
+ @Override
+ public String sdkDirConstant() {
+ return sdkDir();
+ }
+
+ /**
+ * Returns the Developer directory inside of Xcode for a given configuration.
+ */
+ @Override
+ public String developerDirConstant() {
+ return developerDir();
+ }
+
+ /**
+ * Returns the platform frameworks directory inside of Xcode for a given configuration.
+ */
+ @Override
+ public String platformFrameworkDirFromConfig(AppleConfiguration configuration) {
+ return platformDeveloperFrameworkDir(configuration);
+ }
+
+ /**
* Base rule definition to be ancestor for rules which may require an xcode toolchain.
*/
public static class RequiresXcodeConfigRule implements RuleDefinition {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/BUILD b/src/main/java/com/google/devtools/build/lib/rules/apple/BUILD
index 4ad39bc4f1..d03e842b13 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/BUILD
@@ -23,6 +23,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization",
"//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec",
+ "//src/main/java/com/google/devtools/build/lib/skylarkbuildapi/apple",
"//src/main/java/com/google/devtools/common/options",
"//third_party:guava",
"//third_party:jsr305",
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
index 189462e947..9919ff757d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
@@ -22,11 +22,8 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Ordering;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.DottedVersionApi;
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkValue;
import java.util.ArrayList;
import java.util.Objects;
import java.util.regex.Matcher;
@@ -72,16 +69,9 @@ import javax.annotation.Nullable;
*
* <p>This class is immutable and can safely be shared among threads.
*/
-@SkylarkModule(
- name = "DottedVersion",
- category = SkylarkModuleCategory.NONE,
- doc =
- "A value representing a version with multiple components, separated by periods, such as "
- + "1.2.3.4."
-)
@Immutable
@AutoCodec
-public final class DottedVersion implements Comparable<DottedVersion>, SkylarkValue {
+public final class DottedVersion implements DottedVersionApi<DottedVersion> {
private static final Splitter DOT_SPLITTER = Splitter.on('.');
private static final Pattern COMPONENT_PATTERN = Pattern.compile("(\\d+)(?:([a-z]+)(\\d*))?");
private static final String ILLEGAL_VERSION =
@@ -173,12 +163,7 @@ public final class DottedVersion implements Comparable<DottedVersion>, SkylarkVa
return 0;
}
- @SkylarkCallable(
- name = "compare_to",
- doc =
- "Compares based on most significant (first) not-matching version component. "
- + "So, for example, 1.2.3 < 1.2.4"
- )
+ @Override
public int compareTo_skylark(DottedVersion other) {
return compareTo(other);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfigProvider.java b/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfigProvider.java
index 50db482da5..589d6599e4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfigProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/XcodeConfigProvider.java
@@ -19,18 +19,15 @@ import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTa
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.packages.NativeProvider;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.XcodeConfigProviderApi;
import javax.annotation.Nullable;
/**
* The set of Apple versions computed from command line options and the {@code xcode_config} rule.
*/
@Immutable
-@SkylarkModule(
- name = XcodeConfigProvider.SKYLARK_NAME,
- doc = "The set of Apple versions computed from command line options and the xcode_config rule.")
-public class XcodeConfigProvider extends NativeInfo {
+public class XcodeConfigProvider extends NativeInfo
+ implements XcodeConfigProviderApi<ApplePlatform, ApplePlatform.PlatformType> {
/** Skylark name for this provider. */
public static final String SKYLARK_NAME = "XcodeVersionConfig";
@@ -66,18 +63,12 @@ public class XcodeConfigProvider extends NativeInfo {
this.xcodeVersion = xcodeVersion;
}
- @SkylarkCallable(name = "xcode_version",
- doc = "Returns the Xcode version that is being used to build.<p>"
- + "This will return <code>None</code> if no Xcode versions are available.",
- allowReturnNones = true)
+ @Override
public DottedVersion getXcodeVersion() {
return xcodeVersion;
}
- @SkylarkCallable(
- name = "minimum_os_for_platform_type",
- doc = "The minimum compatible OS version for target simulator and devices for a particular "
- + "platform type.")
+ @Override
public DottedVersion getMinimumOsForPlatformType(ApplePlatform.PlatformType platformType) {
// TODO(b/37240784): Look into using only a single minimum OS flag tied to the current
// apple_platform_type.
@@ -95,10 +86,7 @@ public class XcodeConfigProvider extends NativeInfo {
}
}
- @SkylarkCallable(
- name = "sdk_version_for_platform",
- doc = "The version of the platform SDK that will be used to build targets for the given "
- + "platform.")
+ @Override
public DottedVersion getSdkVersionForPlatform(ApplePlatform platform) {
switch (platform) {
case IOS_DEVICE:
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/cpp/AppleCcToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/apple/cpp/AppleCcToolchain.java
index 1f14012e5f..dbe364e662 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/cpp/AppleCcToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/cpp/AppleCcToolchain.java
@@ -96,7 +96,7 @@ public class AppleCcToolchain extends CcToolchain {
SDK_FRAMEWORK_DIR_KEY, AppleToolchain.sdkFrameworkDir(platform, ruleContext))
.addStringVariable(
PLATFORM_DEVELOPER_FRAMEWORK_DIR,
- AppleToolchain.platformFrameworkDirFromConfig(appleConfiguration))
+ AppleToolchain.platformDeveloperFrameworkDir(appleConfiguration))
.addStringVariable(
XCODE_VERISON_OVERRIDE_VALUE_KEY,
appleEnv.getOrDefault(AppleConfiguration.XCODE_VERSION_ENV_NAME, ""))