diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java | 59 |
1 files changed, 33 insertions, 26 deletions
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 { |