diff --git a/cc/cc.go b/cc/cc.go index 608797092..a52fc112b 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -42,6 +42,7 @@ import ( func init() { RegisterCCBuildComponents(android.InitRegistrationContext) + pctx.Import("android/soong/android") pctx.Import("android/soong/cc/config") } diff --git a/cc/fuzz.go b/cc/fuzz.go index 636ad855b..7f0a5021b 100644 --- a/cc/fuzz.go +++ b/cc/fuzz.go @@ -258,25 +258,29 @@ func (fuzzBin *fuzzBinary) install(ctx ModuleContext, file android.Path) { func PackageFuzzModule(ctx android.ModuleContext, fuzzPackagedModule fuzz.FuzzPackagedModule, pctx android.PackageContext) fuzz.FuzzPackagedModule { fuzzPackagedModule.Corpus = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Corpus) - builder := android.NewRuleBuilder(pctx, ctx) intermediateDir := android.PathForModuleOut(ctx, "corpus") + + // Create one rule per file to avoid MAX_ARG_STRLEN hardlimit. for _, entry := range fuzzPackagedModule.Corpus { - builder.Command().Text("cp"). - Input(entry). - Output(intermediateDir.Join(ctx, entry.Base())) + ctx.Build(pctx, android.BuildParams{ + Rule: android.Cp, + Output: intermediateDir.Join(ctx, entry.Base()), + Input: entry, + }) } - builder.Build("copy_corpus", "copy corpus") fuzzPackagedModule.CorpusIntermediateDir = intermediateDir fuzzPackagedModule.Data = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Data) - builder = android.NewRuleBuilder(pctx, ctx) intermediateDir = android.PathForModuleOut(ctx, "data") + + // Create one rule per file to avoid MAX_ARG_STRLEN hardlimit. for _, entry := range fuzzPackagedModule.Data { - builder.Command().Text("cp"). - Input(entry). - Output(intermediateDir.Join(ctx, entry.Rel())) + ctx.Build(pctx, android.BuildParams{ + Rule: android.Cp, + Output: intermediateDir.Join(ctx, entry.Rel()), + Input: entry, + }) } - builder.Build("copy_data", "copy data") fuzzPackagedModule.DataIntermediateDir = intermediateDir if fuzzPackagedModule.FuzzProperties.Dictionary != nil { diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go index 0cf21b65a..feb388037 100644 --- a/cc/ndk_sysroot.go +++ b/cc/ndk_sysroot.go @@ -58,7 +58,6 @@ import ( func init() { RegisterNdkModuleTypes(android.InitRegistrationContext) - pctx.Import("android/soong/android") } func RegisterNdkModuleTypes(ctx android.RegistrationContext) { diff --git a/rust/rust.go b/rust/rust.go index e524c9fb6..d180bb21f 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -43,6 +43,7 @@ func init() { android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("rust_sanitizers", rustSanitizerRuntimeMutator).Parallel() }) + pctx.Import("android/soong/android") pctx.Import("android/soong/rust/config") pctx.ImportAs("cc_config", "android/soong/cc/config") android.InitRegistrationContext.RegisterParallelSingletonType("kythe_rust_extract", kytheExtractRustFactory)