diff options
author | brandjon <brandjon@google.com> | 2017-10-26 18:03:24 +0200 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2017-10-27 16:29:26 +0200 |
commit | fba45f5695370fda1d8868a079223d4212b5484a (patch) | |
tree | 51ac33e73b6b1e19159795288ef02a4c8c9b6fcd /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java | |
parent | d1c9becbdefd4c138c70c9d160c54cca30efa023 (diff) |
Allow/require callers of AbstractPackageLoader to set Skylark semantics explicitly
Previously the default semantics were used unconditionally. Allowing non-default semantics is a feature. Requiring semantics to be specified explicitly helps to avoid unintentional divergence from the caller's intended semantics. We recently did the same thing for Skylark's Environment.Builder (https://github.com/bazelbuild/bazel/commit/b368b39f8ba1e8e8a67af50e5ade9127b2b149d7).
Also pass Skylark semantics through Package.Builder.Helper, so that the extra verification done for shell tests uses the same semantics as the build.
RELNOTES: None
PiperOrigin-RevId: 173544885
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.java | 8 |
1 files changed, 6 insertions, 2 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 c5d723293e..4893ac0091 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 @@ -423,6 +423,10 @@ public class PackageFunction implements SkyFunction { */ private SkyValue getExternalPackage(Environment env, Path packageLookupPath) throws PackageFunctionException, InterruptedException { + SkylarkSemantics skylarkSemantics = PrecomputedValue.SKYLARK_SEMANTICS.get(env); + if (skylarkSemantics == null) { + return null; + } RootedPath workspacePath = RootedPath.toRootedPath( packageLookupPath, Label.EXTERNAL_PACKAGE_FILE_NAME); SkyKey workspaceKey = ExternalPackageFunction.key(workspacePath); @@ -458,7 +462,7 @@ public class PackageFunction implements SkyFunction { } if (packageFactory != null) { - packageFactory.afterDoneLoadingPackage(pkg); + packageFactory.afterDoneLoadingPackage(pkg, skylarkSemantics); } return new PackageValue(pkg); } @@ -621,7 +625,7 @@ public class PackageFunction implements SkyFunction { // We know this SkyFunction will not be called again, so we can remove the cache entry. packageFunctionCache.invalidate(packageId); - packageFactory.afterDoneLoadingPackage(pkg); + packageFactory.afterDoneLoadingPackage(pkg, skylarkSemantics); return new PackageValue(pkg); } |