Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.4.0] Make MODULE.bazel.lock deterministic #19370

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static java.nio.charset.StandardCharsets.UTF_8;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.eventbus.Subscribe;
import com.google.common.flogger.GoogleLogger;
import com.google.devtools.build.lib.bazel.repository.RepositoryOptions;
Expand Down Expand Up @@ -123,7 +124,11 @@ private ImmutableMap<ModuleExtensionId, LockFileModuleExtension> combineModuleEx
for (ModuleExtensionResolutionEvent extensionEvent : extensionResolutionEvents) {
updatedExtensionMap.put(extensionEvent.getExtensionId(), extensionEvent.getModuleExtension());
}
return updatedExtensionMap.buildKeepingLast();
// The order in which extensions are added to extensionResolutionEvents depends on the order
// in which their Skyframe evaluations finish, which is non-deterministic. We ensure a
// deterministic lockfile by sorting.
return ImmutableSortedMap.copyOf(
updatedExtensionMap.buildKeepingLast(), ModuleExtensionId.LEXICOGRAPHIC_COMPARATOR);
}

/**
Expand Down