Skip to content

Commit

Permalink
Automated rollback of commit 9c65356.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

b/204092093#comment5

*** Original change description ***

Add a method to get an `OutputDirectory` from its name.

PiperOrigin-RevId: 406817638
  • Loading branch information
justinhorvitz authored and copybara-github committed Nov 1, 2021
1 parent 9c65356 commit 2c9721f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ public boolean isStrictFilesetOutput() {
return options.strictFilesetOutput;
}

public RepositoryName getMainRepositoryName() {
return mainRepositoryName;
public String getMainRepositoryName() {
return mainRepositoryName.strippedName();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.devtools.build.lib.analysis.config;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.not;
import static java.util.stream.Collectors.joining;

Expand Down Expand Up @@ -89,22 +88,6 @@ public enum OutputDirectory {
INCLUDE(BlazeDirectories.RELATIVE_INCLUDE_DIR),
OUTPUT("");

/**
* Returns the {@link OutputDirectory} matching the given name.
*
* <p>Throws {@link IllegalArgumentException} if the given name does not match any directory in
* the output tree.
*/
public static OutputDirectory forName(String name) {
checkNotNull(name);
for (OutputDirectory directory : values()) {
if (directory.name.equals(name)) {
return directory;
}
}
throw new IllegalArgumentException(name);
}

private final String name;

OutputDirectory(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public byte[] get(
Supplier<BuildConfigurationValue> configurationSupplier, CommandEnvironment env) {
checkNotNull(env);
return print(
env.getDirectories()
.getExecRoot(configurationSupplier.get().getMainRepositoryName().strippedName()));
env.getDirectories().getExecRoot(configurationSupplier.get().getMainRepositoryName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public byte[] get(
Supplier<BuildConfigurationValue> configurationSupplier, CommandEnvironment env) {
checkNotNull(env);
return print(
env.getDirectories()
.getOutputPath(configurationSupplier.get().getMainRepositoryName().strippedName()));
env.getDirectories().getOutputPath(configurationSupplier.get().getMainRepositoryName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ public void testBasics() throws Exception {

BuildConfigurationValue config = create("--cpu=piii");
String outputDirPrefix =
outputBase
+ "/execroot/"
+ config.getMainRepositoryName().strippedName()
+ "/blaze-out/.*piii-fastbuild";
outputBase + "/execroot/" + config.getMainRepositoryName() + "/blaze-out/.*piii-fastbuild";

assertThat(config.getOutputDirectory(RepositoryName.MAIN).getRoot().toString())
.matches(outputDirPrefix);
Expand All @@ -73,7 +70,7 @@ public void testPlatformSuffix() throws Exception {
.matches(
outputBase
+ "/execroot/"
+ config.getMainRepositoryName().strippedName()
+ config.getMainRepositoryName()
+ "/blaze-out/.*k8-fastbuild-test");
}

Expand Down

0 comments on commit 2c9721f

Please sign in to comment.