1package dexpreopt 2 3import "android/soong/android" 4 5func init() { 6 android.InitRegistrationContext.RegisterSingletonType("system_server_zip_singleton", systemServerZipSingletonFactory) 7} 8 9func systemServerZipSingletonFactory() android.Singleton { 10 return &systemServerZipSingleton{} 11} 12 13type systemServerZipSingleton struct{} 14 15func (s *systemServerZipSingleton) GenerateBuildActions(ctx android.SingletonContext) { 16 global := GetGlobalConfig(ctx) 17 if global.DisablePreopt || global.OnlyPreoptArtBootImage { 18 return 19 } 20 21 systemServerDexjarsDir := android.PathForOutput(ctx, SystemServerDexjarsDir) 22 23 out := android.PathForOutput(ctx, "system_server.zip") 24 builder := android.NewRuleBuilder(pctx, ctx) 25 cmd := builder.Command().BuiltTool("soong_zip"). 26 FlagWithOutput("-o ", out). 27 FlagWithArg("-C ", systemServerDexjarsDir.String()) 28 29 for i := 0; i < global.SystemServerJars.Len(); i++ { 30 jar := global.SystemServerJars.Jar(i) + ".jar" 31 cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar)) 32 } 33 for i := 0; i < global.StandaloneSystemServerJars.Len(); i++ { 34 jar := global.StandaloneSystemServerJars.Jar(i) + ".jar" 35 cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar)) 36 } 37 for i := 0; i < global.ApexSystemServerJars.Len(); i++ { 38 jar := global.ApexSystemServerJars.Jar(i) + ".jar" 39 cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar)) 40 } 41 for i := 0; i < global.ApexStandaloneSystemServerJars.Len(); i++ { 42 jar := global.ApexStandaloneSystemServerJars.Jar(i) + ".jar" 43 cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar)) 44 } 45 46 builder.Build("system_server_zip", "building system_server.zip") 47 48 ctx.DistForGoal("droidcore", out) 49} 50