Skip to content

Commit

Permalink
Fix capitalization of Apple platforms, Xcode, “SDK”, and “OS”
Browse files Browse the repository at this point in the history
Closes #21896.

PiperOrigin-RevId: 622960551
Change-Id: I14efe7076170cc5828464196dbbeec70d245d50c
  • Loading branch information
brentleyjones authored and Copybara-Service committed Apr 8, 2024
1 parent 3e55b1d commit 6288eb9
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 99 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ public enum WorkerProtocolFormat {
*/
public static final String GRACEFUL_TERMINATION = "supports-graceful-termination";

/** Requires the execution service to support a given xcode version e.g. "xcode_version:1.0". */
/** Requires the execution service to support a given Xcode version e.g. "xcode_version:1.0". */
public static final String REQUIRES_XCODE = "requires-xcode";

/**
* Requires the execution service to support a "label" in addition to the xcode version. The user
* Requires the execution service to support a "label" in addition to the Xcode version. The user
* specifies the label as a hyphenated extension to their requested version. For example, if the
* user requests "--xcode_version=1.0-unstable", the action request will include
* "requires-xcode-label:unstable" and "requires-xcode:1.0".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ImmutableMap<String, String> rewriteLocalEnv(
}

// Empty developer dir indicates to use the system default.
// TODO(bazel-team): Bazel's view of the xcode version and developer dir should be explicitly
// TODO(bazel-team): Bazel's view of the Xcode version and developer dir should be explicitly
// set for build hermeticity.
String developerDir = "";
if (containsXcodeVersion && !containsDeveloperDir) {
Expand All @@ -110,8 +110,8 @@ public ImmutableMap<String, String> rewriteLocalEnv(
* As this is a costly operation, always call {@link #getSdkRoot(String, String)} instead, which
* does caching.
*
* @param developerDir the value of {@code DEVELOPER_DIR} for the target version of xcode
* @param appleSdkPlatform the sdk platform; for example, {@code iPhoneOS}
* @param developerDir the value of {@code DEVELOPER_DIR} for the target version of Xcode
* @param appleSdkPlatform the SDK platform; for example, {@code iPhoneOS}
* @return an absolute path to the root of the target Apple SDK
* @throws IOException if there is an issue with obtaining the root from the spawned process,
* either because the SDK platform/version pair doesn't exist, or there was an unexpected
Expand Down Expand Up @@ -139,7 +139,7 @@ private static String querySdkRoot(String developerDir, String appleSdkPlatform)
String.format(
"xcrun failed with code %s.\n"
+ "This most likely indicates that the SDK platform [%s] is "
+ "unsupported for the target version of xcode.\n"
+ "unsupported for the target version of Xcode.\n"
+ "%s\n"
+ "stdout: %s"
+ "stderr: %s",
Expand Down Expand Up @@ -167,8 +167,8 @@ private static String querySdkRoot(String developerDir, String appleSdkPlatform)
* <p>This may delegate to {@link #querySdkRoot(String, String)} to obtain the path from external
* sources in the system. Values are cached in-memory throughout the lifetime of the Bazel server.
*
* @param developerDir the value of {@code DEVELOPER_DIR} for the target version of xcode
* @param appleSdkPlatform the sdk platform; for example, {@code iPhoneOS}
* @param developerDir the value of {@code DEVELOPER_DIR} for the target version of Xcode
* @param appleSdkPlatform the SDK platform; for example, {@code iPhoneOS}
* @return an absolute path to the root of the target Apple SDK
* @throws IOException if there is an issue with obtaining the root from the spawned process,
* either because the SDK platform/version pair doesn't exist, or there was an unexpected
Expand Down Expand Up @@ -217,10 +217,10 @@ public synchronized InterruptedException getCause() {
* caching.
*
* @param binTools the {@link BinTools}, used to locate the cache file
* @param version the xcode version number to look up
* @param version the Xcode version number to look up
* @return an absolute path to the root of the Xcode developer directory
* @throws IOException if there is an issue with obtaining the path from the spawned process,
* either because there is no installed xcode with the given version, or there was an
* either because there is no installed Xcode with the given version, or there was an
* unexpected issue finding or running the tool
*/
private static String queryDeveloperDir(BinTools binTools, DottedVersion version)
Expand All @@ -239,7 +239,7 @@ private static String queryDeveloperDir(BinTools binTools, DottedVersion version
message =
String.format(
"Running '%s %s' failed with code %s.\n"
+ "This most likely indicates that xcode version %s is not available on the "
+ "This most likely indicates that Xcode version %s is not available on the "
+ "host machine.\n"
+ "%s\n"
+ "stdout: %s\n"
Expand Down Expand Up @@ -268,18 +268,18 @@ private static String queryDeveloperDir(BinTools binTools, DottedVersion version
}

/**
* Returns the absolute root path of the xcode developer directory on the host system for the
* Returns the absolute root path of the Xcode developer directory on the host system for the
* given Xcode version.
*
* <p>This may delegate to {@link #queryDeveloperDir(Path, DottedVersion)} to obtain the path from
* external sources in the system. Values are cached in-memory throughout the lifetime of the
* Bazel server.
*
* @param binTools the {@link BinTools} path, used to locate the cache file
* @param version the xcode version number to look up
* @param version the Xcode version number to look up
* @return an absolute path to the root of the Xcode developer directory
* @throws IOException if there is an issue with obtaining the path from the spawned process,
* either because there is no installed xcode with the given version, or there was an
* either because there is no installed Xcode with the given version, or there was an
* unexpected issue finding or running the tool
*/
private static String getDeveloperDir(BinTools binTools, DottedVersion version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"Specifies the version of the iOS SDK to use to build iOS applications. "
+ "If unspecified, uses default iOS SDK version from 'xcode_version'.")
+ "If unspecified, uses the default iOS SDK version from 'xcode_version'.")
public DottedVersion.Option iosSdkVersion;

@Option(
Expand All @@ -79,7 +79,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"Specifies the version of the watchOS SDK to use to build watchOS applications. "
+ "If unspecified, uses default watchOS SDK version from 'xcode_version'.")
+ "If unspecified, uses the default watchOS SDK version from 'xcode_version'.")
public DottedVersion.Option watchOsSdkVersion;

@Option(
Expand All @@ -90,7 +90,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"Specifies the version of the tvOS SDK to use to build tvOS applications. "
+ "If unspecified, uses default tvOS SDK version from 'xcode_version'.")
+ "If unspecified, uses the default tvOS SDK version from 'xcode_version'.")
public DottedVersion.Option tvOsSdkVersion;

