Merge "convert java_import jars with arch variants" am: 7a45d37e62
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1995732 Change-Id: I05420e9a6cff3a8843dd5438b9b73becfaa8698d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -570,12 +570,9 @@ var (
|
|||||||
"art-script", // depends on unconverted modules: dalvikvm, dex2oat
|
"art-script", // depends on unconverted modules: dalvikvm, dex2oat
|
||||||
"dex2oat-script", // depends on unconverted modules: dex2oat
|
"dex2oat-script", // depends on unconverted modules: dex2oat
|
||||||
|
|
||||||
"prebuilt_car-ui-androidx-core-common", // b/224773339, genrule dependency creates an .aar, not a .jar
|
"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_platform-robolectric-4.4-prebuilt", // aosp/1999250, needs .aar support in Jars
|
||||||
"prebuilt_conscrypt-unbundled", // aosp/1999250, needs Jars (arch variant)
|
"prebuilt_platform-robolectric-4.5.1-prebuilt", // aosp/1999250, needs .aar support in Jars
|
||||||
"prebuilt_conscrypt-module-host-exports_conscrypt-unbundled@current", // aosp/1999250, needs Jars (arch variant)
|
|
||||||
"prebuilt_platform-robolectric-4.4-prebuilt", // aosp/1999250, needs .aar support in Jars
|
|
||||||
"prebuilt_platform-robolectric-4.5.1-prebuilt", // aosp/1999250, needs .aar support in Jars
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Per-module denylist of cc_library modules to only generate the static
|
// Per-module denylist of cc_library modules to only generate the static
|
||||||
|
@@ -29,7 +29,7 @@ func runJavaImportTestCase(t *testing.T, tc bp2buildTestCase) {
|
|||||||
func registerJavaImportModuleTypes(ctx android.RegistrationContext) {
|
func registerJavaImportModuleTypes(ctx android.RegistrationContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMinimalJavaImport(t *testing.T) {
|
func TestJavaImportMinimal(t *testing.T) {
|
||||||
runJavaImportTestCase(t, bp2buildTestCase{
|
runJavaImportTestCase(t, bp2buildTestCase{
|
||||||
description: "Java import - simple example",
|
description: "Java import - simple example",
|
||||||
moduleTypeUnderTest: "java_import",
|
moduleTypeUnderTest: "java_import",
|
||||||
@@ -50,3 +50,36 @@ java_import {
|
|||||||
}),
|
}),
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestJavaImportArchVariant(t *testing.T) {
|
||||||
|
runJavaImportTestCase(t, bp2buildTestCase{
|
||||||
|
description: "Java import - simple example",
|
||||||
|
moduleTypeUnderTest: "java_import",
|
||||||
|
moduleTypeUnderTestFactory: java.ImportFactory,
|
||||||
|
filesystem: map[string]string{
|
||||||
|
"import.jar": "",
|
||||||
|
},
|
||||||
|
blueprint: `
|
||||||
|
java_import {
|
||||||
|
name: "example_import",
|
||||||
|
target: {
|
||||||
|
android: {
|
||||||
|
jars: ["android.jar"],
|
||||||
|
},
|
||||||
|
linux_glibc: {
|
||||||
|
jars: ["linux.jar"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bazel_module: { bp2build_available: true },
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
expectedBazelTargets: []string{
|
||||||
|
makeBazelTarget("java_import", "example_import", attrNameToString{
|
||||||
|
"jars": `select({
|
||||||
|
"//build/bazel/platforms/os:android": ["android.jar"],
|
||||||
|
"//build/bazel/platforms/os:linux": ["linux.jar"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
})`,
|
||||||
|
}),
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
12
java/java.go
12
java/java.go
@@ -2218,8 +2218,16 @@ type bazelJavaImportAttributes struct {
|
|||||||
|
|
||||||
// java_import bp2Build converter.
|
// java_import bp2Build converter.
|
||||||
func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||||
//TODO(b/209577426): Support multiple arch variants
|
var jars bazel.LabelListAttribute
|
||||||
jars := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, i.properties.Jars, []string(nil)))
|
archVariantProps := i.GetArchVariantProperties(ctx, &ImportProperties{})
|
||||||
|
for axis, configToProps := range archVariantProps {
|
||||||
|
for config, _props := range configToProps {
|
||||||
|
if archProps, ok := _props.(*ImportProperties); ok {
|
||||||
|
archJars := android.BazelLabelForModuleSrcExcludes(ctx, archProps.Jars, []string(nil))
|
||||||
|
jars.SetSelectValue(axis, config, archJars)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attrs := &bazelJavaImportAttributes{
|
attrs := &bazelJavaImportAttributes{
|
||||||
Jars: jars,
|
Jars: jars,
|
||||||
|
Reference in New Issue
Block a user