Skip to content

Commit

Permalink
Removing obsolete parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sellophane committed Jan 22, 2025
1 parent d55eff3 commit 12cbc92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public final class AspectSyncProjectData implements BlazeProjectData {
private final WorkspacePathResolver workspacePathResolver;
private final ArtifactLocationDecoder artifactLocationDecoder;
private final WorkspaceLanguageSettings workspaceLanguageSettings;
private final ExternalWorkspaceData externalWorkspaceData;
private final SyncState syncState;

public AspectSyncProjectData(
Expand All @@ -62,15 +61,13 @@ public AspectSyncProjectData(
WorkspacePathResolver workspacePathResolver,
ArtifactLocationDecoder artifactLocationDecoder,
WorkspaceLanguageSettings workspaceLanguageSettings,
ExternalWorkspaceData externalWorkspaceData,
SyncState syncState) {
this.targetData = targetData;
this.blazeInfo = blazeInfo;
this.blazeVersionData = blazeVersionData;
this.workspacePathResolver = workspacePathResolver;
this.artifactLocationDecoder = artifactLocationDecoder;
this.workspaceLanguageSettings = workspaceLanguageSettings;
this.externalWorkspaceData = externalWorkspaceData;
this.syncState = syncState;
}

Expand All @@ -88,7 +85,6 @@ public static AspectSyncProjectData fromProto(
workspacePathResolver,
new ArtifactLocationDecoderImpl(blazeInfo, workspacePathResolver, targetData.remoteOutputs),
WorkspaceLanguageSettings.fromProto(proto.getWorkspaceLanguageSettings()),
ExternalWorkspaceData.fromProto(proto.getExternalWorkspaceData()),
SyncState.fromProto(proto.getSyncState()));
}

Expand Down Expand Up @@ -116,7 +112,6 @@ public ProjectData.BlazeProjectData toProto() {
.setWorkspacePathResolver(workspacePathResolver.toProto())
.setWorkspaceLanguageSettings(workspaceLanguageSettings.toProto())
.setSyncState(syncState.toProto())
.setExternalWorkspaceData(externalWorkspaceData.toProto())
.build();
}

Expand Down Expand Up @@ -227,7 +222,6 @@ public boolean equals(Object o) {
AspectSyncProjectData other = (AspectSyncProjectData) o;
return Objects.equals(targetData, other.targetData)
&& Objects.equals(blazeInfo, other.blazeInfo)
&& Objects.equals(externalWorkspaceData, other.externalWorkspaceData)
&& Objects.equals(blazeVersionData, other.blazeVersionData)
&& Objects.equals(workspacePathResolver, other.workspacePathResolver)
&& Objects.equals(artifactLocationDecoder, other.artifactLocationDecoder)
Expand All @@ -244,7 +238,6 @@ public int hashCode() {
workspaceLanguageSettings,
artifactLocationDecoder,
workspaceLanguageSettings,
externalWorkspaceData,
syncState);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ private void run(BlazeContext context) throws SyncCanceledException, SyncFailedE
projectState.getWorkspacePathResolver(),
artifactLocationDecoder,
projectState.getLanguageSettings(),
projectState.getExternalWorkspaceData(),
syncStateBuilder.build());

FileCaches.onSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@
import com.google.idea.blaze.base.sync.data.BlazeProjectDataManager;
import com.google.idea.blaze.qsync.QuerySyncProjectSnapshot;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;

import javax.annotation.Nullable;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nullable;

/** External-workspace-aware resolution of workspace paths. */
/**
* External-workspace-aware resolution of workspace paths.
*/
public class WorkspaceHelper {

private static BlazeProjectData blazeProjectData;
Expand Down Expand Up @@ -75,7 +77,9 @@ public static WorkspaceRoot getExternalWorkspace(Project project, String workspa
return resolveExternalWorkspaceRoot(project, workspaceName, null);
}

/** Resolves the parent blaze package corresponding to this label. */
/**
* Resolves the parent blaze package corresponding to this label.
*/
@Nullable
public static File resolveBlazePackage(Project project, Label label) {
logger.debug("resolveBlazePackage: " + label + " in project " + project.getName());
Expand All @@ -95,7 +99,9 @@ public static WorkspacePath resolveWorkspacePath(Project project, File absoluteF
return workspace != null ? workspace.root.workspacePathForSafe(absoluteFile) : null;
}

/** Converts a file to the corresponding BUILD label for this project, if valid. */
/**
* Converts a file to the corresponding BUILD label for this project, if valid.
*/
@Nullable
public static Label getBuildLabel(Project project, File absoluteFile) {
logger.debug("getBuildLabel for file " + absoluteFile.getAbsolutePath());
Expand Down Expand Up @@ -191,7 +197,9 @@ public static Path getExternalSourceRoot(Project project, BlazeProjectData proje
return getExternalBase(project, projectData).toPath().normalize();
}

/** resolve workspace root for a named external repository. needs context since the same name can mean something different in different workspaces. */
/**
* resolve workspace root for a named external repository. needs context since the same name can mean something different in different workspaces.
*/
@Nullable
private static synchronized WorkspaceRoot resolveExternalWorkspaceRoot(
Project project, String workspaceName, @Nullable BuildFile buildFile) {
Expand Down Expand Up @@ -220,9 +228,7 @@ private static synchronized WorkspaceRoot resolveExternalWorkspaceRoot(
BlazeProjectData blazeProjectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
if (blazeProjectData != null) {


File externalBase = null;
externalBase = getExternalBase(project, blazeProjectData);
File externalBase = getExternalBase(project, blazeProjectData);
if (externalBase == null) return null;

File workspaceDir = new File(externalBase, workspaceName);
Expand All @@ -243,12 +249,12 @@ private static synchronized WorkspaceRoot resolveExternalWorkspaceRoot(

private static @Nullable File getExternalBase(Project project, BlazeProjectData blazeProjectData) {
File externalBase;
if(blazeProjectData.isQuerySync()) {
if (blazeProjectData.isQuerySync()) {
QuerySyncProjectSnapshot snapshot =
QuerySyncManager.getInstance(project).getCurrentSnapshot().orElse(null);
if(snapshot == null) return null;
QuerySyncManager.getInstance(project).getCurrentSnapshot().orElse(null);
if (snapshot == null) return null;
externalBase = snapshot.queryData().outputBase()
.map(pathname -> new File(pathname, "external")).orElse(null);
.map(pathname -> new File(pathname, "external")).orElse(null);
} else {
BlazeInfo blazeInfo = blazeProjectData.getBlazeInfo();
externalBase = new File(blazeInfo.getOutputBase(), "external");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class MockBlazeProjectDataBuilder {
private WorkspacePathResolver workspacePathResolver;
private ArtifactLocationDecoder artifactLocationDecoder;
private WorkspaceLanguageSettings workspaceLanguageSettings;
private ExternalWorkspaceData externalWorkspaceData;
private SyncState syncState;

private MockBlazeProjectDataBuilder(WorkspaceRoot workspaceRoot) {
Expand Down Expand Up @@ -106,13 +105,6 @@ public MockBlazeProjectDataBuilder setWorkspaceLanguageSettings(
return this;
}

@CanIgnoreReturnValue
public MockBlazeProjectDataBuilder setExternalWorkspaceData(
ExternalWorkspaceData externalWorkspaceData) {
this.externalWorkspaceData = externalWorkspaceData;
return this;
}

@CanIgnoreReturnValue
public MockBlazeProjectDataBuilder setSyncState(SyncState syncState) {
this.syncState = syncState;
Expand Down Expand Up @@ -143,18 +135,14 @@ public BlazeProjectData build() {
this.artifactLocationDecoder != null
? this.artifactLocationDecoder
: new ArtifactLocationDecoderImpl(
blazeInfo, workspacePathResolver, RemoteOutputArtifacts.EMPTY);
blazeInfo, workspacePathResolver, RemoteOutputArtifacts.EMPTY);
WorkspaceLanguageSettings workspaceLanguageSettings =
this.workspaceLanguageSettings != null
? this.workspaceLanguageSettings
: new WorkspaceLanguageSettings(WorkspaceType.JAVA, ImmutableSet.of());
SyncState syncState =
this.syncState != null ? this.syncState : new SyncState(ImmutableMap.of());

ExternalWorkspaceData externalWorkspaceData =
this.externalWorkspaceData != null
? this.externalWorkspaceData
: ExternalWorkspaceData.EMPTY;

return new AspectSyncProjectData(
new ProjectTargetData(
Expand All @@ -164,7 +152,6 @@ public BlazeProjectData build() {
workspacePathResolver,
artifactLocationDecoder,
workspaceLanguageSettings,
externalWorkspaceData,
syncState);
}
}

0 comments on commit 12cbc92

Please sign in to comment.