Remove extraneous calls to TestingBuildParams.RelativeToTop()

Deprecated the method to try and prevent any other uses being added.

Bug: 183650682
Test: m nothing
Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
This commit is contained in:
Paul Duffin
2021-03-29 00:42:57 +01:00
parent e8366da1f6
commit a71a67a4f5
9 changed files with 37 additions and 35 deletions

View File

@@ -652,7 +652,7 @@ func TestLibraryAssets(t *testing.T) {
} else {
aapt2link = m.Output("package-res.apk")
}
aapt2link = aapt2link.RelativeToTop()
aapt2link = aapt2link
aapt2Flags := aapt2link.Args["flags"]
if test.assetFlag != "" {
android.AssertStringDoesContain(t, "asset flag", aapt2Flags, test.assetFlag)
@@ -1993,14 +1993,14 @@ func TestOverrideAndroidAppDependency(t *testing.T) {
`)
// Verify baz, which depends on the overridden module foo, has the correct classpath javac arg.
javac := ctx.ModuleForTests("baz", "android_common").Rule("javac").RelativeToTop()
javac := ctx.ModuleForTests("baz", "android_common").Rule("javac")
fooTurbine := "out/soong/.intermediates/foo/android_common/turbine-combined/foo.jar"
if !strings.Contains(javac.Args["classpath"], fooTurbine) {
t.Errorf("baz classpath %v does not contain %q", javac.Args["classpath"], fooTurbine)
}
// Verify qux, which depends on the overriding module bar, has the correct classpath javac arg.
javac = ctx.ModuleForTests("qux", "android_common").Rule("javac").RelativeToTop()
javac = ctx.ModuleForTests("qux", "android_common").Rule("javac")
barTurbine := "out/soong/.intermediates/foo/android_common_bar/turbine-combined/foo.jar"
if !strings.Contains(javac.Args["classpath"], barTurbine) {
t.Errorf("qux classpath %v does not contain %q", javac.Args["classpath"], barTurbine)
@@ -2077,7 +2077,7 @@ func TestOverrideAndroidTest(t *testing.T) {
}
// Check if javac classpath has the correct jar file path. This checks instrumentation_for overrides.
javac := variant.Rule("javac").RelativeToTop()
javac := variant.Rule("javac")
turbine := filepath.Join("out", "soong", ".intermediates", "foo", expected.targetVariant, "turbine-combined", "foo.jar")
if !strings.Contains(javac.Args["classpath"], turbine) {
t.Errorf("classpath %q does not contain %q", javac.Args["classpath"], turbine)
@@ -2151,7 +2151,7 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
for _, test := range testCases {
variant := ctx.ModuleForTests(test.moduleName, test.variantName)
params := variant.MaybeOutput("test_config_fixer/AndroidTest.xml").RelativeToTop()
params := variant.MaybeOutput("test_config_fixer/AndroidTest.xml")
if len(test.expectedFlags) > 0 {
if params.Rule == nil {
@@ -2647,14 +2647,14 @@ func TestEmbedNotice(t *testing.T) {
t.Errorf("GENRULE_NOTICE is missing from notice files, %q", noticeInputs)
}
// aapt2 flags should include -A <NOTICE dir> so that its contents are put in the APK's /assets.
res := foo.Output("package-res.apk").RelativeToTop()
res := foo.Output("package-res.apk")
aapt2Flags := res.Args["flags"]
e := "-A out/soong/.intermediates/foo/android_common/NOTICE"
android.AssertStringDoesContain(t, "expected.apkPath", aapt2Flags, e)
// bar has NOTICE files to process, but embed_notices is not set.
bar := result.ModuleForTests("bar", "android_common")
res = bar.Output("package-res.apk").RelativeToTop()
res = bar.Output("package-res.apk")
aapt2Flags = res.Args["flags"]
e = "-A out/soong/.intermediates/bar/android_common/NOTICE"
android.AssertStringDoesNotContain(t, "bar shouldn't have the asset dir flag for NOTICE", aapt2Flags, e)

View File

@@ -80,7 +80,7 @@ func TestDroiddoc(t *testing.T) {
barStubsOutput := barStubsOutputs[0]
barDoc := ctx.ModuleForTests("bar-doc", "android_common")
javaDoc := barDoc.Rule("javadoc").RelativeToTop()
javaDoc := barDoc.Rule("javadoc")
if g, w := android.PathsRelativeToTop(javaDoc.Implicits), android.PathRelativeToTop(barStubsOutput); !inList(w, g) {
t.Errorf("implicits of bar-doc must contain %q, but was %q.", w, g)
}

View File

@@ -50,7 +50,7 @@ func TestHiddenAPISingleton(t *testing.T) {
`)
hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
}
@@ -145,7 +145,7 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
`)
hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
}
@@ -169,7 +169,7 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
`)
hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg)
@@ -196,7 +196,7 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
`)
hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
prebuiltJarArg := "--boot-dex=out/soong/.intermediates/prebuilt_foo/android_common/dex/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg)
@@ -244,7 +244,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
).RunTest(t)
hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
hiddenapiRule := hiddenAPI.Rule("hiddenapi")
wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild)
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, wantPublicStubs)
@@ -307,7 +307,7 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) {
cpRule := hiddenAPI.Rule("Cp")
actualCpInput := cpRule.BuildParams.Input
actualCpOutput := cpRule.BuildParams.Output
encodeDexRule := foo.Rule("hiddenAPIEncodeDex").RelativeToTop()
encodeDexRule := foo.Rule("hiddenAPIEncodeDex")
actualFlagsCsv := encodeDexRule.BuildParams.Args["flagsCsv"]
android.AssertPathRelativeToTopEquals(t, "hiddenapi cp rule input", expectedCpInput, actualCpInput)

View File

@@ -250,7 +250,7 @@ func TestSimple(t *testing.T) {
}
`)
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac").RelativeToTop()
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
@@ -976,7 +976,7 @@ func TestDefaults(t *testing.T) {
}
`)
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac").RelativeToTop()
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
combineJar := ctx.ModuleForTests("foo", "android_common").Description("for javac")
if len(javac.Inputs) != 1 || javac.Inputs[0].String() != "a.java" {
@@ -1336,11 +1336,11 @@ func TestTurbine(t *testing.T) {
}
`)
fooTurbine := result.ModuleForTests("foo", "android_common").Rule("turbine").RelativeToTop()
barTurbine := result.ModuleForTests("bar", "android_common").Rule("turbine").RelativeToTop()
barJavac := result.ModuleForTests("bar", "android_common").Rule("javac").RelativeToTop()
barTurbineCombined := result.ModuleForTests("bar", "android_common").Description("for turbine").RelativeToTop()
bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac").RelativeToTop()
fooTurbine := result.ModuleForTests("foo", "android_common").Rule("turbine")
barTurbine := result.ModuleForTests("bar", "android_common").Rule("turbine")
barJavac := result.ModuleForTests("bar", "android_common").Rule("javac")
barTurbineCombined := result.ModuleForTests("bar", "android_common").Description("for turbine")
bazJavac := result.ModuleForTests("baz", "android_common").Rule("javac")
android.AssertPathsRelativeToTopEquals(t, "foo inputs", []string{"a.java"}, fooTurbine.Inputs)
@@ -1363,7 +1363,7 @@ func TestSharding(t *testing.T) {
barHeaderJar := filepath.Join("out", "soong", ".intermediates", "bar", "android_common", "turbine-combined", "bar.jar")
for i := 0; i < 3; i++ {
barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i)).RelativeToTop()
barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i))
if !strings.Contains(barJavac.Args["classpath"], barHeaderJar) {
t.Errorf("bar javac classpath %v does not contain %q", barJavac.Args["classpath"], barHeaderJar)
}

