From 5c503d1c434603370c442fbe29f330cc3f77e439 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 24 Jan 2023 11:48:08 -0800 Subject: Precompile python sources This signifigantly improves the startup time of soong-built python binaries. For example, running `m apexer && time out/host/linux-x86/bin/apexer` gives 0.734s before this cl, and 0.094s after. Fixes: 259718110 Test: Presubmits Change-Id: Ib19e83e2c60c39a849525be117279c318de3afa7 --- java/java_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'java/java_test.go') diff --git a/java/java_test.go b/java/java_test.go index 04a112c0a..21993eccf 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -30,7 +30,6 @@ import ( "android/soong/cc" "android/soong/dexpreopt" "android/soong/genrule" - "android/soong/python" ) // Legacy preparer used for running tests within the java package. @@ -49,7 +48,6 @@ var prepareForJavaTest = android.GroupFixturePreparers( // Include all the default java modules. PrepareForTestWithJavaDefaultModules, PrepareForTestWithOverlayBuildComponents, - python.PrepareForTestWithPythonBuildComponents, android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) { ctx.RegisterPreSingletonType("sdk_versions", sdkPreSingletonFactory) }), @@ -1440,24 +1438,26 @@ func TestAidlEnforcePermissionsException(t *testing.T) { } func TestDataNativeBinaries(t *testing.T) { - ctx, _ := testJava(t, ` + ctx := android.GroupFixturePreparers( + prepareForJavaTest, + android.PrepareForTestWithAllowMissingDependencies).RunTestWithBp(t, ` java_test_host { name: "foo", srcs: ["a.java"], data_native_bins: ["bin"] } - python_binary_host { + cc_binary_host { name: "bin", - srcs: ["bin.py"], + srcs: ["bin.cpp"], } - `) + `).TestContext buildOS := ctx.Config().BuildOS.String() test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost) entries := android.AndroidMkEntriesForTest(t, ctx, test)[0] - expected := []string{"out/soong/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"} + expected := []string{"out/soong/.intermediates/bin/" + buildOS + "_x86_64/bin:bin"} actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"] android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_COMPATIBILITY_SUPPORT_FILES", ctx.Config(), expected, actual) } -- cgit v1.2.3-59-g8ed1b