Add pre-built attribute to host module definition for fake snapshot. am: 9e5cc8a674
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2044967 Change-Id: Iadd0cc05e885f2b39156aa1446bd55e2d1cea555 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -68,6 +68,12 @@ func init() {
|
|||||||
registerHostSnapshotComponents(android.InitRegistrationContext)
|
registerHostSnapshotComponents(android.InitRegistrationContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add prebuilt information to snapshot data
|
||||||
|
type hostSnapshotFakeJsonFlags struct {
|
||||||
|
SnapshotJsonFlags
|
||||||
|
Prebuilt bool `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
func registerHostSnapshotComponents(ctx android.RegistrationContext) {
|
func registerHostSnapshotComponents(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterSingletonType("host-fake-snapshot", HostToolsFakeAndroidSingleton)
|
ctx.RegisterSingletonType("host-fake-snapshot", HostToolsFakeAndroidSingleton)
|
||||||
}
|
}
|
||||||
@@ -94,7 +100,9 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
// Find all host binary modules add 'fake' versions to snapshot
|
// Find all host binary modules add 'fake' versions to snapshot
|
||||||
var outputs android.Paths
|
var outputs android.Paths
|
||||||
seen := make(map[string]bool)
|
seen := make(map[string]bool)
|
||||||
var jsonData []SnapshotJsonFlags
|
var jsonData []hostSnapshotFakeJsonFlags
|
||||||
|
prebuilts := make(map[string]bool)
|
||||||
|
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if module.Target().Os != ctx.Config().BuildOSTarget.Os {
|
if module.Target().Os != ctx.Config().BuildOSTarget.Os {
|
||||||
return
|
return
|
||||||
@@ -104,9 +112,10 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if android.IsModulePrebuilt(module) {
|
if android.IsModulePrebuilt(module) {
|
||||||
|
// Add non-prebuilt module name to map of prebuilts
|
||||||
|
prebuilts[android.RemoveOptionalPrebuiltPrefix(module.Name())] = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !module.Enabled() || module.IsHideFromMake() {
|
if !module.Enabled() || module.IsHideFromMake() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -120,11 +129,17 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
if !seen[outFile] {
|
if !seen[outFile] {
|
||||||
seen[outFile] = true
|
seen[outFile] = true
|
||||||
outputs = append(outputs, WriteStringToFileRule(ctx, "", outFile))
|
outputs = append(outputs, WriteStringToFileRule(ctx, "", outFile))
|
||||||
jsonData = append(jsonData, *hostJsonDesc(module))
|
jsonData = append(jsonData, hostSnapshotFakeJsonFlags{*hostJsonDesc(module), false})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// Update any module prebuilt information
|
||||||
|
for idx, _ := range jsonData {
|
||||||
|
if _, ok := prebuilts[jsonData[idx].ModuleName]; ok {
|
||||||
|
// Prebuilt exists for this module
|
||||||
|
jsonData[idx].Prebuilt = true
|
||||||
|
}
|
||||||
|
}
|
||||||
marsh, err := json.Marshal(jsonData)
|
marsh, err := json.Marshal(jsonData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Errorf("host fake snapshot json marshal failure: %#v", err)
|
ctx.Errorf("host fake snapshot json marshal failure: %#v", err)
|
||||||
|
Reference in New Issue
Block a user