Make required a configurable property

So that users can use select statements with it.

Fixes: 347605145
Bug: 342006386
Test: m nothing --no-skip-soong-tests
Change-Id: Ica0ca6d1725b000b3748c0293e5a9f9b38ed87f9
This commit is contained in:
Cole Faust
2024-06-17 12:32:40 -07:00
parent 7dc42aa7af
commit 43ddd08bd2
12 changed files with 41 additions and 26 deletions

View File

@@ -129,12 +129,12 @@ func (c *hostFakeSingleton) GenerateBuildActions(ctx android.SingletonContext) {
if !seen[outFile] {
seen[outFile] = true
outputs = append(outputs, WriteStringToFileRule(ctx, "", outFile))
jsonData = append(jsonData, hostSnapshotFakeJsonFlags{*hostJsonDesc(module), false})
jsonData = append(jsonData, hostSnapshotFakeJsonFlags{*hostJsonDesc(ctx, module), false})
}
}
})
// Update any module prebuilt information
for idx, _ := range jsonData {
for idx := range jsonData {
if _, ok := prebuilts[jsonData[idx].ModuleName]; ok {
// Prebuilt exists for this module
jsonData[idx].Prebuilt = true

View File

@@ -101,7 +101,7 @@ func (f *hostSnapshot) CreateMetaData(ctx android.ModuleContext, fileName string
// Create JSON file based on the direct dependencies
ctx.VisitDirectDeps(func(dep android.Module) {
desc := hostJsonDesc(dep)
desc := hostJsonDesc(ctx, dep)
if desc != nil {
jsonData = append(jsonData, *desc)
}
@@ -209,7 +209,7 @@ func hostRelativePathString(m android.Module) string {
// Create JSON description for given module, only create descriptions for binary modules
// and rust_proc_macro modules which provide a valid HostToolPath
func hostJsonDesc(m android.Module) *SnapshotJsonFlags {
func hostJsonDesc(ctx android.ConfigAndErrorContext, m android.Module) *SnapshotJsonFlags {
path := hostToolPath(m)
relPath := hostRelativePathString(m)
procMacro := false
@@ -226,7 +226,7 @@ func hostJsonDesc(m android.Module) *SnapshotJsonFlags {
props := &SnapshotJsonFlags{
ModuleStemName: moduleStem,
Filename: path.String(),
Required: append(m.HostRequiredModuleNames(), m.RequiredModuleNames()...),
Required: append(m.HostRequiredModuleNames(), m.RequiredModuleNames(ctx)...),
RelativeInstallPath: relPath,
RustProcMacro: procMacro,
CrateName: crateName,