From 1cbce0fad88d02c76386e8525e03d0f427515ad2 Mon Sep 17 00:00:00 2001 From: laurentlb Date: Tue, 27 Mar 2018 12:43:22 -0700 Subject: [PATCH] New incompatible flag to disable PACKAGE_NAME and REPOSITORY_NAME. RELNOTES[INC]: Variables PACKAGE_NAME and REPOSITORY_NAME are deprecated in favor of functions `package_name()` and `repository_name()`. https://docs.bazel.build/versions/master/skylark/lib/native.html#package_name PiperOrigin-RevId: 190657188 --- .../build/lib/packages/PackageFactory.java | 19 +++++--- .../lib/packages/SkylarkSemanticsCodec.java | 2 + .../lib/packages/SkylarkSemanticsOptions.java | 14 ++++++ .../devtools/build/lib/syntax/Identifier.java | 20 +++++++++ .../build/lib/syntax/SkylarkSemantics.java | 29 ++++++++++++ .../lib/packages/PackageFactoryTest.java | 22 +++++++++ .../SkylarkSemanticsConsistencyTest.java | 2 + .../util/PackageFactoryApparatus.java | 45 ++++++++++++++----- .../TransitiveTraversalFunctionTest.java | 8 +++- 9 files changed, 145 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java index dce457b195d7e4..25fc689d8e316b 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java +++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java @@ -1331,7 +1331,13 @@ public Package createPackageForTesting( throws NoSuchPackageException, InterruptedException { Package externalPkg = newExternalPackageBuilder( buildFile.getRelative(Label.WORKSPACE_FILE_NAME), "TESTING").build(); - return createPackageForTesting(packageId, externalPkg, buildFile, locator, eventHandler); + return createPackageForTesting( + packageId, + externalPkg, + buildFile, + locator, + eventHandler, + SkylarkSemantics.DEFAULT_SEMANTICS); } /** @@ -1344,7 +1350,8 @@ public Package createPackageForTesting( Package externalPkg, Path buildFile, CachingPackageLocator locator, - ExtendedEventHandler eventHandler) + ExtendedEventHandler eventHandler, + SkylarkSemantics semantics) throws NoSuchPackageException, InterruptedException { String error = LabelValidator.validatePackageName(packageId.getPackageFragment().getPathString()); @@ -1372,7 +1379,7 @@ public Package createPackageForTesting( /*imports=*/ ImmutableMap.of(), /*skylarkFileDependencies=*/ ImmutableList.