Dedup system modules and sdk library module type registration

Test: m checkbuild
Bug: 146540677
Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
This commit is contained in:
Paul Duffin 2019-12-19 11:18:54 +00:00
parent b0f850784a
commit 43dc1cc2bc
5 changed files with 16 additions and 8 deletions

View file

@ -305,7 +305,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
ctx.RegisterModuleType("sh_binary", android.ShBinaryFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
java.RegisterJavaBuildComponents(ctx)
ctx.RegisterModuleType("java_system_modules", java.SystemModulesFactory)
java.RegisterSystemModulesBuildComponents(ctx)
java.RegisterAppBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)

View file

@ -67,14 +67,13 @@ func testContext() *android.TestContext {
RegisterAppBuildComponents(ctx)
RegisterAARBuildComponents(ctx)
RegisterGenRuleBuildComponents(ctx)
ctx.RegisterModuleType("java_system_modules", SystemModulesFactory)
RegisterSystemModulesBuildComponents(ctx)
ctx.RegisterModuleType("java_plugin", PluginFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
RegisterDocsBuildComponents(ctx)
RegisterStubsBuildComponents(ctx)
ctx.RegisterModuleType("java_sdk_library", SdkLibraryFactory)
ctx.RegisterModuleType("java_sdk_library_import", sdkLibraryImportFactory)
RegisterSdkLibraryBuildComponents(ctx)
ctx.RegisterModuleType("prebuilt_apis", PrebuiltApisFactory)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)

View file

@ -68,8 +68,7 @@ var (
// 2) HTML generation
func init() {
android.RegisterModuleType("java_sdk_library", SdkLibraryFactory)
android.RegisterModuleType("java_sdk_library_import", sdkLibraryImportFactory)
RegisterSdkLibraryBuildComponents(android.InitRegistrationContext)
android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) {
javaSdkLibraries := javaSdkLibraries(ctx.Config())
@ -78,6 +77,11 @@ func init() {
})
}
func RegisterSdkLibraryBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_sdk_library", SdkLibraryFactory)
ctx.RegisterModuleType("java_sdk_library_import", sdkLibraryImportFactory)
}
type sdkLibraryProperties struct {
// List of Java libraries that will be in the classpath when building stubs
Stub_only_libs []string `android:"arch_variant"`

View file

@ -28,11 +28,15 @@ import (
// system modules in a runtime image using the jmod and jlink tools.
func init() {
android.RegisterModuleType("java_system_modules", SystemModulesFactory)
RegisterSystemModulesBuildComponents(android.InitRegistrationContext)
pctx.SourcePathVariable("moduleInfoJavaPath", "build/soong/scripts/jars-to-module-info-java.sh")
}
func RegisterSystemModulesBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_system_modules", SystemModulesFactory)
}
var (
jarsTosystemModules = pctx.AndroidStaticRule("jarsTosystemModules", blueprint.RuleParams{
Command: `rm -rf ${outDir} ${workDir} && mkdir -p ${workDir}/jmod && ` +

View file

@ -58,7 +58,8 @@ func testContext(config android.Config) *android.TestContext {
ctx := android.NewTestArchContext()
java.RegisterJavaBuildComponents(ctx)
java.RegisterAppBuildComponents(ctx)
ctx.RegisterModuleType("java_system_modules", java.SystemModulesFactory)
java.RegisterSystemModulesBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)