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
diff --git a/java/java_test.go b/java/java_test.go
index 04a112c..21993ec 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -30,7 +30,6 @@
"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 @@
// 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 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)
}