Commit graph

12 commits

Author SHA1 Message Date
Colin Cross
69a680feec Prevent defaults modules from expanding path property dependencies
Defaults modules should not have dependencies added to them for
path properties, the properties will already have been squashed
into other modules that depend on the defaults modules, and the
path dependencies will be added to those modules.

Fixes: 321056451
Test: TestDefaultsPathProperties
Change-Id: I59049f94b7a0924a7b1d997d15723901b0d522ee
2024-01-29 21:21:30 +00:00
Liz Kammer
eeeb952b27 Revert "Add protected_properties support in defaults modules"
This reverts commit 799962789a.

Test: m nothing
Change-Id: Ia43c2ee216dc42ae5cf3e4d138aa9d0e05a9ee60
2023-03-10 18:53:59 -05:00
Paul Duffin
799962789a Add protected_properties support in defaults modules
Previously, there was no way to prevent a module from overriding a
value provided by a defaults. That made it difficult to ensure
consistency across modules, e.g. for modules that use
framework-module-defaults.

This change adds the protected_properties property to defaults modules
which allows a default module to list those properties that should not
be changed by a module applying those defaults.

Properties can either be listed explicitly by name, or it can just be
a single "*" in which case all properties that are set on the defaults
will be protected.

Bug: 230841626
Test: m nothing
Change-Id: Ibb0e482c2856a572437e7818466f41c5493baf33
2022-05-04 21:41:55 +00:00
Paul Duffin
30ac3e7ca7 Remove uses of FixtureFactory from android package
Bug: 183235980
Test: m nothing
Change-Id: I72898ada020ee1a73fd534c61afb5c22fa00c1e5
2021-03-22 18:31:53 +00:00
Paul Duffin
7c166b4529 Convert android/defaults_test.go to test fixtures
Bug: 182885307
Test: m nothing
Change-Id: Iaf74bb9bece4eed717efa813b9b8ba51ecce5135
2021-03-17 16:18:17 +00:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Colin Cross
405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Colin Cross
323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Colin Cross
eabaedd520 Fix product variables in defaults modules
Product variables structs are generated at runtime to contain only
the properties that apply to the current module.  Defaults modules
always contained all product variable properties. Defaults modules
apply their properties to the target module using
proptools.PrependProperties, which prepends structs that have
matching types.  Filtered property structs had a different type
and were dropped.

Even after adding filtering to the defaults product variable
properties, defaults modules may contain more property structs
than the target module they are applied to, so the product
variables struct for the defaults module could contain more
fields than the product variables struct for the target module.
Use proptools.PrependMatchingProperties when applying defaults
of product variables instead, which will apply matching properties
across types.

Test: defaults_test.go
Test: variable_test.go
Change-Id: I281bdefef92053457a3b7b65383493a4e7d999df
2020-02-06 17:43:29 -08:00
Colin Cross
98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Colin Cross
4b49b768a2 Make TestContext.RegisterModuleType take an android.ModuleFactory
Avoid having to pass ModuleFactoryAdaptor to every call to
RegisterModuleType in a test by wrapping RegisterModuleType.

Test: all soong tests
Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-11-25 10:59:44 -08:00
Colin Cross
0e99175bb6 Add test for missing defaults modules with AllowMissingDependencies
Test: defaults_test.go
Change-Id: Ic71892c379f8850996ea4dd94f606f4e937591df
2019-06-10 15:51:06 -07:00