The motivaion for this change is to allow writing code that uses the
newly added dependency module in the same mutator pass, for example to
add more dependencies. Like this:
for _, m := range ctx.AddVariationDependencies(nil, tag, deps...) {
if someModuleProperty(m); ok {
ctx.AddVariationDependencies(nil, tag, otherDep)
}
}
Note that there is no guarantee that the returned module has already
been processed by the current mutator.
The patch does not add runtime overhead on findng dependency modules,
as this has already been done previously.
Test: go test
Pass a channel to visitor functions called by parallelVisit that
allows them to pause the current visitor until a given visitor
has finished. This allows parallelVisit to work on a dependency
graph while it is being mutated.
Test: Test_parallelVisit
Change-Id: Id8b1542c22ac9914439310e31d992ae0d7318d69
* aosp/upstream:
Relax check in moduleMatchingVariant
Fix AddFarVariationDependencies subset checks
Maintain ordering between variants and aliases
Add tests for findVariant
Test: m checkbuild
Change-Id: I4c166ff93a09fe4c6d700c82f79548f0b4afdae0
Pull request #317 made the equality check in moduleMatchingVariant
more correct by comparing the variant maps instead of the names.
Using only the names effectively ignores any variation with an
empty name. Unfortuantely this broke a current user of
ReplaceDependenciesIf. Go back to the relaxed check for now.
Test: build on a branch with sdk modules
Change-Id: I11016c8df7bd91fd022d04fd3033756f54d7fa0b
AddFarVariationDependencies claims to take the first variant that
matches all the requested variations, but it did nothing of the sort.
It took the first variant that either matched or did not contain each
of the requested variations. A module with no variations was always
matched, and requesting variations that didn't apply to a module
still matched (for example, requesting an image variation for a
host module that was ignored by the image mutator).
Fix AddFarVariationDependencies by making subset actually check
for subsets.
Test: Test_findVariant
Change-Id: I10063fec342db2a1c0685a7db08e4a650d14bd4e
AddFarVariationDependencies takes the first matching variant. To
maintain sensible behavior on a module with aliases, the ordering
of aliases and module variants needs to be maintained so that
AddFarVariationDependencies can find an earlier matching alias
instead of a more specific variant.
Test: go test .
Change-Id: I78f4e96edd98159f3a62d94e240e5d652667bec4
Add tests for findVariant behavior that provides the matching
behaviors of AddVariationDependencies, AddFarVariationDependencies,
etc.
Test: Test_findVariant
Change-Id: I3494d57179c8b3d62f7d32e5a1b43c9b9672c2df
* aosp/upstream:
Enable variants of bootstrap modules
Make VisitAllModuleVariants, PrimaryModule and FinalModule available to mutators
bpmodify: handle nested properties
Test: m checkbuild
Change-Id: I9785802ed33fa819b705317cd50c38432972e94c
The primary builder may want to create variants of bootstrap
modules if they need to fit in to the primary builder's dependency
graph. Enable arbitrary variants of bootstrap modules by only
running the module's actions on the primary variant and then
copying the result to any other variants that exist.
Test: m checkbuild
Change-Id: I24b97771bb11faeacab4079ed8cf69aef59da140
Move the VisitAllModuleVariants, PrimaryModule and FinalModule methods to
baseModuleContext so they can be used by mutators.
Test: m checkbuild
Change-Id: I1827ce2fc75f017460a7f6a53b1dab6a81109435
CreateAliasVariation creates a new variation for the current mutator
that is an alias to a variation that was created with CreateVarations
by the same mutator. It is similar to AliasVariation, except that
AliasVariation creates an alias from the pre-mutated variant to one
of the new variations, while CreateAliasVariation creates an alias
from a new post-mutated variation to one of the new variations.
Bug: 164216768
Test: TestCreateAliasVariation
Change-Id: I8847b8d6fc1d3248abc910b2fe2399881f9bdaee
* aosp/upstream:
Android inclusive language fixit. Make comment more succinct, clear and remove use of term "sanity".
Update bpdocs to filter nested properties by tags (#312)
Bug: 162536543
Test: m checkbuild
Change-Id: I4b40b1637e142d2f2fd513f62357213a9832bbaa
* Update bpdocs to filter nested properties by tag
Prior to this change nested properties tagged with `blueprint:"mutated"`
are erroneously included in documentation, this corrects that behavior
and adds testing to verify.
Tested: go test bpdocs tests
Change-Id: I822c9a98276634d2f584d8709e83003824cdffd5
* aosp/upstream:
Add flag to use validations for tests
Add Validations support to Blueprint
Remove unused Context.ModulePath
Test: m checkbuild
Change-Id: Ib63d651e79801121681dff449136067d1ea3b321
The Android fork of Ninja supports "validations", a node that is
added to the top level of the build graph whenever another node
is in the build graph. Add support in Blueprint to specify them
on build statements and write them to the ninja.
Test: ninja_writer_test.go
Change-Id: I87cd1281dbd2ed113cc26a265c50d20c65118c91
Context.ModulePath is a duplicate of Context.BlueprintFile, and is
misleading because it returns the path to the Android.bp, and not
the path to the directory that contains the Android.bp file like
ModuleContext.ModuleDir.
Change-Id: I505136fce3c3d37595cd4b4e08de5e2691a2a0f6
* aosp/upstream:
Stop writing depfiles from Glob singleton
Bug: 159845846
Test: manually check that changes to directories cause glob re-execution
Test: second build after a clean does not rerun soong_build
Change-Id: I1f257f3f11f70cb407397854fd85292dd0d0b08e
This makes a minimal difference on my AOSP tree (which is on a fast NVME
drive), but it saves ~10-15% of the time in our primary builder
(soong_build) on larger trees on slower drives.
We're always going to run the glob tool at least once outside of the
primary builder, and ninja only loads depfiles created after running the
tool, so this should be a no-op change.
We still need to write the list file (if it has changed), since that's
the file we're adding as a dependency of the primary builder, so the
effective timestamp must be earlier than the build.ninja timestamp.
Change-Id: I872b7581da50e7f2089daa7e248ca05b6703f019
* aosp/upstream:
Use github actions instead of travis
Export ModuleListFile in bootstrap (with fix) (#304)
Revert "Merge pull request #301 from c-parsons/modulelistfile"
Revert "Always emit rules for tests and add phony to run them"
Revert changes to singleton_ctx.go
Change bootstrap.moduleListFile to be exported
Add a getter for ModuleListFile to SingletonContext
Test: `m nothing` and treehugger
Change-Id: I37cb1b08d962ab34d3b7d7999496795986315217