Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ivyspirit authored and ilisc2 committed Jun 26, 2024
1 parent a76cae0 commit bc86e8c
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,28 @@ private static Workspace resolveWorkspace(Project project, File absoluteFile) {
}

BlazeProjectData blazeProjectData = getBlazeProjectData(project);
Path bzelRootPath = Paths.get(blazeProjectData.getBlazeInfo().getOutputBase().getAbsolutePath(),
Path bazelRootPath = Paths.get(
blazeProjectData.getBlazeInfo().getOutputBase().getAbsolutePath(),
"external").normalize();

logger.debug("the bazelRootPath is " + bazelRootPath);
Path path = Paths.get(absoluteFile.getAbsolutePath()).normalize();

// Check if the file path starts with the root directory path
if (!path.startsWith(bzelRootPath)) {
if (!path.startsWith(bazelRootPath)) {
return null;
}

Path relativePath = bzelRootPath.relativize(path);
Path relativePath = bazelRootPath.relativize(path);
if (relativePath.getNameCount() > 0) {
String firstFolder = relativePath.getName(0).toString();
try {
Path workspaceRootPath = Files.createDirectories(bzelRootPath.resolve(firstFolder));
Path workspaceRootPath = bazelRootPath.resolve(firstFolder);
if (workspaceRootPath.toFile().exists()) {
logger.debug("resolveWorkspace: " + workspaceRootPath + " firstFolder: " + firstFolder);
return new Workspace(new WorkspaceRoot(workspaceRootPath.toFile()), firstFolder);
} catch (IOException e) {
logger.error("Error creating directories", e);
return null;
}
} else {
return null;
}
return null;
}

private static Label deriveLabel(
Expand Down Expand Up @@ -185,7 +184,6 @@ private static WorkspacePath getPackagePath(
return null;
}


@VisibleForTesting
public static File getExternalSourceRoot(BlazeProjectData projectData) {
return new File(projectData.getBlazeInfo().getOutputBase(), "external");
Expand Down

0 comments on commit bc86e8c

Please sign in to comment.