aboutsummaryrefslogtreecommitdiffstats
path: root/context_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Make sure all modules have a name. (#226)Jaewoong Jung2018-10-111-0/+26
| | | | | | | Throw an error if run into a module without a name when generating contexts. Test: context_test.go Change-Id: I3976d86d1f15b8ac10a7a38aa42ae277740a8f3b
* Prevent duplicate visit calls in WalkDepsColin Cross2018-06-211-24/+25
| | | | | | | | | | | WalkDeps was following every possible path through the dependency tree, which can be enormous. Modify it to only call visit for any particular (child, parent) pair once for each direct dependency by not recursing into child if visitDown returns true but child has already been visited. Test: TestWalkDeps, TestWalkDepsDuplicates Change-Id: Ieef28399bd10e744417cdeb661dfa04fbeb4ec60
* Allow multiple dependencies on the same moduleColin Cross2018-06-201-3/+92
| | | | | | | | | | | | Allow adding multiple dependencies on the same module. Adds a flag to Context.walkDeps to determine whether dependencies should be visited multiple times, and clarifies the behavior of VisitDepsDepthFirst (continues to visit each module once, even if there are multiple dependencies on it) and VisitDirectDeps (may visit a module multiple times). Test: TestWalkDepsDuplicates, TestVisit Change-Id: I58afbe90490aca102d242d63e185386e1fe55d73
* prevent file=nil panic if syntax error in BlueprintsJeff Gaston2017-12-051-0/+39
| | | | | | | | | | Bug: 65683273 Test: build/soong/scripts/diff_build_graphs.sh \ 'build/blueprint:work^^^' 'build/blueprint:work' Test: put a syntax error in a file and see that the reported error reports the location of the violation Change-Id: Iaeedb91ea8e816cb8e9ee954f21cd6c6bc4afa48
* Have handleOneFile(child) wait for handleOneFile(parent).Jeff Gaston2017-12-041-1/+72
| | | | | | | Bug: 65683273 Test: m -j nothing # which runs unit tests Change-Id: I850e78ebcdbee68637f66d81fc127f19dd28508a
* Extract module naming into an interfaceJeff Gaston2017-11-291-5/+5
| | | | | | | | | | | | | | in facilitate moving name resolution to Soong Bug: 65683273 Test: build/soong/scripts/diff_build_graphs.sh \ --products=aosp_arm \ 'build/blueprint:work^' 'build/blueprint:work' # and see that the only changes were: # 1. adding the name_interface.go file # 2. changing some line numbers Change-Id: Ifa7603cca59b3b3d592f2f146fdafe57012bd4b9
* Support for a custom list of Blueprints files to parseJeff Gaston2017-10-301-1/+3
| | | | | | | Bug: 64363847 Test: BLUEPRINT_LIST_FILE=out/.module_paths/Android.bp.list minibp Change-Id: Id7f8cb1ab3a6684b3f8265d77bb32413957f1c93
* Clarify context.go somewhatJeff Gaston2017-10-301-1/+1
| | | | | | | | in preparation to support parsing a predefined list of Blueprints files Bug: 64363847 Test: m -j Change-Id: I98cc98dc17ecaf69b95272d32cd83adbdb0e8c5b
* Let mutators use ctx.AddNinjaFileDepsColin Cross2017-08-011-3/+3
| | | | | | | | Propagate extra ninja file deps through mutators so that they can use ctx.AddNinjaFileDeps. Test: blueprint tests Change-Id: I299a0665c3f63b020ae345889fd78b91b91b215a
* Add TopDownMutatorContext.CreateModuleColin Cross2017-08-011-0/+79
| | | | | | | | | | | Allow a module to create other modules as if they were specified in a blueprint file. CreateModule takes the name of a module type, calls the factory function the module type, and then inserts properties into the property structs returned by the factory. Bug: 64161749 Test: TestCreateModule Change-Id: Ic1903305d6b08eae1edc7f0fb4137e85544aac0f
* Import globbing from SoongColin Cross2016-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | Add globbing with dependency checking to blueprint. Calling ModuleContext.GlobWithDeps or SingletonContext.GlobWithDeps will return a list of files that match the globs, while also adding efficient dependencies to rerun the primary builder if a file that matches the glob is added or removed. Also use the globbing support for optional_subdirs=, subdirs= and build= lines in blueprints files. The globbing slightly changes the behavior of subname= lines, it no longer falls back to looking for a file called "Blueprints". Blueprint files that need to include a subdirectory with a different name can use build= instead of subdir= to directly include them. The Blueprints file is updated to reset subname="Blueprints" in case we want to include subdirectories inside blueprint and the primary builder has changed the subname. Also adds a new test directory that contains a simple primary builder tree to test regeneration for globbing, and runs the tests in travis. Change-Id: I83ce525fd11e11579cc58ba5308d01ca8eea7bc6
* Ask primary builder for module namesColin Cross2016-10-121-7/+19
| | | | | | | | Remove the assumed Name and Deps properties. Instead, ask the Module for the Name, and require them to use the existing replacements for Deps. Change-Id: I729045d86277686078b3aa0bba71c67d612ead2c
* Reimplement VisitDirectDeps[If] in on Context.walkdepsColin Cross2016-08-081-6/+15
| | | | | | | | | VisitDirectDeps[If] need to know the parent in order to support OtherModuleDependencyTag(), remove Context.visitDirectDeps[If] and reimplement [Module]Context.VisitDirectDeps[If] using Context.walkdeps. Change-Id: I2faac2d100d2a0ad2a4f1d8250997eed1a7ef6f0 Test: TestVisit
* Allow tests to mock filesystemColin Cross2016-08-081-2/+54
| | | | | | | Tests can call Context.MockFileSystem to pass in a map of filenames to contents. Change-Id: Idd67c68f7cb43bc2117cc78336347db7e2f21991
* Deprecate EarlyMutator and DynamicDependenciesColin Cross2015-10-291-11/+1
| | | | | | | | DynamicDependencies can be implemented more flexibly by a BottomUpMutator. If there are no DynamicDependencies, then EarlyMutators are identical to BottomUpMutators. Deperecate both, and reimplement DynamicDependencies inside a BottomUpMutator that is guaranteed to be registered first.
* Added test for walkDeps.Yuchen Wu2015-10-091-0/+39
|
* Add support for build= variableColin Cross2015-04-201-1/+1
| | | | | | | | | | | | | | | | build is a magic variable that acts similarly to subdirs, but specifies files to build instead of subdirs. Using files provides a few advantages: files can be named something more appropriate for the project than "Blueprints", whatever you want instead of Blueprints, and multiple Blueprints files can exist in the same directory. A new variable is used instead of putting filenames into subdirs to avoid unexpected behavior when a glob matches both files and directories. subdirs= and build= entries that don't match any directories or files are now reported as errors. Change-Id: Id329504ace251eab4ccea1081a3c8665a4c52f5a
* Add license headers and LICENSE fileColin Cross2015-01-231-0/+14
| | | | Change-Id: I6f7c7374093c0745ee4aa677480376a06648b358
* Move blueprint/* up a directoryColin Cross2015-01-231-0/+87
Make integrating with go tools easier by putting the blueprint package files in the top level directory of the git project instead of in a subdirectory called blueprint. Change-Id: I35c144c5fe7ddf34e478d0c47c50b2f6c92c2a03