Remove uses of buildDir in java/hiddenapi_singleton_test.go

Remove any uses, either direct (or indirect via testJavaConfig or
similar methods), of the package level buildDir variable from this
file.

Bug: 182885307
Test: m nothing
Change-Id: I664465808cd4edf1fef611c07ae05a32683dc976
This commit is contained in:
Paul Duffin 2021-03-22 16:24:49 +00:00
parent 67d485e9d4
commit 2f9e71e5ad
1 changed files with 17 additions and 17 deletions

View File

@ -49,8 +49,8 @@ func TestHiddenAPISingleton(t *testing.T) {
`) `)
hiddenAPI := result.SingletonForTests("hiddenapi") hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
want := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
} }
@ -144,8 +144,8 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
`) `)
hiddenAPI := result.SingletonForTests("hiddenapi") hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
want := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want)
} }
@ -168,11 +168,11 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
`) `)
hiddenAPI := result.SingletonForTests("hiddenapi") hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
fromSourceJarArg := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg) android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg)
prebuiltJarArg := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/dex/foo.jar" prebuiltJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/dex/foo.jar"
android.AssertStringDoesNotContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg) android.AssertStringDoesNotContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg)
} }
@ -195,11 +195,11 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
`) `)
hiddenAPI := result.SingletonForTests("hiddenapi") hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
prebuiltJarArg := "--boot-dex=" + buildDir + "/.intermediates/prebuilt_foo/android_common/dex/foo.jar" prebuiltJarArg := "--boot-dex=out/soong/.intermediates/prebuilt_foo/android_common/dex/foo.jar"
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg) android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, prebuiltJarArg)
fromSourceJarArg := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar"
android.AssertStringDoesNotContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg) android.AssertStringDoesNotContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, fromSourceJarArg)
} }
@ -243,7 +243,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
).RunTest(t) ).RunTest(t)
hiddenAPI := result.SingletonForTests("hiddenapi") hiddenAPI := result.SingletonForTests("hiddenapi")
hiddenapiRule := hiddenAPI.Rule("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop()
wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild) wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild)
android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, wantPublicStubs) android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, wantPublicStubs)
@ -260,7 +260,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) {
} }
func generateDexedPath(subDir, dex, module string) string { func generateDexedPath(subDir, dex, module string) string {
return fmt.Sprintf("%s/.intermediates/%s/android_common/%s/%s.jar", buildDir, subDir, dex, module) return fmt.Sprintf("out/soong/.intermediates/%s/android_common/%s/%s.jar", subDir, dex, module)
} }
func generateDexPath(moduleDir string, module string) string { func generateDexPath(moduleDir string, module string) string {
@ -297,8 +297,8 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) {
`) `)
expectedCpInput := prebuiltHiddenApiDir + "/hiddenapi-flags.csv" expectedCpInput := prebuiltHiddenApiDir + "/hiddenapi-flags.csv"
expectedCpOutput := buildDir + "/hiddenapi/hiddenapi-flags.csv" expectedCpOutput := "out/soong/hiddenapi/hiddenapi-flags.csv"
expectedFlagsCsv := buildDir + "/hiddenapi/hiddenapi-flags.csv" expectedFlagsCsv := "out/soong/hiddenapi/hiddenapi-flags.csv"
foo := result.ModuleForTests("foo", "android_common") foo := result.ModuleForTests("foo", "android_common")
@ -306,12 +306,12 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) {
cpRule := hiddenAPI.Rule("Cp") cpRule := hiddenAPI.Rule("Cp")
actualCpInput := cpRule.BuildParams.Input actualCpInput := cpRule.BuildParams.Input
actualCpOutput := cpRule.BuildParams.Output actualCpOutput := cpRule.BuildParams.Output
encodeDexRule := foo.Rule("hiddenAPIEncodeDex") encodeDexRule := foo.Rule("hiddenAPIEncodeDex").RelativeToTop()
actualFlagsCsv := encodeDexRule.BuildParams.Args["flagsCsv"] actualFlagsCsv := encodeDexRule.BuildParams.Args["flagsCsv"]
android.AssertStringEquals(t, "hiddenapi cp rule input", expectedCpInput, actualCpInput.String()) android.AssertPathRelativeToTopEquals(t, "hiddenapi cp rule input", expectedCpInput, actualCpInput)
android.AssertStringEquals(t, "hiddenapi cp rule output", expectedCpOutput, actualCpOutput.String()) android.AssertPathRelativeToTopEquals(t, "hiddenapi cp rule output", expectedCpOutput, actualCpOutput)
android.AssertStringEquals(t, "hiddenapi encode dex rule flags csv", expectedFlagsCsv, actualFlagsCsv) android.AssertStringEquals(t, "hiddenapi encode dex rule flags csv", expectedFlagsCsv, actualFlagsCsv)
} }