From ab5f233e572ed5d774a2830f82e3142672b4728d Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 11 Dec 2017 15:32:29 -0800 Subject: Removes skyframe/serialization's dependency on cmdline and vfs. Instead, make cmdline and vfs depend on serialization. This allows a class to have a pointer to its codec, which simplifies automatic recursive composite codecs. PiperOrigin-RevId: 178683500 --- .../lib/rules/apple/AppleCommandLineOptions.java | 74 ++++++++++------------ 1 file changed, 34 insertions(+), 40 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java') 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 14fb440670..73a54fc9f1 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 @@ -25,11 +25,11 @@ import com.google.devtools.build.lib.analysis.config.BuildConfiguration.DefaultL import com.google.devtools.build.lib.analysis.config.BuildConfiguration.LabelConverter; import com.google.devtools.build.lib.analysis.config.FragmentOptions; import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.cmdline.LabelCodec; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher; import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType; import com.google.devtools.build.lib.skyframe.serialization.EnumCodec; -import com.google.devtools.build.lib.skyframe.serialization.LabelCodec; import com.google.devtools.build.lib.skyframe.serialization.SerializationException; import com.google.devtools.build.lib.skyframe.serialization.strings.StringCodecs; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; @@ -47,9 +47,7 @@ import com.google.protobuf.CodedOutputStream; import java.io.IOException; import java.util.List; -/** - * Command-line options for building for Apple platforms. - */ +/** Command-line options for building for Apple platforms. */ public class AppleCommandLineOptions extends FragmentOptions { @Option( @@ -57,7 +55,7 @@ public class AppleCommandLineOptions extends FragmentOptions { defaultValue = "false", category = "experimental", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = { OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS }, + effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS}, help = "Whether Apple rules must have a mandatory minimum_os_version attribute." ) // TODO(b/37096178): This flag should be default-on and then be removed. @@ -68,9 +66,10 @@ public class AppleCommandLineOptions extends FragmentOptions { defaultValue = "true", category = "experimental", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = { OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS }, - help = "Whether Apple rules which control linking should propagate objc provider at the top " - + "level" + effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS}, + help = + "Whether Apple rules which control linking should propagate objc provider at the top " + + "level" ) // TODO(b/32411441): This flag should be default-off and then be removed. public boolean objcProviderFromLinked; @@ -181,19 +180,13 @@ public class AppleCommandLineOptions extends FragmentOptions { @VisibleForTesting public static final String DEFAULT_TVOS_SDK_VERSION = "9.0"; @VisibleForTesting static final String DEFAULT_IOS_CPU = "x86_64"; - /** - * The default watchos CPU value. - */ + /** The default watchos CPU value. */ public static final String DEFAULT_WATCHOS_CPU = "i386"; - /** - * The default tvOS CPU value. - */ + /** The default tvOS CPU value. */ public static final String DEFAULT_TVOS_CPU = "x86_64"; - /** - * The default macOS CPU value. - */ + /** The default macOS CPU value. */ public static final String DEFAULT_MACOS_CPU = "x86_64"; @Option( @@ -387,24 +380,27 @@ public class AppleCommandLineOptions extends FragmentOptions { ) public boolean targetUsesAppleCrosstool; - /** - * Returns whether the minimum OS version is explicitly set for the current platform. - */ + /** Returns whether the minimum OS version is explicitly set for the current platform. */ public DottedVersion getMinimumOsVersion() { switch (applePlatformType) { - case IOS: return iosMinimumOs; - case MACOS: return macosMinimumOs; - case TVOS: return tvosMinimumOs; - case WATCHOS: return watchosMinimumOs; - default: throw new IllegalStateException(); + case IOS: + return iosMinimumOs; + case MACOS: + return macosMinimumOs; + case TVOS: + return tvosMinimumOs; + case WATCHOS: + return watchosMinimumOs; + default: + throw new IllegalStateException(); } } /** * Returns the architecture implied by these options. * - *

In contexts in which a configuration instance is present, prefer - * {@link AppleConfiguration#getSingleArchitecture}. + *

In contexts in which a configuration instance is present, prefer {@link + * AppleConfiguration#getSingleArchitecture}. */ public String getSingleArchitecture() { if (!Strings.isNullOrEmpty(appleSplitCpu)) { @@ -440,12 +436,13 @@ public class AppleCommandLineOptions extends FragmentOptions { @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:

" + doc = + "The Bitcode mode to use when compiling Objective-C and Swift code on Apple platforms. " + + "Possible values are:
" ) @Immutable public enum AppleBitcodeMode implements SkylarkValue { @@ -488,16 +485,14 @@ public class AppleCommandLineOptions extends FragmentOptions { } /** - * Returns the flags that should be added to compile and link actions to use this - * bitcode setting. + * Returns the flags that should be added to compile and link actions to use this bitcode + * setting. */ public ImmutableList getCompileAndLinkFlags() { return clangFlags; } - /** - * Converts to {@link AppleBitcodeMode}. - */ + /** Converts to {@link AppleBitcodeMode}. */ public static class Converter extends EnumConverter { public Converter() { super(AppleBitcodeMode.class, "apple bitcode mode"); @@ -597,8 +592,7 @@ public class AppleCommandLineOptions extends FragmentOptions { } /** Flag converter for {@link PlatformType}. */ - public static final class PlatformTypeConverter - extends EnumConverter { + public static final class PlatformTypeConverter extends EnumConverter { public PlatformTypeConverter() { super(PlatformType.class, "Apple platform type"); } -- cgit v1.2.3