Loading android/prebuilt.go +4 −0 Original line number Original line Diff line number Diff line Loading @@ -74,6 +74,10 @@ func (p *Prebuilt) SingleSourcePath(ctx ModuleContext) Path { } } } } func (p *Prebuilt) UsePrebuilt() bool { return p.properties.UsePrebuilt } func InitPrebuiltModule(module PrebuiltInterface, srcs *[]string) { func InitPrebuiltModule(module PrebuiltInterface, srcs *[]string) { p := module.Prebuilt() p := module.Prebuilt() module.AddProperties(&p.properties) module.AddProperties(&p.properties) Loading apex/apex.go +5 −1 Original line number Original line Diff line number Diff line Loading @@ -1373,11 +1373,15 @@ func (p *Prebuilt) Srcs() android.Paths { return android.Paths{p.outputApex} return android.Paths{p.outputApex} } } func (p *Prebuilt) InstallFilename() string { return proptools.StringDefault(p.properties.Filename, p.BaseModuleName()+imageApexSuffix) } func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) { // TODO(jungjw): Check the key validity. // TODO(jungjw): Check the key validity. p.inputApex = p.Prebuilt().SingleSourcePath(ctx) p.inputApex = p.Prebuilt().SingleSourcePath(ctx) p.installDir = android.PathForModuleInstall(ctx, "apex") p.installDir = android.PathForModuleInstall(ctx, "apex") p.installFilename = proptools.StringDefault(p.properties.Filename, ctx.ModuleName()+imageApexSuffix) p.installFilename = p.InstallFilename() if !strings.HasSuffix(p.installFilename, imageApexSuffix) { if !strings.HasSuffix(p.installFilename, imageApexSuffix) { ctx.ModuleErrorf("filename should end in %s for prebuilt_apex", imageApexSuffix) ctx.ModuleErrorf("filename should end in %s for prebuilt_apex", imageApexSuffix) } } Loading apex/key.go +30 −4 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package apex import ( import ( "fmt" "fmt" "sort" "strings" "strings" "android/soong/android" "android/soong/android" Loading Loading @@ -106,12 +107,31 @@ type apexKeysText struct { func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { s.output = android.PathForOutput(ctx, "apexkeys.txt") s.output = android.PathForOutput(ctx, "apexkeys.txt") var filecontent strings.Builder apexModulesMap := make(map[string]android.Module) ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(android.Module); ok && !m.Enabled() { if m, ok := module.(*apexBundle); ok && m.Enabled() && m.installable() { return apexModulesMap[m.Name()] = m } }) // Find prebuilts and let them override apexBundle if they are preferred ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(*Prebuilt); ok && m.Enabled() && m.installable() && m.Prebuilt().UsePrebuilt() { apexModulesMap[m.BaseModuleName()] = m } } }) // iterating over map does not give consistent ordering in golang var moduleNames []string for key, _ := range apexModulesMap { moduleNames = append(moduleNames, key) } sort.Strings(moduleNames) var filecontent strings.Builder for _, key := range moduleNames { module := apexModulesMap[key] if m, ok := module.(*apexBundle); ok { if m, ok := module.(*apexBundle); ok { fmt.Fprintf(&filecontent, fmt.Fprintf(&filecontent, "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", Loading @@ -120,8 +140,14 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { m.private_key_file.String(), m.private_key_file.String(), m.container_certificate_file.String(), m.container_certificate_file.String(), m.container_private_key_file.String()) m.container_private_key_file.String()) } else if m, ok := module.(*Prebuilt); ok { fmt.Fprintf(&filecontent, "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", m.InstallFilename(), "PRESIGNED", "PRESIGNED", "PRESIGNED", "PRESIGNED") } } }) } ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{ Rule: android.WriteFile, Rule: android.WriteFile, Description: "apexkeys.txt", Description: "apexkeys.txt", Loading Loading
android/prebuilt.go +4 −0 Original line number Original line Diff line number Diff line Loading @@ -74,6 +74,10 @@ func (p *Prebuilt) SingleSourcePath(ctx ModuleContext) Path { } } } } func (p *Prebuilt) UsePrebuilt() bool { return p.properties.UsePrebuilt } func InitPrebuiltModule(module PrebuiltInterface, srcs *[]string) { func InitPrebuiltModule(module PrebuiltInterface, srcs *[]string) { p := module.Prebuilt() p := module.Prebuilt() module.AddProperties(&p.properties) module.AddProperties(&p.properties) Loading
apex/apex.go +5 −1 Original line number Original line Diff line number Diff line Loading @@ -1373,11 +1373,15 @@ func (p *Prebuilt) Srcs() android.Paths { return android.Paths{p.outputApex} return android.Paths{p.outputApex} } } func (p *Prebuilt) InstallFilename() string { return proptools.StringDefault(p.properties.Filename, p.BaseModuleName()+imageApexSuffix) } func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) { // TODO(jungjw): Check the key validity. // TODO(jungjw): Check the key validity. p.inputApex = p.Prebuilt().SingleSourcePath(ctx) p.inputApex = p.Prebuilt().SingleSourcePath(ctx) p.installDir = android.PathForModuleInstall(ctx, "apex") p.installDir = android.PathForModuleInstall(ctx, "apex") p.installFilename = proptools.StringDefault(p.properties.Filename, ctx.ModuleName()+imageApexSuffix) p.installFilename = p.InstallFilename() if !strings.HasSuffix(p.installFilename, imageApexSuffix) { if !strings.HasSuffix(p.installFilename, imageApexSuffix) { ctx.ModuleErrorf("filename should end in %s for prebuilt_apex", imageApexSuffix) ctx.ModuleErrorf("filename should end in %s for prebuilt_apex", imageApexSuffix) } } Loading
apex/key.go +30 −4 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package apex import ( import ( "fmt" "fmt" "sort" "strings" "strings" "android/soong/android" "android/soong/android" Loading Loading @@ -106,12 +107,31 @@ type apexKeysText struct { func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { s.output = android.PathForOutput(ctx, "apexkeys.txt") s.output = android.PathForOutput(ctx, "apexkeys.txt") var filecontent strings.Builder apexModulesMap := make(map[string]android.Module) ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(android.Module); ok && !m.Enabled() { if m, ok := module.(*apexBundle); ok && m.Enabled() && m.installable() { return apexModulesMap[m.Name()] = m } }) // Find prebuilts and let them override apexBundle if they are preferred ctx.VisitAllModules(func(module android.Module) { if m, ok := module.(*Prebuilt); ok && m.Enabled() && m.installable() && m.Prebuilt().UsePrebuilt() { apexModulesMap[m.BaseModuleName()] = m } } }) // iterating over map does not give consistent ordering in golang var moduleNames []string for key, _ := range apexModulesMap { moduleNames = append(moduleNames, key) } sort.Strings(moduleNames) var filecontent strings.Builder for _, key := range moduleNames { module := apexModulesMap[key] if m, ok := module.(*apexBundle); ok { if m, ok := module.(*apexBundle); ok { fmt.Fprintf(&filecontent, fmt.Fprintf(&filecontent, "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", Loading @@ -120,8 +140,14 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) { m.private_key_file.String(), m.private_key_file.String(), m.container_certificate_file.String(), m.container_certificate_file.String(), m.container_private_key_file.String()) m.container_private_key_file.String()) } else if m, ok := module.(*Prebuilt); ok { fmt.Fprintf(&filecontent, "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q\\n", m.InstallFilename(), "PRESIGNED", "PRESIGNED", "PRESIGNED", "PRESIGNED") } } }) } ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{ Rule: android.WriteFile, Rule: android.WriteFile, Description: "apexkeys.txt", Description: "apexkeys.txt", Loading