Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
diff --git a/java/sdk_library.go b/java/sdk_library.go
index fdbf19d..877abe4 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -141,8 +141,9 @@
android.ModuleBase
android.DefaultableModuleBase
- properties sdkLibraryProperties
- deviceProperties CompilerDeviceProperties
+ properties sdkLibraryProperties
+ deviceProperties CompilerDeviceProperties
+ dexpreoptProperties DexpreoptProperties
publicApiStubsPath android.Paths
systemApiStubsPath android.Paths
@@ -564,6 +565,7 @@
Errorprone struct {
Javacflags []string
}
+ IsSDKLibrary bool
}{}
props.Name = proptools.StringPtr(module.implName())
@@ -574,6 +576,7 @@
// XML file is installed along with the impl lib
props.Required = []string{module.xmlFileName()}
props.Errorprone.Javacflags = module.properties.Errorprone.Javacflags
+ props.IsSDKLibrary = true
if module.SocSpecific() {
props.Soc_specific = proptools.BoolPtr(true)
@@ -583,7 +586,10 @@
props.Product_specific = proptools.BoolPtr(true)
}
- mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory), &props, &module.deviceProperties)
+ mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory),
+ &props,
+ &module.deviceProperties,
+ &module.dexpreoptProperties)
}
// Creates the xml file that publicizes the runtime library
@@ -716,6 +722,7 @@
module := &sdkLibrary{}
module.AddProperties(&module.properties)
module.AddProperties(&module.deviceProperties)
+ module.AddProperties(&module.dexpreoptProperties)
InitJavaModule(module, android.DeviceSupported)
return module
}