@Option(
Expand All @@ -101,7 +101,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE},
help =
"Specifies the version of the macOS SDK to use to build macOS applications. "
+ "If unspecified, uses default macOS SDK version from 'xcode_version'.")
+ "If unspecified, uses the default macOS SDK version from 'xcode_version'.")
public DottedVersion.Option macOsSdkVersion;

@Option(
Expand Down Expand Up @@ -329,7 +329,7 @@ public class AppleCommandLineOptions extends FragmentOptions {
},
help =
"If set, add a \"requires-xcode:{version}\" execution requirement to every Xcode action."
+ " If the xcode version has a hyphenated label, also add a"
+ " If the Xcode version has a hyphenated label, also add a"
+ " \"requires-xcode-label:{version_label}\" execution requirement.")
public boolean includeXcodeExecutionRequirements;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@
public class AppleConfiguration extends Fragment implements AppleConfigurationApi<PlatformType> {
/** Environment variable name for the developer dir of the selected Xcode. */
public static final String DEVELOPER_DIR_ENV_NAME = "DEVELOPER_DIR";

/**
* 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
* 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
* toolkit in action execution.
*/
public static final String XCODE_VERSION_ENV_NAME = "XCODE_VERSION_OVERRIDE";

/**
* Environment variable name for the apple SDK version. If unset, uses the system default of the
* host for the platform in the value of {@link #APPLE_SDK_PLATFORM_ENV_NAME}.
Expand Down Expand Up @@ -214,7 +216,7 @@ public static ImmutableMap <String, String> appleTargetPlatformEnv(

/**
* Returns a map of environment variables that should be propagated for actions that require a
* version of xcode to be explicitly declared. Keys are variable names and values are their
* version of Xcode to be explicitly declared. Keys are variable names and values are their
* corresponding values.
*/
public static ImmutableMap<String, String> getXcodeVersionEnv(DottedVersion xcodeVersion) {
Expand Down Expand Up @@ -456,7 +458,7 @@ public boolean includeXcodeExecRequirementsFlag() throws EvalException {
}

/**
* Returns the label of the xcode_config rule to use for resolving the exec system xcode version.
* Returns the label of the xcode_config rule to use for resolving the exec system Xcode version.
*/
@StarlarkConfigurationField(
name = "xcode_config_label",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkThread;

/** The available xcode versions computed from the {@code available_xcodes} rule. */
/** The available Xcode versions computed from the {@code available_xcodes} rule. */
@Immutable
public class AvailableXcodesInfo extends NativeInfo {
/** Starlark name for this provider. */
Expand All @@ -47,7 +47,7 @@ public BuiltinProvider<AvailableXcodesInfo> getProvider() {
return PROVIDER;
}

/** Returns the available xcode versions from {@code available_xcodes}. */
/** Returns the available Xcode versions from {@code available_xcodes}. */
@StarlarkMethod(
name = "available_versions",
structField = true,
Expand All @@ -56,7 +56,7 @@ public Iterable<XcodeVersionRuleData> getAvailableVersions() {
return availableXcodes;
}

/** Returns the default xcode version from {@code available_xcodes}. */
/** Returns the default Xcode version from {@code available_xcodes}. */
@StarlarkMethod(
name = "default_version",
structField = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkThread;

/** A tuple containing information about a version of xcode and its properties. */
/** A tuple containing information about a version of Xcode and its properties. */
@Immutable
public class XcodeVersionProperties extends NativeInfo implements XcodePropertiesApi {
/** Starlark identifier for XcodeVersionProperties provider. */
Expand All @@ -51,10 +51,10 @@ public class XcodeVersionProperties extends NativeInfo implements XcodePropertie
private final DottedVersion defaultMacosSdkVersion;

/**
* Creates and returns a tuple representing no known xcode property information (defaults are used
* Creates and returns a tuple representing no known Xcode property information (defaults are used
* where applicable).
*/
// TODO(bazel-team): The xcode version should be a well-defined value, either specified by the
// TODO(bazel-team): The Xcode version should be a well-defined value, either specified by the
// user, evaluated on the local system, or set to a sensible default.
// Unfortunately, until the local system evaluation hook is created, this constraint would break
// some users.
Expand All @@ -67,7 +67,7 @@ public XcodeVersionProperties unknownXcodeVersionProperties(StarlarkThread threa
}

/**
* Constructor for when only the xcode version is specified, but no property information is
* Constructor for when only the Xcode version is specified, but no property information is
* specified.
*/
public XcodeVersionProperties(Object xcodeVersion) {
Expand Down Expand Up @@ -116,7 +116,7 @@ public Provider getProvider() {
return PROVIDER;
}

/** Returns the xcode version, or null if the xcode version is unknown. */
/** Returns the Xcode version, or null if the Xcode version is unknown. */
@Nullable
@Override
public String getXcodeVersionString() {
Expand All @@ -126,42 +126,42 @@ public String getXcodeVersionString() {
return null;
}

/** Returns the default ios sdk version to use if this xcode version is in use. */
/** Returns the default iOS SDK version to use if this Xcode version is in use. */
@Nullable
@Override
public String getDefaultIosSdkVersionString() {
return defaultIosSdkVersion != null ? defaultIosSdkVersion.toString() : null;
}

/** Returns the default visionOS sdk version to use if this xcode version is in use. */
/** Returns the default visionOS SDK version to use if this Xcode version is in use. */
@Nullable
@Override
public String getDefaultVisionosSdkVersionString() {
return defaultVisionosSdkVersion != null ? defaultVisionosSdkVersion.toString() : null;
}

/** Returns the default watchos sdk version to use if this xcode version is in use. */
/** Returns the default watchOS SDK version to use if this Xcode version is in use. */
@Nullable
@Override
public String getDefaultWatchosSdkVersionString() {
return defaultWatchosSdkVersion != null ? defaultWatchosSdkVersion.toString() : null;
}

/** Returns the default tvos sdk version to use if this xcode version is in use. */
/** Returns the default tvOS SDK version to use if this Xcode version is in use. */
@Nullable
@Override
public String getDefaultTvosSdkVersionString() {
return defaultTvosSdkVersion != null ? defaultTvosSdkVersion.toString() : null;
}

/** Returns the default macosx sdk version to use if this xcode version is in use. */
/** Returns the default macOS SDK version to use if this Xcode version is in use. */
@Nullable
@Override
public String getDefaultMacosSdkVersionString() {
return defaultMacosSdkVersion != null ? defaultMacosSdkVersion.toString() : null;
}

/** Returns the xcode version, or {@link Optional#absent} if the xcode version is unknown. */
/** Returns the Xcode version, or {@link Optional#absent} if the Xcode version is unknown. */
public Optional<DottedVersion> getXcodeVersion() {
return xcodeVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,41 +53,41 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(version) -->
Accepted aliases for this version of Xcode.
If the value of the <code>xcode_version</code> build flag matches any of the given
alias strings, this xcode version will be used.
alias strings, this Xcode version will be used.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(ALIASES_ATTR_NAME, STRING_LIST)
.nonconfigurable("this rule determines configuration"))

/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(default_ios_sdk_version) -->
The ios sdk version that is used by default when this version of xcode is being used.
The iOS SDK version that is used by default when this version of Xcode is being used.
The <code>ios_sdk_version</code> build flag will override the value specified here.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(DEFAULT_IOS_SDK_VERSION_ATTR_NAME, STRING)
.nonconfigurable("this rule determines configuration"))
/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(default_visionos_sdk_version) -->
The visionos sdk version that is used by default when this version of xcode is being used.
The visionOS SDK version that is used by default when this version of Xcode is being used.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(DEFAULT_VISIONOS_SDK_VERSION_ATTR_NAME, STRING)
.nonconfigurable("this rule determines configuration"))
/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(default_watchos_sdk_version) -->
The watchos sdk version that is used by default when this version of xcode is being used.
The watchOS SDK version that is used by default when this version of Xcode is being used.
The <code>watchos_sdk_version</code> build flag will override the value specified here.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(DEFAULT_WATCHOS_SDK_VERSION_ATTR_NAME, STRING)
.nonconfigurable("this rule determines configuration"))
/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(default_tvos_sdk_version) -->
The tvos sdk version that is used by default when this version of xcode is being used.
The tvOS SDK version that is used by default when this version of Xcode is being used.
The <code>tvos_sdk_version</code> build flag will override the value specified here.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr(DEFAULT_TVOS_SDK_VERSION_ATTR_NAME, STRING)
.nonconfigurable("this rule determines configuration"))
/* <!-- #BLAZE_RULE(xcode_version).ATTRIBUTE(default_macos_sdk_version) -->
The macosx sdk version that is used by default when this version of xcode is being used.
The macOS SDK version that is used by default when this version of Xcode is being used.
The <code>macos_sdk_version</code> build flag will override the value specified here.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
Expand All @@ -108,7 +108,7 @@ public Metadata getMetadata() {

/*<!-- #BLAZE_RULE (NAME = xcode_version, TYPE = OTHER, FAMILY = Objective-C) -->
<p>Represents a single official xcode version with acceptable aliases for that xcode version.
<p>Represents a single official Xcode version with acceptable aliases for that Xcode version.
See the <code>xcode_config</code> rule.</p>
<!-- #END_BLAZE_RULE -->*/
Loading

0 comments on commit 6288eb9

Please sign in to comment.