aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2017-02-08 18:21:11 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-02-09 15:09:37 +0000
commite16c564b9d9cd4ee983ca7ae580000111fd12dda (patch)
tree9dae21422b72d4a22c19df0d36d3047bb79513f7 /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
parent26f858c9cda88c45da98f8df2090417042bac2f3 (diff)
Introduce a new SkyValue that merely contains the workspace name. The workspace name is needed for package loading, and so splitting out this computation into a separate skyframe node that can be change-pruned gives us better incrementality; previously we'd need to reload all packages on a WORKSPACE file change.
N.B. (i) This CL doesn't solve all the other performance issues with //external in Bazel/Blaze since it's still inefficiently used for resolving labels like @foo//bar:baz. (ii) This CL doesn't address the wasteful invalidation + change pruning of all the packages. -- PiperOrigin-RevId: 146925369 MOS_MIGRATED_REVID=146925369
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index e0116fceb4..7b3b1c6e96 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -448,13 +448,13 @@ public class PackageFunction implements SkyFunction {
if (packageId.equals(Label.EXTERNAL_PACKAGE_IDENTIFIER)) {
return getExternalPackage(env, packageLookupValue.getRoot());
}
- SkyKey externalPackageKey = PackageValue.key(Label.EXTERNAL_PACKAGE_IDENTIFIER);
- PackageValue externalPackage = (PackageValue) env.getValue(externalPackageKey);
- if (externalPackage == null) {
+ WorkspaceNameValue workspaceNameValue =
+ (WorkspaceNameValue) env.getValue(WorkspaceNameValue.key());
+ if (workspaceNameValue == null) {
return null;
}
- Package externalPkg = externalPackage.getPackage();
- if (externalPkg.containsErrors()) {
+ String workspaceName = workspaceNameValue.maybeGetName();
+ if (workspaceName == null) {
throw new PackageFunctionException(
new BuildFileContainsErrorsException(Label.EXTERNAL_PACKAGE_IDENTIFIER),
Transience.PERSISTENT);
@@ -502,7 +502,7 @@ public class PackageFunction implements SkyFunction {
? astLookupValue.getAST().getStatements() : ImmutableList.<Statement>of();
CacheEntryWithGlobDeps<Package.Builder> packageBuilderAndGlobDeps =
loadPackage(
- externalPkg,
+ workspaceName,
replacementContents,
packageId,
buildFilePath,
@@ -1107,7 +1107,7 @@ public class PackageFunction implements SkyFunction {
*/
@Nullable
private CacheEntryWithGlobDeps<Package.Builder> loadPackage(
- Package externalPkg,
+ String workspaceName,
@Nullable String replacementContents,
PackageIdentifier packageId,
Path buildFilePath,
@@ -1208,7 +1208,7 @@ public class PackageFunction implements SkyFunction {
SkyframeHybridGlobber skyframeGlobber = new SkyframeHybridGlobber(packageId, packageRoot,
env, legacyGlobber);
Package.Builder pkgBuilder = packageFactory.createPackageFromPreprocessingAst(
- externalPkg, packageId, buildFilePath, astAfterPreprocessing, importResult.importMap,
+ workspaceName, packageId, buildFilePath, astAfterPreprocessing, importResult.importMap,
importResult.fileDependencies, defaultVisibility, skyframeGlobber);
Set<SkyKey> globDepsRequested = ImmutableSet.<SkyKey>builder()
.addAll(globDepsRequestedDuringPreprocessing)