Skip to content

[AOSP-pick] Simplest possible version check #7456

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

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
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 @@ -53,6 +53,7 @@
import com.google.idea.blaze.base.scope.BlazeContext;
import com.google.idea.blaze.base.sync.aspects.BlazeBuildOutputs;
import com.google.idea.blaze.base.sync.aspects.storage.AspectRepositoryProvider;
import com.google.idea.blaze.base.util.VersionChecker;
import com.google.idea.blaze.base.vcs.BlazeVcsHandlerProvider.BlazeVcsHandler;
import com.google.idea.blaze.common.Context;
import com.google.idea.blaze.common.Label;
Expand Down Expand Up @@ -191,6 +192,10 @@ public OutputInfo build(
try (
final var ignoredLock = ApplicationManager.getApplication().getService(BuildDependenciesLockService.class)
.lockWorkspace(workspaceRoot.path().toString())) {
if (VersionChecker.versionMismatch()) {
throw new BuildException(
"The IDE has been upgraded in the background. Bazel build aspect files maybe incompatible. Please restart the IDE.");
}
final var buildDependenciesBazelInvocationInfo = getInvocationInfo(context, buildTargets, languages);
prepareInvocationFiles(context, buildDependenciesBazelInvocationInfo.invocationWorkspaceFiles());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public static boolean versionMismatch() {
BuildNumber.fromString(readBuildNumberFromProductInfo());
BuildNumber buildNumberFromApplicationInfo = ApplicationInfo.getInstance().getBuild();

if (buildNumberFromProductInfo == null) {
// It is `null` at least in non-integration tests.
return false;
}
return !buildNumberFromProductInfo.equals(buildNumberFromApplicationInfo);
}

Expand Down