aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-01-17 14:36:26 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-17 14:37:59 -0800
commitee6a6862e26704854fb08bd90912890814cc3426 (patch)
tree294eac82202e393c5baae0e357325f2488ab3cbb /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parentf323fb3043bc782526e0e47933efedea9c5c2ad9 (diff)
Introduce Root class.
This class represents a root (such as a package path or an output root) used for file lookups and artifacts. It is meant to be as opaque as possible in order to hide the user's environment from sky keys and sky functions. Roots are used by RootedPaths and ArtifactRoots. This CL attempts to make the minimum number of modifications necessary to change RootedPath and ArtifactRoot to use these fields. Deprecated methods and invasive accessors are permitted to minimise the risk of any observable changes. RELNOTES: None PiperOrigin-RevId: 182271759
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index 00d0c34f19..780b4d8733 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -25,8 +25,8 @@ import com.google.devtools.build.lib.packages.ErrorDeterminingRepositoryExceptio
import com.google.devtools.build.lib.packages.NoSuchPackageException;
import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
import com.google.devtools.build.lib.syntax.EvalException;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
+import com.google.devtools.build.lib.vfs.Root;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionException;
@@ -120,7 +120,7 @@ public class PackageLookupFunction implements SkyFunction {
// to having restart the SkyFunction after every new dependency. However, if we try to batch
// the missing value keys, more dependencies than necessary will be declared. This wart can be
// fixed once we have nicer continuation support [skyframe-loading]
- for (Path packagePathEntry : pkgLocator.getPathEntries()) {
+ for (Root packagePathEntry : pkgLocator.getPathEntries()) {
// This checks for the build file names in the correct precedence order.
for (BuildFileName buildFileName : buildFilesByPriority) {
@@ -168,7 +168,7 @@ public class PackageLookupFunction implements SkyFunction {
private PackageLookupValue getPackageLookupValue(
Environment env,
- ImmutableList<Path> packagePathEntries,
+ ImmutableList<Root> packagePathEntries,
PackageIdentifier packageIdentifier,
BuildFileName buildFileName)
throws PackageLookupFunctionException, InterruptedException {
@@ -177,7 +177,7 @@ public class PackageLookupFunction implements SkyFunction {
// to having restart the SkyFunction after every new dependency. However, if we try to batch
// the missing value keys, more dependencies than necessary will be declared. This wart can be
// fixed once we have nicer continuation support [skyframe-loading]
- for (Path packagePathEntry : packagePathEntries) {
+ for (Root packagePathEntry : packagePathEntries) {
PackageLookupValue result =
getPackageLookupValue(env, packagePathEntry, packageIdentifier, buildFileName);
if (result == null) {
@@ -192,7 +192,7 @@ public class PackageLookupFunction implements SkyFunction {
private PackageLookupValue getPackageLookupValue(
Environment env,
- Path packagePathEntry,
+ Root packagePathEntry,
PackageIdentifier packageIdentifier,
BuildFileName buildFileName)
throws InterruptedException, PackageLookupFunctionException {
@@ -235,7 +235,7 @@ public class PackageLookupFunction implements SkyFunction {
if (localRepositoryPath.isAbsolute()) {
// We need the package path to also be absolute.
pathToRequestedPackage =
- packagePathEntry.asFragment().getRelative(pathToRequestedPackage);
+ packagePathEntry.getRelative(pathToRequestedPackage).asFragment();
}
PathFragment remainingPath = pathToRequestedPackage.relativeTo(localRepositoryPath);
PackageIdentifier correctPackage =
@@ -264,7 +264,7 @@ public class PackageLookupFunction implements SkyFunction {
}
private PackageLookupValue computeWorkspacePackageLookupValue(
- Environment env, ImmutableList<Path> packagePathEntries)
+ Environment env, ImmutableList<Root> packagePathEntries)
throws PackageLookupFunctionException, InterruptedException {
PackageLookupValue result =
getPackageLookupValue(
@@ -281,7 +281,7 @@ public class PackageLookupFunction implements SkyFunction {
if (packagePathEntries.isEmpty()) {
return PackageLookupValue.NO_BUILD_FILE_VALUE;
}
- Path lastPackagePath = packagePathEntries.get(packagePathEntries.size() - 1);
+ Root lastPackagePath = packagePathEntries.get(packagePathEntries.size() - 1);
FileValue lastPackagePackagePathFileValue = getFileValue(
RootedPath.toRootedPath(lastPackagePath, PathFragment.EMPTY_FRAGMENT),
env,
@@ -326,14 +326,14 @@ public class PackageLookupFunction implements SkyFunction {
PathFragment buildFileFragment =
id.getPackageFragment().getRelative(buildFileName.getFilenameFragment());
RootedPath buildFileRootedPath =
- RootedPath.toRootedPath(repositoryValue.getPath(), buildFileFragment);
+ RootedPath.toRootedPath(Root.fromPath(repositoryValue.getPath()), buildFileFragment);
FileValue fileValue = getFileValue(buildFileRootedPath, env, packageIdentifier);
if (fileValue == null) {
return null;
}
if (fileValue.isFile()) {
- return PackageLookupValue.success(repositoryValue.getPath(), buildFileName);
+ return PackageLookupValue.success(Root.fromPath(repositoryValue.getPath()), buildFileName);
}
}