From 2f9e71e5ad6faa4adea477292dd1ef9945956f74 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Mon, 22 Mar 2021 16:24:49 +0000 Subject: [PATCH] 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 --- java/hiddenapi_singleton_test.go | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go index f17d436ae..12a85d59e 100644 --- a/java/hiddenapi_singleton_test.go +++ b/java/hiddenapi_singleton_test.go @@ -49,8 +49,8 @@ func TestHiddenAPISingleton(t *testing.T) { `) hiddenAPI := result.SingletonForTests("hiddenapi") - hiddenapiRule := hiddenAPI.Rule("hiddenapi") - want := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" + hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop() + want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar" android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) } @@ -144,8 +144,8 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) { `) hiddenAPI := result.SingletonForTests("hiddenapi") - hiddenapiRule := hiddenAPI.Rule("hiddenapi") - want := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" + hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop() + want := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar" android.AssertStringDoesContain(t, "hiddenapi command", hiddenapiRule.RuleParams.Command, want) } @@ -168,11 +168,11 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) { `) hiddenAPI := result.SingletonForTests("hiddenapi") - hiddenapiRule := hiddenAPI.Rule("hiddenapi") - fromSourceJarArg := "--boot-dex=" + buildDir + "/.intermediates/foo/android_common/aligned/foo.jar" + hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop() + fromSourceJarArg := "--boot-dex=out/soong/.intermediates/foo/android_common/aligned/foo.jar" 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) } @@ -195,11 +195,11 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) { `) hiddenAPI := result.SingletonForTests("hiddenapi") - hiddenapiRule := hiddenAPI.Rule("hiddenapi") - prebuiltJarArg := "--boot-dex=" + buildDir + "/.intermediates/prebuilt_foo/android_common/dex/foo.jar" + hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop() + prebuiltJarArg := "--boot-dex=out/soong/.intermediates/prebuilt_foo/android_common/dex/foo.jar" 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) } @@ -243,7 +243,7 @@ func TestHiddenAPISingletonSdks(t *testing.T) { ).RunTest(t) hiddenAPI := result.SingletonForTests("hiddenapi") - hiddenapiRule := hiddenAPI.Rule("hiddenapi") + hiddenapiRule := hiddenAPI.Rule("hiddenapi").RelativeToTop() wantPublicStubs := "--public-stub-classpath=" + generateSdkDexPath(tc.publicStub, tc.unbundledBuild) 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 { - 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 { @@ -297,8 +297,8 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) { `) expectedCpInput := prebuiltHiddenApiDir + "/hiddenapi-flags.csv" - expectedCpOutput := buildDir + "/hiddenapi/hiddenapi-flags.csv" - expectedFlagsCsv := buildDir + "/hiddenapi/hiddenapi-flags.csv" + expectedCpOutput := "out/soong/hiddenapi/hiddenapi-flags.csv" + expectedFlagsCsv := "out/soong/hiddenapi/hiddenapi-flags.csv" foo := result.ModuleForTests("foo", "android_common") @@ -306,12 +306,12 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) { cpRule := hiddenAPI.Rule("Cp") actualCpInput := cpRule.BuildParams.Input actualCpOutput := cpRule.BuildParams.Output - encodeDexRule := foo.Rule("hiddenAPIEncodeDex") + encodeDexRule := foo.Rule("hiddenAPIEncodeDex").RelativeToTop() 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) }