Merge "Ensure data is passed to all generation actions" into main
This commit is contained in:
@@ -115,8 +115,6 @@ var (
|
||||
"nos_app_weaver_service_genc++_headers",
|
||||
"nos_app_weaver_service_genc++_mock",
|
||||
"nos_generator_test_service_genc++",
|
||||
"framework-cppstream-protos",
|
||||
"framework-javastream-protos",
|
||||
"aidl_camera_build_version",
|
||||
"cronet_aml_base_android_runtime_unchecked_jni_headers",
|
||||
"cronet_aml_base_android_runtime_jni_headers",
|
||||
|
@@ -435,6 +435,7 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) {
|
||||
cmd = g.CmdModifier(ctx, cmd)
|
||||
}
|
||||
|
||||
var extraInputs android.Paths
|
||||
// Generate tasks, either from genrule or gensrcs.
|
||||
for i, task := range g.taskGenerator(ctx, cmd, srcFiles) {
|
||||
if len(task.out) == 0 {
|
||||
@@ -442,7 +443,6 @@ func (g *Module) generateCommonBuildActions(ctx android.ModuleContext) {
|
||||
return
|
||||
}
|
||||
|
||||
var extraInputs android.Paths
|
||||
// Only handle extra inputs once as these currently are the same across all tasks
|
||||
if i == 0 {
|
||||
for name, values := range task.extraInputs {
|
||||
|
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
@@ -557,10 +558,12 @@ func TestGenSrcs(t *testing.T) {
|
||||
|
||||
allowMissingDependencies bool
|
||||
|
||||
err string
|
||||
cmds []string
|
||||
deps []string
|
||||
files []string
|
||||
err string
|
||||
cmds []string
|
||||
deps []string
|
||||
files []string
|
||||
shards int
|
||||
inputs []string
|
||||
}{
|
||||
{
|
||||
name: "gensrcs",
|
||||
@@ -627,9 +630,29 @@ func TestGenSrcs(t *testing.T) {
|
||||
"out/soong/.intermediates/gen/gen/gensrcs/in2.h",
|
||||
"out/soong/.intermediates/gen/gen/gensrcs/in3.h",
|
||||
},
|
||||
shards: 2,
|
||||
inputs: []string{
|
||||
"baz.txt",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
checkInputs := func(t *testing.T, rule android.TestingBuildParams, inputs []string) {
|
||||
t.Helper()
|
||||
if len(inputs) == 0 {
|
||||
return
|
||||
}
|
||||
inputBaseNames := map[string]bool{}
|
||||
for _, f := range rule.Implicits {
|
||||
inputBaseNames[f.Base()] = true
|
||||
}
|
||||
for _, f := range inputs {
|
||||
if _, ok := inputBaseNames[f]; !ok {
|
||||
t.Errorf("Expected to find input file %q for %q, but did not", f, rule.Description)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, test := range testcases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
bp := "gensrcs {\n"
|
||||
@@ -647,10 +670,21 @@ func TestGenSrcs(t *testing.T) {
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAllErrorsToMatchAPattern(expectedErrors)).
|
||||
RunTestWithBp(t, testGenruleBp()+bp)
|
||||
|
||||
mod := result.ModuleForTests("gen", "")
|
||||
if expectedErrors != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if test.shards > 0 {
|
||||
for i := 0; i < test.shards; i++ {
|
||||
r := mod.Rule("generator" + strconv.Itoa(i))
|
||||
checkInputs(t, r, test.inputs)
|
||||
}
|
||||
} else {
|
||||
r := mod.Rule("generator")
|
||||
checkInputs(t, r, test.inputs)
|
||||
}
|
||||
|
||||
gen := result.Module("gen", "").(*Module)
|
||||
android.AssertDeepEquals(t, "cmd", test.cmds, gen.rawCommands)
|
||||
|
||||
|
Reference in New Issue
Block a user