diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go index 0e1bfc615..f984966b4 100644 --- a/dexpreopt/dexpreopt.go +++ b/dexpreopt/dexpreopt.go @@ -47,6 +47,8 @@ import ( const SystemPartition = "/system/" const SystemOtherPartition = "/system_other/" +var DexpreoptRunningInSoong = false + // GenerateDexpreoptRule generates a set of commands that will preopt a module based on a GlobalConfig and a // ModuleConfig. The produced files and their install locations will be available through rule.Installs(). func GenerateDexpreoptRule(ctx android.PathContext, globalSoong *GlobalSoongConfig, @@ -589,7 +591,14 @@ func NonUpdatableSystemServerJars(ctx android.PathContext, global *GlobalConfig) // at that time (Soong processes the jars in dependency order, which may be different from the // the system server classpath order). func SystemServerDexJarHostPath(ctx android.PathContext, jar string) android.OutputPath { - return android.PathForOutput(ctx, "system_server_dexjars", jar+".jar") + if DexpreoptRunningInSoong { + // Soong module, just use the default output directory $OUT/soong. + return android.PathForOutput(ctx, "system_server_dexjars", jar+".jar") + } else { + // Make module, default output directory is $OUT (passed via the "null config" created + // by dexpreopt_gen). Append Soong subdirectory to match Soong module paths. + return android.PathForOutput(ctx, "soong", "system_server_dexjars", jar+".jar") + } } func contains(l []string, s string) bool { diff --git a/java/dexpreopt.go b/java/dexpreopt.go index fba0b97fb..4725b0781 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -62,6 +62,10 @@ type DexpreoptProperties struct { } } +func init() { + dexpreopt.DexpreoptRunningInSoong = true +} + func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool { global := dexpreopt.GetGlobalConfig(ctx)