apple_common.platform_type.ios
"
+ "apple_common.platform_type.macos
"
+ "apple_common.platform_type.tvos
"
+ + "apple_common.platform_type.visionos
"
+ "apple_common.platform_type.watchos
Likewise, the"
+ " platform type of an existing platform value can be retrieved using its"
+ " platform_type
field.
Platform types can be converted to a lowercase"
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodeConfigInfoApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodeConfigInfoApi.java
index 781b5aa3b86160..8229f03ac5b423 100644
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodeConfigInfoApi.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodeConfigInfoApi.java
@@ -103,6 +103,16 @@ interface XcodeConfigProviderApi extends ProviderApi {
named = true,
positional = false,
doc = "The ios minimum os version."),
+ @Param(
+ name = "visionosSdkVersion",
+ named = true,
+ positional = false,
+ doc = "The visionOS SDK version."),
+ @Param(
+ name = "visionosMinimumOsVersion",
+ named = true,
+ positional = false,
+ doc = "The visionOS minimum os version."),
@Param(
name = "watchosSdkVersion",
named = true,
@@ -144,6 +154,8 @@ interface XcodeConfigProviderApi extends ProviderApi {
XcodeConfigInfoApi, ?> xcodeConfigInfo(
String iosSdkVersion,
String iosMinimumOsVersion,
+ String visionosSdkVersion,
+ String visionosMinimumOsVersion,
String watchosSdkVersion,
String watchosMinimumOsVersion,
String tvosSdkVersion,
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodePropertiesApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodePropertiesApi.java
index 4ad4b565dbe5f8..bedfbb42da2d7b 100644
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodePropertiesApi.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/XcodePropertiesApi.java
@@ -45,6 +45,16 @@ public interface XcodePropertiesApi extends StructApi {
@Nullable
String getDefaultIosSdkVersionString();
+ @StarlarkMethod(
+ name = "default_visionos_sdk_version",
+ doc =
+ "The default visionOS sdk version for this version of xcode, or None
if "
+ + "unknown.",
+ structField = true,
+ allowReturnNones = true)
+ @Nullable
+ String getDefaultVisionosSdkVersionString();
+
@StarlarkMethod(
name = "default_watchos_sdk_version",
doc =
diff --git a/src/main/protobuf/spawn.proto b/src/main/protobuf/spawn.proto
index f11de34f13d177..5863f973424431 100644
--- a/src/main/protobuf/spawn.proto
+++ b/src/main/protobuf/spawn.proto
@@ -41,6 +41,10 @@ message File {
// Digest of the file's contents.
Digest digest = 2;
+
+ // Whether the file is a tool.
+ // Only set for inputs, never for outputs.
+ bool is_tool = 3;
}
// Contents of command environment.
@@ -185,3 +189,17 @@ message SpawnExec {
// Timing, size and memory statistics.
SpawnMetrics metrics = 20;
}
+
+// Additional information that should be taken into account when
+// computing the key of an action, thereby ensuring that actions remain
+// distinct.
+message CacheSalt {
+ // Whether or not the action may be executed remotely, if remote
+ // execution were to be enabled. This ensures that adding/removing the
+ // "no-remote-exec" tag from a target forces a local/remote rebuild.
+ bool may_be_executed_remotely = 1;
+
+ // Requires the execution service do NOT share caches across different
+ // workspace.
+ string workspace = 2;
+}
diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl
index 4beca92ef650c1..a657498cff4842 100644
--- a/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl
+++ b/src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl
@@ -33,6 +33,8 @@ _LINKING_STATIC = "static_linking_mode"
_IOS_SIMULATOR_TARGET_CPUS = ["ios_x86_64", "ios_i386", "ios_sim_arm64"]
_IOS_DEVICE_TARGET_CPUS = ["ios_armv6", "ios_arm64", "ios_armv7", "ios_armv7s", "ios_arm64e"]
+_VISIONOS_SIMULATOR_TARGET_CPUS = ["visionos_x86_64", "visionos_sim_arm64"]
+_VISIONOS_DEVICE_TARGET_CPUS = ["visionos_arm64"]
_WATCHOS_SIMULATOR_TARGET_CPUS = ["watchos_i386", "watchos_x86_64", "watchos_arm64"]
_WATCHOS_DEVICE_TARGET_CPUS = ["watchos_armv7k", "watchos_arm64_32"]
_TVOS_SIMULATOR_TARGET_CPUS = ["tvos_x86_64", "tvos_sim_arm64"]
@@ -555,7 +557,7 @@ def _report_invalid_options(ctx, cc_toolchain, cpp_config):
fail("The selected toolchain does not support setting --grte_top (it doesn't specify builtin_sysroot).")
def _is_apple_platform(target_cpu):
- if target_cpu in _IOS_SIMULATOR_TARGET_CPUS or target_cpu in _IOS_DEVICE_TARGET_CPUS or target_cpu in _WATCHOS_SIMULATOR_TARGET_CPUS or target_cpu in _WATCHOS_DEVICE_TARGET_CPUS or target_cpu in _TVOS_SIMULATOR_TARGET_CPUS or target_cpu in _TVOS_DEVICE_TARGET_CPUS or target_cpu in _CATALYST_TARGET_CPUS or target_cpu in _MACOS_TARGET_CPUS:
+ if target_cpu in _IOS_SIMULATOR_TARGET_CPUS or target_cpu in _IOS_DEVICE_TARGET_CPUS or target_cpu in _VISIONOS_SIMULATOR_TARGET_CPUS or target_cpu in _VISIONOS_DEVICE_TARGET_CPUS or target_cpu in _WATCHOS_SIMULATOR_TARGET_CPUS or target_cpu in _WATCHOS_DEVICE_TARGET_CPUS or target_cpu in _TVOS_SIMULATOR_TARGET_CPUS or target_cpu in _TVOS_DEVICE_TARGET_CPUS or target_cpu in _CATALYST_TARGET_CPUS or target_cpu in _MACOS_TARGET_CPUS:
return True
return False
diff --git a/src/main/starlark/builtins_bzl/common/objc/transitions.bzl b/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
index 88aec6da87282b..f886f5933b1448 100644
--- a/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
+++ b/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
@@ -37,6 +37,14 @@ def _determine_single_architecture(platform_type, settings):
if cpu_value == "darwin_arm64":
return "sim_arm64"
return DEFAULT_IOS_CPU
+ if platform_type == VISIONOS:
+ cpus = settings["//command_line_option:visionos_cpus"]
+ if len(cpus) > 0:
+ return cpus[0]
+ cpu_value = settings["//command_line_option:cpu"]
+ if cpu_value == "darwin_arm64":
+ return "sim_arm64"
+ return DEFAULT_VISIONOS_CPU
if platform_type == WATCHOS:
watchos_cpus = settings["//command_line_option:watchos_cpus"]
if len(watchos_cpus) == 0:
@@ -64,13 +72,16 @@ def _determine_single_architecture(platform_type, settings):
fail("ERROR: Unhandled platform type {}".format(platform_type))
IOS = "ios"
+VISIONOS = "visionos"
WATCHOS = "watchos"
TVOS = "tvos"
MACOS = "macos"
CATALYST = "catalyst"
IOS_CPU_PREFIX = "ios_"
+VISIONOS_CPU_PREFIX = "visionos_"
DARWIN_CPU_PREFIX = "darwin_"
DEFAULT_IOS_CPU = "x86_64"
+DEFAULT_VISIONOS_CPU = "x86_64"
DEFAULT_WATCHOS_CPU = "i386"
DEFAULT_TVOS_CPU = "x86_64"
DEFAULT_MACOS_CPU = "x86_64"
@@ -122,6 +133,7 @@ _apple_rule_base_transition_inputs = [
"//command_line_option:ios_multi_cpus",
"//command_line_option:macos_cpus",
"//command_line_option:tvos_cpus",
+ "//command_line_option:visionos_cpus",
"//command_line_option:watchos_cpus",
"//command_line_option:catalyst_cpus",
"//command_line_option:platforms",
diff --git a/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
index a1d315267231cc..dd0a4d1954d07c 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategyTest.java
@@ -29,9 +29,12 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
+import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.FutureSpawn;
import com.google.devtools.build.lib.actions.MetadataProvider;
+import com.google.devtools.build.lib.actions.ArtifactRoot.RootType;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnExecutedEvent;
import com.google.devtools.build.lib.actions.SpawnResult;
@@ -92,6 +95,7 @@ public TestedSpawnStrategy(Path execRoot, SpawnRunner spawnRunner) {
private final Path execRoot = fs.getPath("/execroot");
private Scratch scratch;
private ArtifactRoot rootDir;
+ private ArtifactRoot outputDir;
@Mock private SpawnRunner spawnRunner;
@Mock private ActionExecutionContext actionExecutionContext;
@Mock private MessageOutputStream messageOutput;
@@ -103,6 +107,7 @@ public final void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
scratch = new Scratch(fs);
rootDir = ArtifactRoot.asSourceRoot(Root.fromPath(scratch.dir("/execroot")));
+ outputDir = ArtifactRoot.asDerivedRoot(scratch.dir("/execroot"), RootType.Output, "out");
eventHandler = new StoredEventHandler();
when(actionExecutionContext.getEventHandler()).thenReturn(eventHandler);
when(actionExecutionContext.getClock()).thenReturn(clock);
@@ -453,6 +458,60 @@ public void testLogSpawn_defaultPlatform_getsLogged() throws Exception {
verify(messageOutput).write(expected); // output will reflect default properties
}
+ @Test
+ public void testLogSpawn_toolInputs() throws Exception {
+ Artifact toolFile = ActionsTestUtil.createArtifact(rootDir, "tool.file");
+ SpecialArtifact toolDir =
+ ActionsTestUtil.createTreeArtifactWithGeneratingAction(outputDir, "tool.dir");
+
+ scratch.file("/execroot/tool.file", "123");
+ scratch.file("/execroot/out/tool.dir/tool.file", "456");
+
+ setUpExecutionContext(/* executionOptions= */ null, /* remoteOptions= */ null);
+ when(actionExecutionContext.getArtifactExpander())
+ .thenReturn(
+ (artifact, output) -> {
+ if (artifact.equals(toolDir)) {
+ output.add(TreeFileArtifact.createTreeOutput(toolDir, "tool.file"));
+ }
+ });
+ Spawn spawn =
+ new SpawnBuilder("cmd").withInputs(toolFile, toolDir).withTools(toolFile, toolDir).build();
+ assertThrows(
+ SpawnExecException.class,
+ () -> new TestedSpawnStrategy(execRoot, spawnRunner).exec(spawn, actionExecutionContext));
+
+ SpawnExec expected =
+ defaultSpawnExecBuilder("cmd")
+ .addInputs(
+ File.newBuilder()
+ .setPath("out/tool.dir/tool.file")
+ .setDigest(
+ Digest.newBuilder()
+ .setHash(
+ "cdfba543ee8ef7fdb3d8b587648cc22dd792bbd6272cc5447307c7c106c2374c")
+ .setSizeBytes(4)
+ .setHashFunctionName("SHA-256")
+ .build())
+ .setIsTool(true)
+ .build())
+ .addInputs(
+ File.newBuilder()
+ .setPath("tool.file")
+ .setDigest(
+ Digest.newBuilder()
+ .setHash(
+ "181210f8f9c779c26da1d9b2075bde0127302ee0e3fca38c9a83f5b1dd8e5d3b")
+ .setSizeBytes(4)
+ .setHashFunctionName("SHA-256")
+ .build())
+ .setIsTool(true)
+ .build())
+ .build();
+
+ verify(messageOutput).write(expected);
+ }
+
@Test
public void testLogSpawn_spawnMetrics() throws Exception {
ExecutionOptions executionOptions = Options.getDefaults(ExecutionOptions.class);
diff --git a/src/test/java/com/google/devtools/build/lib/exec/util/SpawnBuilder.java b/src/test/java/com/google/devtools/build/lib/exec/util/SpawnBuilder.java
index 9564169e77e2a1..5a396b8d055624 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/util/SpawnBuilder.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/util/SpawnBuilder.java
@@ -235,6 +235,14 @@ public SpawnBuilder withTool(ActionInput tool) {
return this;
}
+ @CanIgnoreReturnValue
+ public SpawnBuilder withTools(ActionInput... tools) {
+ for (ActionInput tool : tools) {
+ this.tools.add(tool);
+ }
+ return this;
+ }
+
@CanIgnoreReturnValue
public SpawnBuilder withLocalResources(ResourceSet resourceSet) {
this.resourceSet = resourceSet;
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java
index ec3d6f2c7d315e..b657474765a2dc 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/util/MockPlatformSupport.java
@@ -112,6 +112,10 @@ public static void setup(
" constraint_setting = ':os',",
")",
"constraint_value(",
+ " name = 'visionos',",
+ " constraint_setting = ':os',",
+ ")",
+ "constraint_value(",
" name = 'watchos',",
" constraint_setting = ':os',",
")",
diff --git a/src/test/java/com/google/devtools/build/lib/remote/BUILD b/src/test/java/com/google/devtools/build/lib/remote/BUILD
index 7c83743208ff34..bcdc577ff5ef0e 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/remote/BUILD
@@ -98,6 +98,7 @@ java_test(
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:failure_details_java_proto",
"//src/main/protobuf:remote_execution_log_java_proto",
+ "//src/main/protobuf:spawn_java_proto",
"//src/test/java/com/google/devtools/build/lib:test_runner",
"//src/test/java/com/google/devtools/build/lib/actions/util",
"//src/test/java/com/google/devtools/build/lib/analysis/util",
diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java
index 8b17b1433feaff..fcc728e7cf7814 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java
@@ -80,6 +80,7 @@
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.events.StoredEventHandler;
+import com.google.devtools.build.lib.exec.Protos.CacheSalt;
import com.google.devtools.build.lib.exec.util.FakeOwner;
import com.google.devtools.build.lib.exec.util.SpawnBuilder;
import com.google.devtools.build.lib.remote.RemoteExecutionService.RemoteActionResult;
@@ -261,7 +262,7 @@ public void buildRemoteAction_withActionInputDirectoryAsOutput() throws Exceptio
}
@Test
- public void buildRemoteAction_differentiateWorkspace_generateActionSalt() throws Exception {
+ public void buildRemoteAction_generateActionSalt_differentiateWorkspaceCache() throws Exception {
Spawn spawn =
new SpawnBuilder("dummy")
.withExecutionInfo(ExecutionRequirements.DIFFERENTIATE_WORKSPACE_CACHE, "aa")
@@ -271,10 +272,23 @@ public void buildRemoteAction_differentiateWorkspace_generateActionSalt() throws
RemoteAction remoteAction = service.buildRemoteAction(spawn, context);
- Platform expected =
- Platform.newBuilder()
- .addProperties(Platform.Property.newBuilder().setName("workspace").setValue("aa"))
+ CacheSalt expected =
+ CacheSalt.newBuilder().setMayBeExecutedRemotely(true).setWorkspace("aa").build();
+ assertThat(remoteAction.getAction().getSalt()).isEqualTo(expected.toByteString());
+ }
+
+ @Test
+ public void buildRemoteAction_generateActionSalt_noRemoteExec() throws Exception {
+ Spawn spawn =
+ new SpawnBuilder("dummy")
+ .withExecutionInfo(ExecutionRequirements.NO_REMOTE_EXEC, "")
.build();
+ FakeSpawnExecutionContext context = newSpawnExecutionContext(spawn);
+ RemoteExecutionService service = newRemoteExecutionService();
+
+ RemoteAction remoteAction = service.buildRemoteAction(spawn, context);
+
+ CacheSalt expected = CacheSalt.newBuilder().setMayBeExecutedRemotely(false).build();
assertThat(remoteAction.getAction().getSalt()).isEqualTo(expected.toByteString());
}
diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
index 623f2fe0808fb1..b479751e86fab3 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
@@ -152,7 +152,7 @@ public class RemoteSpawnRunnerTest {
// The action key of the Spawn returned by newSimpleSpawn().
private final String simpleActionId =
- "eb45b20cc979d504f96b9efc9a08c48103c6f017afa09c0df5c70a5f92a98ea8";
+ "31aea267dc597b047a9b6993100415b6406f82822318dc8988e4164a535b51ee";
@Before
public final void setUp() throws Exception {
@@ -557,7 +557,7 @@ public void testHumanReadableServerLogsSavedForFailingActionWithSiblingRepositor
Digest logDigest = digestUtil.computeAsUtf8("bla");
Path logPath =
logDir
- .getRelative("b9a727771337fd8ce54821f4805e2d451c4739e92fec6f8ecdb18ff9d1983b27")
+ .getRelative("e0a5a3561464123504c1240b3587779cdfd6adee20f72aa136e388ecfd570c12")
.getRelative("logname");
ExecuteResponse resp =
ExecuteResponse.newBuilder()
diff --git a/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeConfigTest.java b/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeConfigTest.java
index 51ea58bddd6337..cd41a807eb30f3 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeConfigTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeConfigTest.java
@@ -445,7 +445,9 @@ public void xcodeVersionConfig_isFunction() throws Exception {
+ " tvosMinimumOsVersion='1.6',"
+ " macosSdkVersion='1.7',"
+ " macosMinimumOsVersion='1.8',"
- + " xcodeVersion='1.9'))]",
+ + " visionosSdkVersion='1.9',"
+ + " visionosMinimumOsVersion='1.10',"
+ + " xcodeVersion='1.11'))]",
"my_rule = rule(_impl, attrs = { 'dep' : attr.label() })");
scratch.file("foo/BUILD", "load(':extension.bzl', 'my_rule')", "my_rule(name='test')");
assertNoEvents();
@@ -466,6 +468,8 @@ public void xcodeVersionConfig_isFunction() throws Exception {
DottedVersion.fromStringUnchecked("1.7"),
DottedVersion.fromStringUnchecked("1.8"),
DottedVersion.fromStringUnchecked("1.9"),
+ DottedVersion.fromStringUnchecked("1.10"),
+ DottedVersion.fromStringUnchecked("1.11"),
XcodeConfigInfo.Availability.UNKNOWN,
/** xcodeVersionFlagValue= */
"",
@@ -489,7 +493,9 @@ public void xcodeVersionConfig_throwsOnBadInput() throws Exception {
+ " tvosMinimumOsVersion='1.6',"
+ " macosSdkVersion='1.7',"
+ " macosMinimumOsVersion='1.8',"
- + " xcodeVersion='1.9'))]",
+ + " visionosSdkVersion='1.9',"
+ + " visionosMinimumOsVersion='1.10',"
+ + " xcodeVersion='1.11'))]",
"my_rule = rule(_impl, attrs = { 'dep' : attr.label() })");
scratch.file("foo/BUILD", "load(':extension.bzl', 'my_rule')", "my_rule(name='test')");
assertNoEvents();
@@ -509,12 +515,14 @@ public void xcodeVersionConfig_exposesExpectedAttributes() throws Exception {
+ " iosSdkVersion='1.1',"
+ " iosMinimumOsVersion='1.2',"
+ " watchosSdkVersion='1.3',"
- + " watchosMinimumOsVersion='1.4',"
+ + " watchosMinimumOsVersion='2.4',"
+ " tvosSdkVersion='1.5',"
+ " tvosMinimumOsVersion='1.6',"
+ " macosSdkVersion='1.7',"
+ " macosMinimumOsVersion='1.8',"
- + " xcodeVersion='1.9')",
+ + " visionosSdkVersion='1.9',"
+ + " visionosMinimumOsVersion='1.10',"
+ + " xcodeVersion='1.11')",
" return [result(xcode_version=xcode_version.xcode_version(),"
+ "min_os=xcode_version.minimum_os_for_platform_type(ctx.fragments.apple.single_arch_platform.platform_type)),]",
"my_rule = rule(_impl, attrs = { 'dep' : attr.label() }, fragments = ['apple'])");
@@ -525,7 +533,7 @@ public void xcodeVersionConfig_exposesExpectedAttributes() throws Exception {
(StructImpl)
myRuleTarget.get(
new StarlarkProvider.Key(Label.parseCanonical("//foo:extension.bzl"), "result"));
- assertThat(info.getValue("xcode_version").toString()).isEqualTo("1.9");
+ assertThat(info.getValue("xcode_version").toString()).isEqualTo("1.11");
assertThat(info.getValue("min_os").toString()).isEqualTo("1.8");
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
index aa425fb7200c54..3a182ff1dbb81e 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
@@ -2317,4 +2317,20 @@ public void singleValueThatLooksLikeMultiValueIsOkay() throws Exception {
assertThat(getConfiguredTarget("//test:fg")).isNotNull();
assertNoEvents();
}
+
+ @Test
+ public void labelInValuesError() throws Exception {
+ scratch.file(
+ "test/BUILD",
+ "config_setting(",
+ " name = 'match',",
+ " values = {'//foo:bar': 'value'},",
+ ")");
+ reporter.removeHandler(failFastHandler); // expect errors
+ assertThat(getConfiguredTarget("//test:match")).isNull();
+ assertContainsEvent(
+ "in values attribute of config_setting rule //test:match: '//foo:bar' is"
+ + " not a valid setting name, but appears to be a label. Did you mean to place it in"
+ + " flag_values instead?");
+ }
}
diff --git a/src/test/shell/bazel/android/android_integration_test.sh b/src/test/shell/bazel/android/android_integration_test.sh
index a61fa6f461314e..776a40dbe0514d 100755
--- a/src/test/shell/bazel/android/android_integration_test.sh
+++ b/src/test/shell/bazel/android/android_integration_test.sh
@@ -232,7 +232,7 @@ android_binary(
EOF
cat > MODULE.bazel << 'EOF'
# Required for android_integration_test_with_platforms
-bazel_dep(name = "platforms", version = "0.0.5")
+bazel_dep(name = "platforms", version = "0.0.7")
EOF
bazel clean
diff --git a/src/test/shell/integration/action_env_test.sh b/src/test/shell/integration/action_env_test.sh
index 08af2abd059630..6feaf075740bb0 100755
--- a/src/test/shell/integration/action_env_test.sh
+++ b/src/test/shell/integration/action_env_test.sh
@@ -39,6 +39,15 @@ load("//pkg:build.bzl", "environ")
environ(name = "no_default_env", env = 0)
environ(name = "with_default_env", env = 1)
+environ(
+ name = "with_default_and_fixed_env",
+ env = 1,
+ fixed_env = {
+ "ACTION_FIXED": "action",
+ "ACTION_AND_CLIENT_FIXED": "action",
+ "ACTION_AND_CLIENT_INHERITED": "action",
+ },
+)
sh_test(
name = "test_env_foo",
@@ -72,12 +81,16 @@ def _impl(ctx):
ctx.actions.run_shell(
inputs=[],
outputs=[output],
+ env = ctx.attr.fixed_env,
use_default_shell_env = ctx.attr.env,
command="env > %s" % output.path)
environ = rule(
implementation=_impl,
- attrs={"env": attr.bool(default=True)},
+ attrs={
+ "env": attr.bool(default=True),
+ "fixed_env": attr.string_dict(),
+ },
outputs={"out": "%{name}.env"},
)
EOF
@@ -222,6 +235,52 @@ function test_use_default_shell_env {
&& fail "dynamic action_env used, even though requested not to") || true
}
+function test_use_default_shell_env_and_fixed_env {
+ ACTION_AND_CLIENT_INHERITED=client CLIENT_INHERITED=client \
+ bazel build \
+ --noincompatible_merge_fixed_and_default_shell_env \
+ --action_env=ACTION_AND_CLIENT_FIXED=client \
+ --action_env=ACTION_AND_CLIENT_INHERITED \
+ --action_env=CLIENT_FIXED=client \
+ --action_env=CLIENT_INHERITED \
+ //pkg:with_default_and_fixed_env
+ echo
+ cat bazel-bin/pkg/with_default_and_fixed_env.env
+ echo
+ grep -q ACTION_AND_CLIENT_FIXED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "static action environment not honored"
+ grep -q ACTION_AND_CLIENT_INHERITED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "dynamic action environment not honored"
+ grep -q ACTION_FIXED bazel-bin/pkg/with_default_and_fixed_env.env \
+ && fail "fixed env provided by action should have been ignored"
+ grep -q CLIENT_FIXED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "static action environment not honored"
+ grep -q CLIENT_INHERITED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "dynamic action environment not honored"
+
+ ACTION_AND_CLIENT_INHERITED=client CLIENT_INHERITED=client \
+ bazel build \
+ --incompatible_merge_fixed_and_default_shell_env \
+ --action_env=ACTION_AND_CLIENT_FIXED=client \
+ --action_env=ACTION_AND_CLIENT_INHERITED \
+ --action_env=CLIENT_FIXED=client \
+ --action_env=CLIENT_INHERITED \
+ //pkg:with_default_and_fixed_env
+ echo
+ cat bazel-bin/pkg/with_default_and_fixed_env.env
+ echo
+ grep -q ACTION_AND_CLIENT_FIXED=action bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "action-provided env should have overridden static --action_env"
+ grep -q ACTION_AND_CLIENT_INHERITED=action bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "action-provided env should have overridden dynamic --action_env"
+ grep -q ACTION_FIXED=action bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "action-provided env should have been honored"
+ grep -q CLIENT_FIXED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "static action environment not honored"
+ grep -q CLIENT_INHERITED=client bazel-bin/pkg/with_default_and_fixed_env.env \
+ || fail "dynamic action environment not honored"
+}
+
function test_action_env_changes_honored {
# Verify that changes to the explicitly specified action_env in honored in
# tests. Regression test for #3265.
diff --git a/tools/osx/BUILD b/tools/osx/BUILD
index 79344650445338..2a0f44224ce2f2 100644
--- a/tools/osx/BUILD
+++ b/tools/osx/BUILD
@@ -3,6 +3,7 @@ load(
"ios_sdk_version_flag",
"macos_sdk_version_flag",
"tvos_sdk_version_flag",
+ "visionos_sdk_version_flag",
"watchos_sdk_version_flag",
"xcode_version_flag",
)
@@ -100,6 +101,8 @@ ios_sdk_version_flag(name = "ios_sdk_version_flag")
tvos_sdk_version_flag(name = "tvos_sdk_version_flag")
+visionos_sdk_version_flag(name = "visionos_sdk_version_flag")
+
watchos_sdk_version_flag(name = "watchos_sdk_version_flag")
macos_sdk_version_flag(name = "macos_sdk_version_flag")
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl
index e8b7499a814861..e9c4152b924c01 100644
--- a/tools/osx/xcode_configure.bzl
+++ b/tools/osx/xcode_configure.bzl
@@ -71,6 +71,7 @@ def _xcode_version_output(repository_ctx, name, version, aliases, developer_dir,
ios_sdk_version = _search_sdk_output(xcodebuild_result.stdout, "iphoneos")
tvos_sdk_version = _search_sdk_output(xcodebuild_result.stdout, "appletvos")
macos_sdk_version = _search_sdk_output(xcodebuild_result.stdout, "macosx")
+ visionos_sdk_version = _search_sdk_output(xcodebuild_result.stdout, "xros")
watchos_sdk_version = _search_sdk_output(xcodebuild_result.stdout, "watchos")
build_contents += "xcode_version(\n name = '%s'," % name
build_contents += "\n version = '%s'," % version
@@ -82,6 +83,8 @@ def _xcode_version_output(repository_ctx, name, version, aliases, developer_dir,
build_contents += "\n default_tvos_sdk_version = '%s'," % tvos_sdk_version
if macos_sdk_version:
build_contents += "\n default_macos_sdk_version = '%s'," % macos_sdk_version
+ if visionos_sdk_version:
+ build_contents += "\n default_visionos_sdk_version = '%s'," % visionos_sdk_version
if watchos_sdk_version:
build_contents += "\n default_watchos_sdk_version = '%s'," % watchos_sdk_version
build_contents += "\n)\n"
diff --git a/tools/osx/xcode_version_flag.bzl b/tools/osx/xcode_version_flag.bzl
index a7ede5f54dd95a..1578a731b8fe32 100644
--- a/tools/osx/xcode_version_flag.bzl
+++ b/tools/osx/xcode_version_flag.bzl
@@ -98,6 +98,16 @@ def _tvos_sdk_version_flag_impl(ctx):
),
))
+def _visionos_sdk_version_flag_impl(ctx):
+ """A rule that allows select() to select based on the visionOS SDK version."""
+ xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
+
+ return config_common.FeatureFlagInfo(value = _strip_version(
+ xcode_config.sdk_version_for_platform(
+ apple_common.platform.visionos_device,
+ ),
+ ))
+
def _watchos_sdk_version_flag_impl(ctx):
"""A rule that allows select() to select based on the watchOS SDK version."""
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
@@ -200,6 +210,16 @@ tvos_sdk_version_flag = rule(
},
)
+visionos_sdk_version_flag = rule(
+ implementation = _visionos_sdk_version_flag_impl,
+ attrs = {
+ "_xcode_config": attr.label(default = configuration_field(
+ fragment = "apple",
+ name = "xcode_config_label",
+ )),
+ },
+)
+
watchos_sdk_version_flag = rule(
implementation = _watchos_sdk_version_flag_impl,
attrs = {