Skip to content

Commit

Permalink
Rollback of commit 49d97f9.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

--
PiperOrigin-RevId: 147146321
MOS_MIGRATED_REVID=147146321
  • Loading branch information
lfpino authored and kchodorow committed Feb 10, 2017
1 parent ae3ee25 commit 5a5bd8a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public void showBuildResult(
+ OutputDirectoryLinksUtils.getPrettyPath(temp.getPath(),
env.getWorkspaceName(),
env.getWorkspace(),
request.getBuildOptions().getSymlinkPrefix(productName)));
request.getBuildOptions().getSymlinkPrefix(productName),
productName));
}
}
}
Expand All @@ -156,7 +157,7 @@ private String formatArtifactForShowResults(Artifact artifact, BuildRequest requ
String productName = env.getRuntime().getProductName();
return " " + OutputDirectoryLinksUtils.getPrettyPath(artifact.getPath(),
env.getWorkspaceName(), env.getWorkspace(),
request.getBuildOptions().getSymlinkPrefix(productName));
request.getBuildOptions().getSymlinkPrefix(productName), productName);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,13 @@ void executeBuild(UUID buildId, AnalysisResult analysisResult,
BuildConfiguration targetConfiguration = targetConfigurations.size() == 1
? targetConfigurations.get(0) : null;
if (targetConfigurations.size() == 1) {
String productName = runtime.getProductName();
String dirName = env.getWorkspaceName();
String workspaceName = analysisResult.getWorkspaceName();
OutputDirectoryLinksUtils.createOutputDirectoryLinks(
dirName,
env.getWorkspace(),
env.getDirectories().getExecRoot(workspaceName),
env.getDirectories().getOutputPath(workspaceName),
getReporter(),
targetConfiguration,
request.getBuildOptions().getSymlinkPrefix(runtime.getProductName()));
dirName, env.getWorkspace(), env.getDirectories().getExecRoot(workspaceName),
env.getDirectories().getOutputPath(workspaceName), getReporter(), targetConfiguration,
request.getBuildOptions().getSymlinkPrefix(productName), productName);
}

ActionCache actionCache = getActionCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public class OutputDirectoryLinksUtils {

private static final String NO_CREATE_SYMLINKS_PREFIX = "/";

public static String getOutputSymlinkName(String symlinkPrefix) {
return symlinkPrefix + "out";
public static String getOutputSymlinkName(String productName) {
return productName + "-out";
}

private static String execRootSymlink(String symlinkPrefix, String workspaceName) {
return symlinkPrefix + workspaceName;
private static String execRootSymlink(String productName, String workspaceName) {
return productName + "-" + workspaceName;
}
/**
* Attempts to create convenience symlinks in the workspaceDirectory and in
Expand All @@ -53,7 +53,8 @@ private static String execRootSymlink(String symlinkPrefix, String workspaceName
*/
static void createOutputDirectoryLinks(String workspaceName,
Path workspace, Path execRoot, Path outputPath,
EventHandler eventHandler, @Nullable BuildConfiguration targetConfig, String symlinkPrefix) {
EventHandler eventHandler, @Nullable BuildConfiguration targetConfig,
String symlinkPrefix, String productName) {
if (NO_CREATE_SYMLINKS_PREFIX.equals(symlinkPrefix)) {
return;
}
Expand All @@ -62,10 +63,10 @@ static void createOutputDirectoryLinks(String workspaceName,
// Make the two non-specific links from the workspace to the output area,
// and the configuration-specific links in both the workspace and the execution root dirs.
// NB! Keep in sync with removeOutputDirectoryLinks below.
createLink(workspace, getOutputSymlinkName(symlinkPrefix), outputPath, failures);
createLink(workspace, getOutputSymlinkName(productName), outputPath, failures);

// Points to execroot
createLink(workspace, execRootSymlink(symlinkPrefix, workspaceName), execRoot, failures);
createLink(workspace, execRootSymlink(productName, workspaceName), execRoot, failures);

if (targetConfig != null) {
createLink(workspace, symlinkPrefix + "bin",
Expand All @@ -92,7 +93,7 @@ static void createOutputDirectoryLinks(String workspaceName,
* before, the pretty path may be incorrect if the symlinks end up pointing somewhere new.
*/
public static PathFragment getPrettyPath(Path file, String workspaceName,
Path workspaceDirectory, String symlinkPrefix) {
Path workspaceDirectory, String symlinkPrefix, String productName) {
for (String link : LINKS) {
PathFragment result = relativize(file, workspaceDirectory, symlinkPrefix + link);
if (result != null) {
Expand All @@ -101,12 +102,12 @@ public static PathFragment getPrettyPath(Path file, String workspaceName,
}

PathFragment result = relativize(file, workspaceDirectory,
execRootSymlink(symlinkPrefix, workspaceName));
execRootSymlink(productName, workspaceName));
if (result != null) {
return result;
}

result = relativize(file, workspaceDirectory, getOutputSymlinkName(symlinkPrefix));
result = relativize(file, workspaceDirectory, getOutputSymlinkName(productName));
if (result != null) {
return result;
}
Expand Down Expand Up @@ -149,8 +150,8 @@ public static void removeOutputDirectoryLinks(String workspaceName, Path workspa
}
List<String> failures = new ArrayList<>();

removeLink(workspace, getOutputSymlinkName(symlinkPrefix), failures);
removeLink(workspace, execRootSymlink(symlinkPrefix, workspaceName), failures);
removeLink(workspace, getOutputSymlinkName(productName), failures);
removeLink(workspace, execRootSymlink(productName, workspaceName), failures);
removeLink(workspace, symlinkPrefix + "bin", failures);
removeLink(workspace, symlinkPrefix + "testlogs", failures);
removeLink(workspace, symlinkPrefix + "genfiles", failures);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public ExitCode exec(CommandEnvironment env, OptionsProvider options) {
PathFragment prettyExecutablePath =
OutputDirectoryLinksUtils.getPrettyPath(executablePath,
env.getWorkspaceName(), env.getWorkspace(),
options.getOptions(BuildRequestOptions.class).getSymlinkPrefix(productName));
options.getOptions(BuildRequestOptions.class).getSymlinkPrefix(productName),
productName);
List<String> cmdLine = new ArrayList<>();
if (runOptions.scriptPath == null) {
PathFragment processWrapperPath =
Expand Down

0 comments on commit 5a5bd8a

Please sign in to comment.