Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c01fc68 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I343712d7,Ic076ea85

* changes:
  Improve hidden API checking in TestBootDexJarsFromSourcesAndPrebuilts
  Add target for generate_hiddenapi_lists_test
parents ae863386 40a3f654
Loading
Loading
Loading
Loading
+30 −6
Original line number Diff line number Diff line
@@ -4890,7 +4890,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		}
	}

	checkHiddenAPIIndexInputs := func(t *testing.T, ctx *android.TestContext, expectedIntermediateInputs string) {
	checkHiddenAPIIndexFromClassesInputs := func(t *testing.T, ctx *android.TestContext, expectedIntermediateInputs string) {
		t.Helper()
		platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common")
		var rule android.TestingBuildParams
@@ -4899,6 +4899,15 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		java.CheckHiddenAPIRuleInputs(t, "intermediate index", expectedIntermediateInputs, rule)
	}

	checkHiddenAPIIndexFromFlagsInputs := func(t *testing.T, ctx *android.TestContext, expectedIntermediateInputs string) {
		t.Helper()
		platformBootclasspath := ctx.ModuleForTests("platform-bootclasspath", "android_common")
		var rule android.TestingBuildParams

		rule = platformBootclasspath.Output("hiddenapi-index.csv")
		java.CheckHiddenAPIRuleInputs(t, "monolithic index", expectedIntermediateInputs, rule)
	}

	fragment := java.ApexVariantReference{
		Apex:   proptools.StringPtr("myapex"),
		Module: proptools.StringPtr("my-bootclasspath-fragment"),
@@ -4946,10 +4955,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")

		// Verify the correct module jars contribute to the hiddenapi index file.
		checkHiddenAPIIndexInputs(t, ctx, `
		checkHiddenAPIIndexFromClassesInputs(t, ctx, `
			out/soong/.intermediates/libbar.stubs/android_common/combined/libbar.stubs.jar
			out/soong/.intermediates/libfoo/android_common_myapex/combined/libfoo.jar
		`)
		checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
			out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
		`)
	})

	t.Run("apex_set only", func(t *testing.T) {
@@ -4987,10 +4999,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")

		// Verify the correct module jars contribute to the hiddenapi index file.
		checkHiddenAPIIndexInputs(t, ctx, `
		checkHiddenAPIIndexFromClassesInputs(t, ctx, `
			out/soong/.intermediates/libbar.stubs/android_common/combined/libbar.stubs.jar
			out/soong/.intermediates/libfoo/android_common_myapex/combined/libfoo.jar
		`)
		checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
			out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
		`)
	})

	t.Run("prebuilt with source library preferred", func(t *testing.T) {
@@ -5108,10 +5123,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")

		// Verify the correct module jars contribute to the hiddenapi index file.
		checkHiddenAPIIndexInputs(t, ctx, `
		checkHiddenAPIIndexFromClassesInputs(t, ctx, `
			out/soong/.intermediates/prebuilt_libbar.stubs/android_common/combined/libbar.stubs.jar
			out/soong/.intermediates/prebuilt_libfoo/android_common_myapex/combined/libfoo.jar
		`)
		checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
			out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
		`)
	})

	t.Run("prebuilt with source apex preferred", func(t *testing.T) {
@@ -5182,10 +5200,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/libbar/android_common_myapex/hiddenapi/libbar.jar")

		// Verify the correct module jars contribute to the hiddenapi index file.
		checkHiddenAPIIndexInputs(t, ctx, `
		checkHiddenAPIIndexFromClassesInputs(t, ctx, `
			out/soong/.intermediates/libbar/android_common_myapex/javac/libbar.jar
			out/soong/.intermediates/libfoo/android_common_apex10000/javac/libfoo.jar
		`)
		checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
			out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
		`)
	})

	t.Run("prebuilt preferred with source apex disabled", func(t *testing.T) {
@@ -5258,10 +5279,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
		checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")

		// Verify the correct module jars contribute to the hiddenapi index file.
		checkHiddenAPIIndexInputs(t, ctx, `
		checkHiddenAPIIndexFromClassesInputs(t, ctx, `
			out/soong/.intermediates/prebuilt_libbar.stubs/android_common/combined/libbar.stubs.jar
			out/soong/.intermediates/prebuilt_libfoo/android_common_myapex/combined/libfoo.jar
		`)
		checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
			out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
		`)
	})
}

+21 −0
Original line number Diff line number Diff line
@@ -48,6 +48,27 @@ python_binary_host {
    },
}

python_test_host {
    name: "generate_hiddenapi_lists_test",
    main: "generate_hiddenapi_lists_test.py",
    srcs: [
        "generate_hiddenapi_lists.py",
        "generate_hiddenapi_lists_test.py",
    ],
    version: {
        py2: {
            enabled: false,
        },
        py3: {
            enabled: true,
            embedded_launcher: true,
        },
    },
    test_options: {
        unit_test: true,
    },
}

python_binary_host {
    name: "verify_overlaps",
    main: "verify_overlaps.py",
+1 −1
Original line number Diff line number Diff line
@@ -101,4 +101,4 @@ class TestHiddenapiListGeneration(unittest.TestCase):
        self.assertEqual(extract_package(signature), expected_package)

if __name__ == '__main__':
    unittest.main()
    unittest.main(verbosity=2)