Skip to content

Commit

Permalink
Revert "Reapply "Specify the Xcode version on Queue Entry""
Browse files Browse the repository at this point in the history
This reverts commit bf9830d.
  • Loading branch information
chenj-hub committed Aug 12, 2024
1 parent 9e79a9d commit 4bd30b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ protected void validatePlatform(
}

@VisibleForTesting
protected void validateCommand(
void validateCommand(
Command command,
Digest inputRootDigest,
Set<String> inputFiles,
Expand Down
58 changes: 2 additions & 56 deletions src/main/java/build/buildfarm/instance/shard/ServerInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import build.bazel.remote.execution.v2.BatchReadBlobsResponse.Response;
import build.bazel.remote.execution.v2.CacheCapabilities;
import build.bazel.remote.execution.v2.Command;
import build.bazel.remote.execution.v2.Command.EnvironmentVariable;
import build.bazel.remote.execution.v2.Compressor;
import build.bazel.remote.execution.v2.Digest;
import build.bazel.remote.execution.v2.DigestFunction;
Expand Down Expand Up @@ -1738,26 +1737,6 @@ private ListenableFuture<QueuedOperation> buildQueuedOperation(
service);
}

@Override
protected void validateCommand(
Command command,
Digest inputRootDigest,
Set<String> inputFiles,
Set<String> inputDirectories,
Map<Digest, Directory> directoriesIndex,
PreconditionFailure.Builder preconditionFailure) {
// Validating the match platform
Platform matchPlatform = getMatchPlatform(command);
Command queuedCommand = command.toBuilder().setPlatform(matchPlatform).build();
super.validateCommand(
queuedCommand,
inputRootDigest,
inputFiles,
inputDirectories,
directoriesIndex,
preconditionFailure);
}

@Override
protected void validatePlatform(
Platform platform, PreconditionFailure.Builder preconditionFailure) {
Expand Down Expand Up @@ -2380,37 +2359,6 @@ public ListenableFuture<Void> queue(ExecuteEntry executeEntry, Poller poller, Du
operationTransformService);
}

/**
* Allow specifying an xcode to ensure we have the right version for a given action when provided
*
* <p>Bazel doesn't have a great way to set this client side today; See bazel issue 16866 and
* https://groups.google.com/g/bazel-discuss/c/kG11xW7Hvyk
*/
private Platform getMatchPlatform(Command command) {
String xcodeEnvKey = "XCODE_VERSION_OVERRIDE";
String xcodeEnvValue = null;
for (EnvironmentVariable envVar : command.getEnvironmentVariablesList()) {
if (envVar.getName().equals(xcodeEnvKey)) {
xcodeEnvValue = envVar.getValue();
}
}

Platform basePlatform = command.getPlatform();
if (xcodeEnvValue == null) {
return basePlatform;
}

Platform.Builder matchPlatformBuilder = Platform.newBuilder();
for (Platform.Property p : basePlatform.getPropertiesList()) {
matchPlatformBuilder.addProperties(p);
}

matchPlatformBuilder.addProperties(
Property.newBuilder().setName("xcode").setValue(xcodeEnvValue).build());
Platform matchPlatform = matchPlatformBuilder.build();
return matchPlatform;
}

private ListenableFuture<Void> transformAndQueue(
ExecuteEntry executeEntry,
Poller poller,
Expand Down Expand Up @@ -2560,14 +2508,12 @@ public void onSuccess(ProfiledQueuedOperationMetadata profiledQueuedMetadata) {
profiledQueuedMetadata.getQueuedOperationMetadata();
Operation queueOperation =
operation.toBuilder().setMetadata(Any.pack(queuedOperationMetadata)).build();

Platform matchPlatform =
getMatchPlatform(profiledQueuedMetadata.getQueuedOperation().getCommand());
QueueEntry queueEntry =
QueueEntry.newBuilder()
.setExecuteEntry(executeEntry)
.setQueuedOperationDigest(queuedOperationMetadata.getQueuedOperationDigest())
.setPlatform(matchPlatform)
.setPlatform(
profiledQueuedMetadata.getQueuedOperation().getCommand().getPlatform())
.build();
try {
ensureCanQueue(stopwatch);
Expand Down

0 comments on commit 4bd30b2

Please sign in to comment.