aboutsummaryrefslogtreecommitdiff
path: root/dexpreopt
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2024-01-25 04:25:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-01-25 04:25:38 +0000
commitb2fd4ff43fbb569d591ab48accc4e8765e46a529 (patch)
tree59ef63d4c0cc6e06a9e402a42f8b8f566cd563cd /dexpreopt
parent0b7089f13420061c8f1732fe6e2e56f1e9cdb21e (diff)
Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"
This reverts commit 0b7089f13420061c8f1732fe6e2e56f1e9cdb21e. Reason for revert: Breaks auto builds https://groups.google.com/a/google.com/g/android-build-police/c/DfXeyxkyfYk/m/4SvZa-jkAAAJ Change-Id: Ia6ebdf64d03284d2318978c35cb87fd4f0b79531
Diffstat (limited to 'dexpreopt')
-rw-r--r--dexpreopt/dexpreopt.go37
1 files changed, 13 insertions, 24 deletions
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 37b7f3446..94707bafa 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -229,30 +229,6 @@ func ToOdexPath(path string, arch android.ArchType) string {
pathtools.ReplaceExtension(filepath.Base(path), "odex"))
}
-// Copy the dex'd system server to a predefined location in out/soong/system_server_dexjars
-// dex2oat will use this predefined location to generate the dexpreopt artifacts.
-func CopySystemServerJarsToPredefinedLocations(ctx android.BuilderContext, libName string, libDexPath android.Path) {
- allSystemServerJars := GetGlobalConfig(ctx).AllSystemServerJars(ctx)
- if !allSystemServerJars.ContainsJar(libName) {
- // This is not a system server jar
- return
- }
- if DexpreoptRunningInSoong {
- // Copy the system server jar to a predefined location where dex2oat will find it.
- rule := android.NewRuleBuilder(pctx, ctx)
- dexPathHost := SystemServerDexJarHostPath(ctx, libName)
- rule.Command().Text("mkdir -p").Flag(filepath.Dir(dexPathHost.String()))
- rule.Command().Text("cp -f").Input(libDexPath).Output(dexPathHost)
- rule.Build("copy "+libName+" to soong/system_server_dexjars/", "system_server_dexjars")
- } else {
- // For Make modules the copy rule is generated in the makefiles, not in dexpreopt.sh.
- // This is necessary to expose the rule to Ninja, otherwise it has rules that depend on
- // the jar (namely, dexpreopt commands for all subsequent system server jars that have
- // this one in their class loader context), but no rule that creates it (because Ninja
- // cannot see the rule in the generated dexpreopt.sh script).
- }
-}
-
func dexpreoptCommand(ctx android.BuilderContext, globalSoong *GlobalSoongConfig,
global *GlobalConfig, module *ModuleConfig, rule *android.RuleBuilder, archIdx int,
profile android.WritablePath, appImage bool, generateDM bool, productPackages android.Path) {
@@ -301,6 +277,19 @@ func dexpreoptCommand(ctx android.BuilderContext, globalSoong *GlobalSoongConfig
clcTarget = append(clcTarget, GetSystemServerDexLocation(ctx, global, lib))
}
+ if DexpreoptRunningInSoong {
+ // Copy the system server jar to a predefined location where dex2oat will find it.
+ dexPathHost := SystemServerDexJarHostPath(ctx, module.Name)
+ rule.Command().Text("mkdir -p").Flag(filepath.Dir(dexPathHost.String()))
+ rule.Command().Text("cp -f").Input(module.DexPath).Output(dexPathHost)
+ } else {
+ // For Make modules the copy rule is generated in the makefiles, not in dexpreopt.sh.
+ // This is necessary to expose the rule to Ninja, otherwise it has rules that depend on
+ // the jar (namely, dexpreopt commands for all subsequent system server jars that have
+ // this one in their class loader context), but no rule that creates it (because Ninja
+ // cannot see the rule in the generated dexpreopt.sh script).
+ }
+
clcHostString := "PCL[" + strings.Join(clcHost.Strings(), ":") + "]"
clcTargetString := "PCL[" + strings.Join(clcTarget, ":") + "]"