Loading bp2build/aar_conversion_test.go +13 −6 Original line number Diff line number Diff line Loading @@ -15,10 +15,10 @@ package bp2build import ( "testing" "android/soong/android" "android/soong/java" "testing" ) func TestConvertAndroidLibrary(t *testing.T) { Loading @@ -34,7 +34,8 @@ func TestConvertAndroidLibrary(t *testing.T) { "res/res.png": "", "manifest/AndroidManifest.xml": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "static_lib_dep") + ` StubbedBuildDefinitions: []string{"static_lib_dep"}, Blueprint: simpleModule("android_library", "static_lib_dep") + ` android_library { name: "TestLib", srcs: ["lib.java"], Loading Loading @@ -81,7 +82,7 @@ func TestConvertAndroidLibraryWithNoSources(t *testing.T) { "res/res.png": "", "AndroidManifest.xml": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "lib_dep") + ` Blueprint: simpleModule("android_library", "lib_dep") + ` android_library { name: "TestLib", srcs: [], Loading @@ -107,18 +108,24 @@ func TestConvertAndroidLibraryImport(t *testing.T) { ModuleTypeUnderTestFactory: java.AARImportFactory, Filesystem: map[string]string{ "import.aar": "", "dep.aar": "", }, StubbedBuildDefinitions: []string{"static_lib_dep", "prebuilt_static_import_dep"}, // Bazel's aar_import can only export *_import targets, so we expect // only "static_import_dep" in exports, but both "static_lib_dep" and // "static_import_dep" in deps Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "static_lib_dep") + SimpleModuleDoNotConvertBp2build("android_library_import", "static_import_dep") + ` Blueprint: simpleModule("android_library", "static_lib_dep") + ` android_library_import { name: "TestImport", aars: ["import.aar"], static_libs: ["static_lib_dep", "static_import_dep"], sdk_version: "current", } // TODO: b/301007952 - This dep is needed because android_library_import must have aars set. android_library_import { name: "static_import_dep", } `, ExpectedBazelTargets: []string{ MakeBazelTarget( Loading bp2build/android_app_conversion_test.go +10 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,8 @@ func TestAndroidAppAllSupportedFields(t *testing.T) { "manifest/AndroidManifest.xml": "", "assets_/asset.png": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` StubbedBuildDefinitions: []string{"static_lib_dep"}, Blueprint: simpleModule("android_app", "static_lib_dep") + ` android_app { name: "TestApp", srcs: ["app.java"], Loading Loading @@ -177,7 +178,8 @@ func TestAndroidAppCertIsModule(t *testing.T) { ModuleTypeUnderTest: "android_app", ModuleTypeUnderTestFactory: java.AndroidAppFactory, Filesystem: map[string]string{}, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "foocert") + ` StubbedBuildDefinitions: []string{"foocert"}, Blueprint: simpleModule("filegroup", "foocert") + ` android_app { name: "TestApp", certificate: ":foocert", Loading Loading @@ -262,7 +264,8 @@ func TestAndroidAppLibs(t *testing.T) { ModuleTypeUnderTest: "android_app", ModuleTypeUnderTestFactory: java.AndroidAppFactory, Filesystem: map[string]string{}, Blueprint: SimpleModuleDoNotConvertBp2build("java_library", "barLib") + ` StubbedBuildDefinitions: []string{"barLib"}, Blueprint: simpleModule("java_library", "barLib") + ` android_app { name: "foo", libs: ["barLib"], Loading Loading @@ -291,8 +294,9 @@ func TestAndroidAppKotlinSrcs(t *testing.T) { Filesystem: map[string]string{ "res/res.png": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "foocert") + SimpleModuleDoNotConvertBp2build("java_library", "barLib") + ` StubbedBuildDefinitions: []string{"foocert", "barLib"}, Blueprint: simpleModule("filegroup", "foocert") + simpleModule("java_library", "barLib") + ` android_app { name: "foo", srcs: ["a.java", "b.kt"], Loading Loading @@ -334,6 +338,7 @@ func TestAndroidAppCommonSrcs(t *testing.T) { Filesystem: map[string]string{ "res/res.png": "", }, StubbedBuildDefinitions: []string{"barLib"}, Blueprint: ` android_app { name: "foo", Loading @@ -348,7 +353,6 @@ android_app { } java_library{ name: "barLib", bazel_module: { bp2build_available: false }, } `, ExpectedBazelTargets: []string{ Loading bp2build/apex_conversion_test.go +54 −80 File changed.Preview size limit exceeded, changes collapsed. Show changes bp2build/apex_key_conversion_test.go +3 −2 Original line number Diff line number Diff line Loading @@ -83,14 +83,15 @@ func TestApexKey_KeysAreModules(t *testing.T) { ModuleTypeUnderTest: "apex_key", ModuleTypeUnderTestFactory: apex.ApexKeyFactory, Filesystem: map[string]string{}, StubbedBuildDefinitions: []string{"com.android.apogee.avbpubkey", "com.android.apogee.pem"}, Blueprint: ` apex_key { name: "com.android.apogee.key", public_key: ":com.android.apogee.avbpubkey", private_key: ":com.android.apogee.pem", } ` + SimpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.avbpubkey") + SimpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.pem"), ` + simpleModule("filegroup", "com.android.apogee.avbpubkey") + simpleModule("filegroup", "com.android.apogee.pem"), ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{ "private_key": `":com.android.apogee.pem"`, "public_key": `":com.android.apogee.avbpubkey"`, Loading bp2build/build_conversion_test.go +11 −6 Original line number Diff line number Diff line Loading @@ -1743,7 +1743,8 @@ func TestCommonBp2BuildModuleAttrs(t *testing.T) { Description: "Required into data test", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd"], Loading @@ -1759,7 +1760,8 @@ filegroup { Description: "Required into data test, cyclic self reference is filtered out", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd", "fg_foo"], Loading @@ -1775,8 +1777,9 @@ filegroup { Description: "Required via arch into data test", ModuleTypeUnderTest: "python_library", ModuleTypeUnderTestFactory: python.PythonLibraryFactory, Blueprint: SimpleModuleDoNotConvertBp2build("python_library", "reqdx86") + SimpleModuleDoNotConvertBp2build("python_library", "reqdarm") + ` StubbedBuildDefinitions: []string{"reqdx86", "reqdarm"}, Blueprint: simpleModule("python_library", "reqdx86") + simpleModule("python_library", "reqdarm") + ` python_library { name: "fg_foo", arch: { Loading Loading @@ -1809,7 +1812,8 @@ python_library { "data.bin": "", "src.py": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("python_library", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("python_library", "reqd") + ` python_library { name: "fg_foo", data: ["data.bin"], Loading @@ -1831,7 +1835,8 @@ python_library { Description: "All props-to-attrs at once together test", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd"], Loading Loading
bp2build/aar_conversion_test.go +13 −6 Original line number Diff line number Diff line Loading @@ -15,10 +15,10 @@ package bp2build import ( "testing" "android/soong/android" "android/soong/java" "testing" ) func TestConvertAndroidLibrary(t *testing.T) { Loading @@ -34,7 +34,8 @@ func TestConvertAndroidLibrary(t *testing.T) { "res/res.png": "", "manifest/AndroidManifest.xml": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "static_lib_dep") + ` StubbedBuildDefinitions: []string{"static_lib_dep"}, Blueprint: simpleModule("android_library", "static_lib_dep") + ` android_library { name: "TestLib", srcs: ["lib.java"], Loading Loading @@ -81,7 +82,7 @@ func TestConvertAndroidLibraryWithNoSources(t *testing.T) { "res/res.png": "", "AndroidManifest.xml": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "lib_dep") + ` Blueprint: simpleModule("android_library", "lib_dep") + ` android_library { name: "TestLib", srcs: [], Loading @@ -107,18 +108,24 @@ func TestConvertAndroidLibraryImport(t *testing.T) { ModuleTypeUnderTestFactory: java.AARImportFactory, Filesystem: map[string]string{ "import.aar": "", "dep.aar": "", }, StubbedBuildDefinitions: []string{"static_lib_dep", "prebuilt_static_import_dep"}, // Bazel's aar_import can only export *_import targets, so we expect // only "static_import_dep" in exports, but both "static_lib_dep" and // "static_import_dep" in deps Blueprint: SimpleModuleDoNotConvertBp2build("android_library", "static_lib_dep") + SimpleModuleDoNotConvertBp2build("android_library_import", "static_import_dep") + ` Blueprint: simpleModule("android_library", "static_lib_dep") + ` android_library_import { name: "TestImport", aars: ["import.aar"], static_libs: ["static_lib_dep", "static_import_dep"], sdk_version: "current", } // TODO: b/301007952 - This dep is needed because android_library_import must have aars set. android_library_import { name: "static_import_dep", } `, ExpectedBazelTargets: []string{ MakeBazelTarget( Loading
bp2build/android_app_conversion_test.go +10 −6 Original line number Diff line number Diff line Loading @@ -78,7 +78,8 @@ func TestAndroidAppAllSupportedFields(t *testing.T) { "manifest/AndroidManifest.xml": "", "assets_/asset.png": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` StubbedBuildDefinitions: []string{"static_lib_dep"}, Blueprint: simpleModule("android_app", "static_lib_dep") + ` android_app { name: "TestApp", srcs: ["app.java"], Loading Loading @@ -177,7 +178,8 @@ func TestAndroidAppCertIsModule(t *testing.T) { ModuleTypeUnderTest: "android_app", ModuleTypeUnderTestFactory: java.AndroidAppFactory, Filesystem: map[string]string{}, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "foocert") + ` StubbedBuildDefinitions: []string{"foocert"}, Blueprint: simpleModule("filegroup", "foocert") + ` android_app { name: "TestApp", certificate: ":foocert", Loading Loading @@ -262,7 +264,8 @@ func TestAndroidAppLibs(t *testing.T) { ModuleTypeUnderTest: "android_app", ModuleTypeUnderTestFactory: java.AndroidAppFactory, Filesystem: map[string]string{}, Blueprint: SimpleModuleDoNotConvertBp2build("java_library", "barLib") + ` StubbedBuildDefinitions: []string{"barLib"}, Blueprint: simpleModule("java_library", "barLib") + ` android_app { name: "foo", libs: ["barLib"], Loading Loading @@ -291,8 +294,9 @@ func TestAndroidAppKotlinSrcs(t *testing.T) { Filesystem: map[string]string{ "res/res.png": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "foocert") + SimpleModuleDoNotConvertBp2build("java_library", "barLib") + ` StubbedBuildDefinitions: []string{"foocert", "barLib"}, Blueprint: simpleModule("filegroup", "foocert") + simpleModule("java_library", "barLib") + ` android_app { name: "foo", srcs: ["a.java", "b.kt"], Loading Loading @@ -334,6 +338,7 @@ func TestAndroidAppCommonSrcs(t *testing.T) { Filesystem: map[string]string{ "res/res.png": "", }, StubbedBuildDefinitions: []string{"barLib"}, Blueprint: ` android_app { name: "foo", Loading @@ -348,7 +353,6 @@ android_app { } java_library{ name: "barLib", bazel_module: { bp2build_available: false }, } `, ExpectedBazelTargets: []string{ Loading
bp2build/apex_conversion_test.go +54 −80 File changed.Preview size limit exceeded, changes collapsed. Show changes
bp2build/apex_key_conversion_test.go +3 −2 Original line number Diff line number Diff line Loading @@ -83,14 +83,15 @@ func TestApexKey_KeysAreModules(t *testing.T) { ModuleTypeUnderTest: "apex_key", ModuleTypeUnderTestFactory: apex.ApexKeyFactory, Filesystem: map[string]string{}, StubbedBuildDefinitions: []string{"com.android.apogee.avbpubkey", "com.android.apogee.pem"}, Blueprint: ` apex_key { name: "com.android.apogee.key", public_key: ":com.android.apogee.avbpubkey", private_key: ":com.android.apogee.pem", } ` + SimpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.avbpubkey") + SimpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.pem"), ` + simpleModule("filegroup", "com.android.apogee.avbpubkey") + simpleModule("filegroup", "com.android.apogee.pem"), ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{ "private_key": `":com.android.apogee.pem"`, "public_key": `":com.android.apogee.avbpubkey"`, Loading
bp2build/build_conversion_test.go +11 −6 Original line number Diff line number Diff line Loading @@ -1743,7 +1743,8 @@ func TestCommonBp2BuildModuleAttrs(t *testing.T) { Description: "Required into data test", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd"], Loading @@ -1759,7 +1760,8 @@ filegroup { Description: "Required into data test, cyclic self reference is filtered out", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd", "fg_foo"], Loading @@ -1775,8 +1777,9 @@ filegroup { Description: "Required via arch into data test", ModuleTypeUnderTest: "python_library", ModuleTypeUnderTestFactory: python.PythonLibraryFactory, Blueprint: SimpleModuleDoNotConvertBp2build("python_library", "reqdx86") + SimpleModuleDoNotConvertBp2build("python_library", "reqdarm") + ` StubbedBuildDefinitions: []string{"reqdx86", "reqdarm"}, Blueprint: simpleModule("python_library", "reqdx86") + simpleModule("python_library", "reqdarm") + ` python_library { name: "fg_foo", arch: { Loading Loading @@ -1809,7 +1812,8 @@ python_library { "data.bin": "", "src.py": "", }, Blueprint: SimpleModuleDoNotConvertBp2build("python_library", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("python_library", "reqd") + ` python_library { name: "fg_foo", data: ["data.bin"], Loading @@ -1831,7 +1835,8 @@ python_library { Description: "All props-to-attrs at once together test", ModuleTypeUnderTest: "filegroup", ModuleTypeUnderTestFactory: android.FileGroupFactory, Blueprint: SimpleModuleDoNotConvertBp2build("filegroup", "reqd") + ` StubbedBuildDefinitions: []string{"reqd"}, Blueprint: simpleModule("filegroup", "reqd") + ` filegroup { name: "fg_foo", required: ["reqd"], Loading