diff options
| author | 2021-03-13 22:19:17 +0000 | |
|---|---|---|
| committer | 2021-03-14 01:08:26 +0000 | |
| commit | bf028b533d2f5fa59879876206071338af429cd7 (patch) | |
| tree | f637035e2d2740b3582d2e3c38130c741ed811c3 | |
| parent | 6bac49c560e9aecd7c90550bc38c0270351aa33b (diff) | |
Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()
Needed for tests in both java and sdk packages.
Bug: 182638834
Test: m nothing
Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
| -rw-r--r-- | java/java_test.go | 1 | ||||
| -rw-r--r-- | java/testing.go | 30 |
2 files changed, 18 insertions, 13 deletions
diff --git a/java/java_test.go b/java/java_test.go index 2ef3f426f..356f8f58d 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -65,6 +65,7 @@ var javaFixtureFactory = android.NewFixtureFactory( ctx.RegisterPreSingletonType("sdk_versions", sdkPreSingletonFactory) }), javaMockFS().AddToFixture(), + PrepareForTestWithJavaSdkLibraryFiles, dexpreopt.PrepareForTestWithDexpreopt, ) diff --git a/java/testing.go b/java/testing.go index 4e1997e45..a1404a5ae 100644 --- a/java/testing.go +++ b/java/testing.go @@ -61,27 +61,30 @@ var PrepareForIntegrationTestWithJava = android.GroupFixturePreparers( PrepareForTestWithJavaDefaultModules, ) +// Prepare a fixture with the standard files required by a java_sdk_library module. +var PrepareForTestWithJavaSdkLibraryFiles = android.FixtureMergeMockFs(javaSdkLibraryFiles) + +var javaSdkLibraryFiles = android.MockFS{ + "api/current.txt": nil, + "api/removed.txt": nil, + "api/system-current.txt": nil, + "api/system-removed.txt": nil, + "api/test-current.txt": nil, + "api/test-removed.txt": nil, + "api/module-lib-current.txt": nil, + "api/module-lib-removed.txt": nil, + "api/system-server-current.txt": nil, + "api/system-server-removed.txt": nil, +} + func javaMockFS() android.MockFS { mockFS := android.MockFS{ - "api/current.txt": nil, - "api/removed.txt": nil, - "api/system-current.txt": nil, - "api/system-removed.txt": nil, - "api/test-current.txt": nil, - "api/test-removed.txt": nil, - "prebuilts/sdk/tools/core-lambda-stubs.jar": nil, "prebuilts/sdk/Android.bp": []byte(`prebuilt_apis { name: "sdk", api_dirs: ["14", "28", "30", "current"], imports_sdk_version: "none", imports_compile_dex:true,}`), "bin.py": nil, python.StubTemplateHost: []byte(`PYTHON_BINARY = '%interpreter%' MAIN_FILE = '%main%'`), - - // For java_sdk_library - "api/module-lib-current.txt": nil, - "api/module-lib-removed.txt": nil, - "api/system-server-current.txt": nil, - "api/system-server-removed.txt": nil, } levels := []string{"14", "28", "29", "30", "current"} @@ -101,6 +104,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string bp += GatherRequiredDepsForTest() mockFS := javaMockFS() + mockFS.Merge(javaSdkLibraryFiles) cc.GatherRequiredFilesForTest(mockFS) |