diff options
author | Alex Light <allight@google.com> | 2019-02-07 13:20:53 -0800 |
---|---|---|
committer | Alex Light <allight@google.com> | 2019-02-07 16:52:20 -0800 |
commit | 0851b88eaf30a229157fba51d66c3678e7275ad6 (patch) | |
tree | e6e560514bdd55cbf393c3654a034c086325b9b6 /apex/apex.go | |
parent | 7cf14099b70241950e813fd9196a0b3f2cc4e981 (diff) | |
download | build_soong-0851b88eaf30a229157fba51d66c3678e7275ad6.tar.gz build_soong-0851b88eaf30a229157fba51d66c3678e7275ad6.tar.bz2 build_soong-0851b88eaf30a229157fba51d66c3678e7275ad6.zip |
Add support for test_apex
Some test and other miscallaneous use-cases need apexs that are
installable but will not affect the installation of other artifacts
onto the device. For this purpose we added a test_apex type. These
test_apex targets create apex files and have all the normal attributes
but are not considered the source of any of their contents for the
device by the rest of the build-system.
Test: build and boot
Test: ALLOW_MISSING_DEPENDENCIES=true \
DIST_DIR=$ANDROID_BUILD_TOP/out/dist \
./art/tools/dist_linux_bionic.sh -j72 showcommands com.android.runtime.host
Bug: 123591866
Bug: 123892969
Change-Id: I7f50be0ac0425cd87868145e18bcee6962d472ef
Diffstat (limited to 'apex/apex.go')
-rw-r--r-- | apex/apex.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apex/apex.go b/apex/apex.go index 092868e6..95cee0cd 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -136,7 +136,8 @@ func init() { pctx.HostBinToolVariable("zip2zip", "zip2zip") pctx.HostBinToolVariable("zipalign", "zipalign") - android.RegisterModuleType("apex", ApexBundleFactory) + android.RegisterModuleType("apex", apexBundleFactory) + android.RegisterModuleType("apex_test", testApexBundleFactory) android.RegisterModuleType("apex_defaults", defaultsFactory) android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { @@ -154,7 +155,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) { depName := mctx.OtherModuleName(child) // If the parent is apexBundle, this child is directly depended. _, directDep := parent.(*apexBundle) - if a.installable() { + if a.installable() && !a.testApex { // TODO(b/123892969): Workaround for not having any way to annotate test-apexs // non-installable apex's cannot be installed and so should not prevent libraries from being // installed to the system. @@ -375,6 +376,8 @@ type apexBundle struct { filesInfo []apexFile flattened bool + + testApex bool } func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, @@ -1091,9 +1094,18 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD }} } -func ApexBundleFactory() android.Module { +func testApexBundleFactory() android.Module { + return ApexBundleFactory( /*testApex*/ true) +} + +func apexBundleFactory() android.Module { + return ApexBundleFactory( /*testApex*/ false) +} + +func ApexBundleFactory(testApex bool) android.Module { module := &apexBundle{ outputFiles: map[apexPackaging]android.WritablePath{}, + testApex: testApex, } module.AddProperties(&module.properties) module.AddProperties(&module.targetProperties) |