Merge changes I8e4c3f37,I89a32bde
* changes: add plugins to javaLibraryAttributes convert java_import_host with bp2build; enable jetifier
This commit is contained in:
@@ -357,6 +357,7 @@ var (
|
||||
"packages/services/Car/tests/SampleRearViewCamera": Bp2BuildDefaultTrue,
|
||||
"prebuilts/clang/host/linux-x86": Bp2BuildDefaultTrueRecursively,
|
||||
"prebuilts/tools/common/m2": Bp2BuildDefaultTrue,
|
||||
"prebuilts/sdk/tools/jetifier/jetifier-standalone": Bp2BuildDefaultTrue,
|
||||
"system/apex": Bp2BuildDefaultFalse, // TODO(b/207466993): flaky failures
|
||||
"system/apex/proto": Bp2BuildDefaultTrueRecursively,
|
||||
"system/apex/libs": Bp2BuildDefaultTrueRecursively,
|
||||
@@ -415,12 +416,21 @@ var (
|
||||
|
||||
//system/extras/verity/fec
|
||||
"fec",
|
||||
|
||||
//packages/apps/Car/libs/car-ui-lib/car-ui-androidx
|
||||
// genrule dependencies for java_imports
|
||||
"car-ui-androidx-annotation-nodeps",
|
||||
"car-ui-androidx-collection-nodeps",
|
||||
"car-ui-androidx-core-common-nodeps",
|
||||
"car-ui-androidx-lifecycle-common-nodeps",
|
||||
"car-ui-androidx-constraintlayout-solver-nodeps",
|
||||
}
|
||||
|
||||
// Per-module-type allowlist to always opt modules in to both bp2build and mixed builds
|
||||
// when they have the same type as one listed.
|
||||
bp2buildModuleTypeAlwaysConvertList = []string{
|
||||
"java_import",
|
||||
"java_import_host",
|
||||
}
|
||||
|
||||
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
|
||||
@@ -560,18 +570,7 @@ var (
|
||||
"art-script", // depends on unconverted modules: dalvikvm, dex2oat
|
||||
"dex2oat-script", // depends on unconverted modules: dex2oat
|
||||
|
||||
// TODO(b/221082840) convert java_imports in //packages/apps/Car/libs/car-ui-lib/...
|
||||
"prebuilt_car-ui-androidx-annotation",
|
||||
"prebuilt_car-ui-androidx-annotation-nodeps",
|
||||
"prebuilt_car-ui-androidx-collection",
|
||||
"prebuilt_car-ui-androidx-collection-nodeps",
|
||||
"prebuilt_car-ui-androidx-core-common",
|
||||
"prebuilt_car-ui-androidx-core-common-nodeps",
|
||||
"prebuilt_car-ui-androidx-lifecycle-common",
|
||||
"prebuilt_car-ui-androidx-lifecycle-common-nodeps",
|
||||
"prebuilt_car-ui-androidx-constraintlayout-solver",
|
||||
"prebuilt_car-ui-androidx-constraintlayout-solver-nodeps",
|
||||
|
||||
"prebuilt_car-ui-androidx-core-common", // b/224773339, genrule dependency creates an .aar, not a .jar
|
||||
"prebuilt_art-module-host-exports_okhttp-norepackage@current", // aosp/1999250, needs Jars (arch variant)
|
||||
"prebuilt_conscrypt-unbundled", // aosp/1999250, needs Jars (arch variant)
|
||||
"prebuilt_conscrypt-module-host-exports_conscrypt-unbundled@current", // aosp/1999250, needs Jars (arch variant)
|
||||
|
@@ -22,11 +22,15 @@ import (
|
||||
"android/soong/java"
|
||||
)
|
||||
|
||||
func runJavaLibraryTestCase(t *testing.T, tc bp2buildTestCase) {
|
||||
func runJavaLibraryTestCaseWithRegistrationCtxFunc(t *testing.T, tc bp2buildTestCase, registrationCtxFunc func(ctx android.RegistrationContext)) {
|
||||
t.Helper()
|
||||
(&tc).moduleTypeUnderTest = "java_library"
|
||||
(&tc).moduleTypeUnderTestFactory = java.LibraryFactory
|
||||
runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc)
|
||||
runBp2BuildTestCase(t, registrationCtxFunc, tc)
|
||||
}
|
||||
|
||||
func runJavaLibraryTestCase(t *testing.T, tc bp2buildTestCase) {
|
||||
runJavaLibraryTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) {})
|
||||
}
|
||||
|
||||
func TestJavaLibrary(t *testing.T) {
|
||||
@@ -129,3 +133,26 @@ java_library {
|
||||
expectedBazelTargets: []string{},
|
||||
})
|
||||
}
|
||||
|
||||
func TestJavaLibraryPlugins(t *testing.T) {
|
||||
runJavaLibraryTestCaseWithRegistrationCtxFunc(t, bp2buildTestCase{
|
||||
blueprint: `java_library {
|
||||
name: "java-lib-1",
|
||||
plugins: ["java-plugin-1"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
|
||||
java_plugin {
|
||||
name: "java-plugin-1",
|
||||
srcs: ["a.java"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("java_library", "java-lib-1", attrNameToString{
|
||||
"plugins": `[":java-plugin-1"]`,
|
||||
}),
|
||||
},
|
||||
}, func(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("java_plugin", java.PluginFactory)
|
||||
})
|
||||
}
|
||||
|
@@ -1725,6 +1725,7 @@ func ImportFactoryHost() android.Module {
|
||||
|
||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||
android.InitApexModule(module)
|
||||
android.InitBazelModule(module)
|
||||
InitJavaModule(module, android.HostSupported)
|
||||
return module
|
||||
}
|
||||
@@ -2025,6 +2026,7 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
|
||||
|
||||
type javaCommonAttributes struct {
|
||||
Srcs bazel.LabelListAttribute
|
||||
Plugins bazel.LabelListAttribute
|
||||
Javacopts bazel.StringListAttribute
|
||||
}
|
||||
|
||||
@@ -2060,6 +2062,9 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext)
|
||||
|
||||
commonAttrs := &javaCommonAttributes{
|
||||
Srcs: srcPartitions[javaSrcPartition],
|
||||
Plugins: bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleDeps(ctx, m.properties.Plugins),
|
||||
),
|
||||
}
|
||||
|
||||
if m.properties.Javacflags != nil {
|
||||
|
Reference in New Issue
Block a user