View File

@@ -68,7 +68,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
m := result.ModuleForTests("foo", "android_common")
// Check AAPT2 link flags.
aapt2Flags := m.Output("package-res.apk").RelativeToTop().Args["flags"]
aapt2Flags := m.Output("package-res.apk").Args["flags"]
expectedFlags := []string{"--keep-raw-values", "--no-resource-deduping", "--no-resource-removal"}
absentFlags := android.RemoveListFromList(expectedFlags, strings.Split(aapt2Flags, " "))
if len(absentFlags) > 0 {

View File

@@ -313,10 +313,10 @@ func TestClasspath(t *testing.T) {
checkClasspath := func(t *testing.T, result *android.TestResult, isJava8 bool) {
foo := result.ModuleForTests("foo", variant)
javac := foo.Rule("javac").RelativeToTop()
javac := foo.Rule("javac")
var deps []string
aidl := foo.MaybeRule("aidl").RelativeToTop()
aidl := foo.MaybeRule("aidl")
if aidl.Rule != nil {
deps = append(deps, android.PathRelativeToTop(aidl.Output))
}
@@ -376,7 +376,7 @@ func TestClasspath(t *testing.T) {
checkClasspath(t, result, true /* isJava8 */)
if testcase.host != android.Host {
aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop()
aidl := result.ModuleForTests("foo", variant).Rule("aidl")
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
}
@@ -389,7 +389,7 @@ func TestClasspath(t *testing.T) {
checkClasspath(t, result, false /* isJava8 */)
if testcase.host != android.Host {
aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop()
aidl := result.ModuleForTests("foo", variant).Rule("aidl")
android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.")
}