Add property to apex soong modules to forcefully compress an APEX
This makes creating compressed APEX artifacts for testing simpler.
Bug: 172911820
Test: atest apex_compression_platform_tests
Change-Id: I77b8bea4662c273420e7b37d5fde181b86c9cb78
diff --git a/apex/builder.go b/apex/builder.go
index 9db8e59..8d200ff 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -763,9 +763,13 @@
})
a.outputFile = signedOutputFile
- // Process APEX compression if enabled
+ // Process APEX compression if enabled or forced
+ if ctx.ModuleDir() != "system/apex/apexd/apexd_testdata" && a.testOnlyShouldForceCompression() {
+ ctx.PropertyErrorf("test_only_force_compression", "not available")
+ return
+ }
compressionEnabled := ctx.Config().CompressedApex() && proptools.BoolDefault(a.properties.Compressible, true)
- if compressionEnabled && apexType == imageApex {
+ if apexType == imageApex && (compressionEnabled || a.testOnlyShouldForceCompression()) {
a.isCompressed = true
unsignedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+".capex.unsigned")