aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/packages/util/PackageFactoryApparatus.java
Commit message (Collapse)AuthorAge
* Process 'repo_mapping' attribute from WORKSPACE rules. 'repo_mapping' is a ↵Gravatar dannark2018-06-04
| | | | | | | | | | | | | | | | way to remap references to repositories within an external repository by another name. This CL only adds the mappings to the Package object, but it does not actually enable the reassignments. Example usage (in a WORKSPACE file): local_repository( name = ?a?, path = ?../a?, repo_mapping = {?@x? : ?@y?} ) This change also creates a new SkyKey which represents the mappings. This is to prevent all packages from depending on the external package, and instead depending just on the mappings. i.e. a change to the WORKSPACE file that does not touch the mappings shouldn't cause a reload of the package. RELNOTES:None PiperOrigin-RevId: 199187963
* Clean up code that directly imports nested classes like Builder, Entry, etc.Gravatar jcater2018-05-01
| | | | PiperOrigin-RevId: 194985157
* New incompatible flag to disable PACKAGE_NAME and REPOSITORY_NAME.Gravatar laurentlb2018-03-27
| | | | | | | | | 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
* Remove a unused parameter in PackageFactory#evaluateBuildFile().Gravatar lberki2018-03-23
| | | | | RELNOTES: None. PiperOrigin-RevId: 190207183
* Victory lap: Remove all code that used to support the three-argument form of ↵Gravatar lberki2018-03-23
| | | | | | | vardef(). RELNOTES: None. PiperOrigin-RevId: 190196933
* Break dependency on vfs from the interface of syntax and cmdline.Gravatar tomlu2017-11-06
| | | | | | | | These libs are exposed externally, implying that the vfs is also exposed externally. We break out PathFragment from vfs to still use this in their interface. This class is a much smaller dependency than the entire vfs. PiperOrigin-RevId: 174729373
* Pass SkylarkSemantics through Skyframe instead of the options classGravatar brandjon2017-10-06
| | | | | | | Also remove the use of the @UsesOnlyCoreTypes annotation on SkylarkSemanticsOptions. It was only there to help mark that the options class was safe to put in Skyframe. RELNOTES: None PiperOrigin-RevId: 171248504
* If globbing throws an IOException, fail to construct the package instead of ↵Gravatar janakr2017-07-14
| | | | | | | | constructing the package with an error. Prior to this change, if a Package.Builder object was constructed, it was guaranteed that a Package (possibly with errors) would be created. This is no longer true: if an IOException is set on the Package.Builder object, it will throw a NoSuchPackageException during #build(). PiperOrigin-RevId: 161832111
* Inline AttributeContainer.ATTRIBUTE_CONTAINER_FACTORY and ↵Gravatar laurentlb2017-07-03
| | | | | | | PathFragment.TO_PATH_FRAGMENT RELNOTES: None. PiperOrigin-RevId: 160668541
* Propagate postable events further upGravatar Klaus Aehlig2017-06-14
| | | | | | | | | | | | With the introduction of the ExtendedEventHandler, SkyFunctions were given the possibility to post additional Postable events in addition to the standard events. As SkyFunctions have to be restartable, events are collected first and only posted after the function is finished. Make sure that this also applies to postable events and they are not dropped. Change-Id: Ie1c3a0134935c75ea984fa2cc924e7327a9da81f PiperOrigin-RevId: 158964337
* Make Skylark interpreter read Skylark command-line flagsGravatar brandjon2017-04-30
| | | | | | | | | | | This is the second of two CLs for making command line options able to affect the Skylark interpreter. For the main kinds of evaluation contexts -- package loading, .bzl loading, rule analysis, aspect analysis, and computed defaults -- the SkylarkSemanticsOptions object is retrieved from Skyframe and passed along to the Environment builder. For other contexts such as tests, default values of builtin functions, and standalone Skylark, flags are currently not processed. In the future, we may want to split into separate files the options that affect "pure" Skylark vs the options that affect Bazel-flavored Skylark. One possibility is to subclass SkylarkSemanticsOptions into SkylarkBazelSemanticsOptions, and go through an indirection in SkylarkUtils. We could also pass SkylarkSemanticsOptions to the parser, to support --incompatible_* changes that alter Skylark's syntax. I don't think that's needed at the moment. RELNOTES: None PiperOrigin-RevId: 154628391
* Introduce a new SkyValue that merely contains the workspace name. The ↵Gravatar Nathan Harmata2017-02-09
| | | | | | | | | | | | 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
* Add the option --experimental_max_directories_to_eagerly_visit_in_globbing. ↵Gravatar Janak Ramakrishnan2016-10-05
| | | | | | | The first legacy glob that a package requires will, if this option is enabled, cause up to that many directories to be eagerly visited by a glob(['**']). The results are thrown away for memory reasons. -- MOS_MIGRATED_REVID=135148361
* Automated [] rollback of commit 846a5ab98fc26d72024890fdb79a5d3bc6a5a1ba + ↵Gravatar Nathan Harmata2016-08-23
| | | | | | | | | | | | | | | manual rollback of [] *** Reason for rollback *** Depot has been fixed / is in the process of being fixed. See the work tracked on [] *** Original change description *** Automated [] rollback of commit bb5d5efb4b50710241b5b374eb67084f4bf08278. -- MOS_MIGRATED_REVID=131095905
* Rollback of commit bb5d5efb4b50710241b5b374eb67084f4bf08278.Gravatar Tobias Werth2016-08-23
| | | | | -- MOS_MIGRATED_REVID=130941264
* RELNOTES: The string list returned by the skylark 'glob' function is now ↵Gravatar Nathan Harmata2016-08-18
| | | | | | | | | | | | | | sorted. Previously, it would return a list formed by concatenating the sorted results of each pattern in the 'includes' list. A bunch of cleanups and one bug fix: -Remove the unused-except-for tests GlobCache#globsUpToDate. This code has been dead for a very very long time, ever since we switched to using Skyframe. -Change the semantics of the 'glob' function as described above. -Change UnixGlob to return unsorted results. Document this in UnixGlob and GlobCache. -Change LegacyGlobber to conditionally return sorted results. Have users other than PackageFunction get sorted results (as described above). Have PackageFunction's use case get completely unsorted results, and have PackageFunction do the sorting itself. -Have PackageFunction's HybridGlobber unconditionally sort the glob result list. This ensure deterministic glob results, fixing a bug where the order of the elements of the result depended on the contents of the Skyframe graph, which of course depends on the sequence of incremental Blaze commands. -- MOS_MIGRATED_REVID=130540152
* Start removing the parsePython booleanGravatar Laurent Le Brun2016-08-03
| | | | | | | It's still used in one place and should be removed completely in October. -- MOS_MIGRATED_REVID=129207133
* Allow BlazeModules to expose a helper that PackageFactory will use for ↵Gravatar Nathan Harmata2016-05-27
| | | | | | | creating fresh Package instances. Also make a few Package methods public. -- MOS_MIGRATED_REVID=123247246
* Remove Package.LegacyBuilder (unneeded as of commit ↵Gravatar Nathan Harmata2016-05-25
| | | | | | | 3a95f353704dc2f7061e2c0786c2459ac1db0fd1). -- MOS_MIGRATED_REVID=123107954
* Allow modules to inject a custom AttributeContainer.Gravatar Janak Ramakrishnan2016-05-12
| | | | | | | | | | | | | | | | | | | | | | | | | Rollback of commit cda4b4eae0c495a8f90f2a70a8db46e34062ee26. *** Reason for rollback *** Roll-forward with fixes (see ExternalPackageBuilder). *** Original change description *** Automated [] rollback of commit 178a3dfda8bf72abf22758597a90a4afb8eed181. *** Reason for rollback *** Broke ci.bazel.io. See #1234. *** Original change description *** Allow modules to inject a custom AttributeContainer. -- MOS_MIGRATED_REVID=122100417
* Rollback of commit 178a3dfda8bf72abf22758597a90a4afb8eed181.Gravatar Damien Martin-Guillerez2016-05-06
| | | | | | | | | | | | | | | *** Reason for rollback *** Broke ci.bazel.io. See #1234. *** Original change description *** Allow modules to inject a custom AttributeContainer. -- MOS_MIGRATED_REVID=121658474
* Allow modules to inject a custom AttributeContainer.Gravatar Janak Ramakrishnan2016-05-04
| | | | | -- MOS_MIGRATED_REVID=121497233
* Don't keep packages in the default repository around after loading.Gravatar Brian Silverman2016-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this would get thrown when referring to the same package from both the main and default repositories: java.lang.IllegalArgumentException: Multiple entries with same key: tools/cpp=/home/brian/971-Robot-Code and tools/cpp=/home/brian/971-Robot-Code at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:136) at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:98) at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:84) at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:295) at com.google.devtools.build.lib.buildtool.BuildTool.transformPackageRoots(BuildTool.java:301) at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:209) at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:334) at com.google.devtools.build.lib.runtime.commands.TestCommand.doTest(TestCommand.java:119) at com.google.devtools.build.lib.runtime.commands.TestCommand.exec(TestCommand.java:104) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:371) at com.google.devtools.build.lib.runtime.BlazeRuntime$3.exec(BlazeRuntime.java:1016) at com.google.devtools.build.lib.server.RPCService.executeRequest(RPCService.java:65) at com.google.devtools.build.lib.server.RPCServer.executeRequest(RPCServer.java:434) at com.google.devtools.build.lib.server.RPCServer.serve(RPCServer.java:229) at com.google.devtools.build.lib.runtime.BlazeRuntime.serverMain(BlazeRuntime.java:975) at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:772) at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:55) And this would get thrown for any packages in the main repository loaded from other repositories: java.lang.RuntimeException: Unrecoverable error while evaluating node 'PACKAGE:@//tools/build_rules/go/toolchain' (requested by nodes ) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:982) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:499) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: Invalid BUILD file name for package '@//tools/build_rules/go/toolchain': /home/brian/bazel/tools/build_rules/go/toolchain/BUILD at com.google.devtools.build.lib.packages.Package.finishInit(Package.java:299) at com.google.devtools.build.lib.packages.Package$Builder.finishBuild(Package.java:1308) at com.google.devtools.build.lib.skyframe.PackageFunction.compute(PackageFunction.java:501) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:933) ... 4 more Sponsor's comment: note the abundance of new Label.resolveRepositoryRelative() calls. They are ugly, but it's only making existing ugliness explicit. Yes, we should fix it, especially in the implementation of configurable attributes. Refs #940 -- Change-Id: I8bd7f7b00bec58a7157507595421bc50c81b404c Reviewed-on: https://bazel-review.googlesource.com/#/c/2591 MOS_MIGRATED_REVID=117429733
* Adds bazel_version to the native module for workspace macros.Gravatar Damien Martin-Guillerez2016-03-15
| | | | | | | | | | | | | | | | | | | | | One can now invoke native.bazel_version to get the version of Bazel from the WORKSPACE file. This can be used to do version check, for instance: version.bzl: def check_version(x): if native.bazel_version < x: fail("Current Bazel version is {}, expected at least {}".format(native.bazel_version, x)) WORKSPACE: load("//:version.bzl", "check_bersion") check_version("0.2") Fixes #1014. -- MOS_MIGRATED_REVID=117231557
* Enable label-based Skylark loading. In particular, such labels may reference ↵Gravatar John Field2015-12-22
| | | | | | | | | | | | | | | | | | | files in external repositories. In addition: - Cleaned up and refactored some tests to reflect the new loading behavior. Deferred to future CLs: - Updating Bazel Skylark documentation to reflect the new load form. - Enabling command-line loading of Aspects via labels. RELNOTES: Skylark load statements may now reference .bzl files via build labels, in addition to paths. In particular, such labels can be used to reference Skylark files in external repositories; e.g., load("@my_external_repo//some_pkg:some_file.bzl", ...). Path-based loads are now deprecated and may be disabled in the future. Caveats: Skylark files currently do not respect package visibility; i.e., all Skylark files are effectively public. Also, loads may not reference the special //external package. -- MOS_MIGRATED_REVID=110786452
* Open source more tests for packages/Gravatar Han-Wen Nienhuys2015-10-22
| | | | | | | | | | Tested: bazel test on merge-to-os-blaze.sh checked total test method count on blaze test //javatests/com/google/devtools/build/lib:PackagesTests //third_party/bazel/src/test/java/com/google/devtools/build/lib:packages-tests -- MOS_MIGRATED_REVID=105963077
* Remove the repository name from PACKAGE_NAME and move it to the new ↵Gravatar Lukacs Berki2015-10-21
| | | | | | | REPOSITORY_NAME symbol. -- MOS_MIGRATED_REVID=105954652
* Replace "Google Inc" with "The Bazel Authors" in every copyright notice.Gravatar Lukacs Berki2015-10-21
| | | | | -- MOS_MIGRATED_REVID=105949508
* Use EventHandler rather than Reporter where possible inGravatar Han-Wen Nienhuys2015-09-28
| | | | | | | PackageFactoryTest and PackageFactoryApparatus. -- MOS_MIGRATED_REVID=104094984
* Simplify PackageFactoryApparatus.Gravatar Han-Wen Nienhuys2015-09-28
| | | | | -- MOS_MIGRATED_REVID=104086390
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Do not store a separate map for external package data. This ensures that ↵Gravatar Han-Wen Nienhuys2015-09-21
| | | | | | | | | serialization works correctly. Removes ExternalPackage as Package specialization. -- MOS_MIGRATED_REVID=103395682
* Remove support for the deprecated include() statement in order to be able to ↵Gravatar Lukacs Berki2015-09-21
| | | | | | | | | separate Skylark from the rest of the code so that Label parsing can be simplified. This is another go at []: now that the tests were fixed in [] and [] it can be submitted again. -- MOS_MIGRATED_REVID=103364881
* Rollback of commit 4e5037520e3067f9d8784e1c59f9545b96111cd4.Gravatar Lukacs Berki2015-09-17
| | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke tests, I mistakenly assumed it was flakiness. *** Original change description *** Remove support for the deprecated include() statement. This is part of the crusade to eliminate as every dependency in Skylark on the rest of the code so that it can be moved deeper in the dependency graph. RELNOTES: The include() statement in BUILD files is not supported anymore. -- MOS_MIGRATED_REVID=103284257
* Remove support for the deprecated include() statement.Gravatar Lukacs Berki2015-09-17
| | | | | | | | | This is part of the crusade to eliminate as every dependency in Skylark on the rest of the code so that it can be moved deeper in the dependency graph. RELNOTES: The include() statement in BUILD files is not supported anymore. -- MOS_MIGRATED_REVID=103279943
* Get rid of transient errors during preprocessing and throw IOExceptions ↵Gravatar Janak Ramakrishnan2015-09-16
| | | | | | | instead. Transient errors were only detected on IOExceptions, but preprocessing doesn't actually throw IOExceptions except if it fails before it even opens the main file, so there's no sense in trying to construct a package in that case. -- MOS_MIGRATED_REVID=103119445
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-11
| | | | | | | | | | | | | | | | | | | | Make Environment-s freezable: Introduce a class Mutability as a revokable capability to mutate objects in an Environment. For now, only Environment-s carry this capability. Make sure that every Mutability is revoked in the same function that create... This reinstates a change that previously rolled-back because it broke the serializability of SkylarkLookupValue. Bad news: serializing it succeeds for the wrong reason, because a SkylarkEnvironment was stored as a result (now an Environment.Extension) that was Serializable but inherited its bindings from an Environment (now an Environment.BaseExtension) which wasn't Serializable. Apparently, Java doesn't try to serialize the bindings then (or at least doesn't error out when it fails), because these bindings map variable names to pretty arbitrary objects, and a lot of those we find in practice aren't Serializable. Thus the current code passes the same tests as the previous code, but obviously the serialization is just as ineffective as it used to be. -- MOS_MIGRATED_REVID=102776694
* Rollback of commit 5a94e59f02833f9142bad9203acd72626b089535.Gravatar Janak Ramakrishnan2015-09-08
| | | | | | | | | *** Reason for rollback *** Breaks serialization of SkyValues. -- MOS_MIGRATED_REVID=102457225
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-08
| | | | | | | | | | | | | | | | | Make Environment-s freezable: Introduce a class Mutability as a revokable capability to mutate objects in an Environment. For now, only Environment-s carry this capability. Make sure that every Mutability is revoked in the same function that creates it, so no Environment is left open for modification after being created and exported; exceptions for tests, the shell and initialization contexts. Unify Environment, SkylarkEnvironment and EvaluationContext into Environment. Have a notion of Frame for the bindings + parent + mutability. Replace the updateAndPropagate mechanism by a dynamicFrame. Simplify ValidationEnvironment, that is now always deduced from the Environment. -- MOS_MIGRATED_REVID=102363438
* Inject the default runfiles prefix from the rule class provider.Gravatar Ulf Adams2015-09-04
| | | | | -- MOS_MIGRATED_REVID=102341264
* Move PackageIdentifier to cmdlineGravatar Kristina Chodorow2015-08-31
| | | | | | | | This is necessary to have TargetResolver depend on it without making it depend on the packages target. First step of #389. -- MOS_MIGRATED_REVID=101790345
* Make globs work in remote repositories.Gravatar Lukacs Berki2015-07-08
| | | | | | | | | | | This involved quite a few changes, mainly changing a bunch of places where we refer to packages by a PathFragment to PackageIdentifier. The only wart is the code in PathPackageLocator: ideally, it would just call into PackageLookupFunction. Unfortunately, it is (through globbing and Parser.include) called from within a Skyframe function, and we don't want to have two eval() calls going on at the same time, so we cannot use that. There is a potential correctness issue there: PathPackageLocator now assumes where external repositories are put and assumes that they are there when it gets control, but my understanding is that the associated RepositoryValue is always evaluated before, so it works out okay. -- MOS_MIGRATED_REVID=97751539
* Rollback of accidentally submitted change.Gravatar Lukacs Berki2015-07-07
| | | | | -- MOS_MIGRATED_REVID=97648982
* Make globs work in remote repositories.Gravatar Lukacs Berki2015-07-07
| | | | | | | | | | | This involved quite a few changes, mainly changing a bunch of places where we refer to packages by a PathFragment to PackageIdentifier. The only wart is the code in PathPackageLocator: ideally, it would just call into PackageLookupFunction. Unfortunately, it is (through globbing and Parser.include) called from within a Skyframe function, and we don't want to have two eval() calls going on at the same time, so we cannot use that. There is a potential correctness issue there: PathPackageLocator now assumes where external repositories are put and assumes that they are there when it gets control, but my understanding is that the associated RepositoryValue is always evaluated before, so it works out okay. -- MOS_MIGRATED_REVID=97647787
* Make PackageFactoryApparatus#getPackageLocator public.Gravatar Han-Wen Nienhuys2015-05-18
| | | | | -- MOS_MIGRATED_REVID=93717032
* Open source a few more analysis tests.Gravatar Ulf Adams2015-05-04
-- MOS_MIGRATED_REVID=92715161