Loading bazel/properties.go +4 −0 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,10 @@ func (ll *LabelList) IsNil() bool { return ll.Includes == nil && ll.Excludes == nil return ll.Includes == nil && ll.Excludes == nil } } func (ll *LabelList) IsEmpty() bool { return len(ll.Includes) == 0 && len(ll.Excludes) == 0 } func (ll *LabelList) deepCopy() LabelList { func (ll *LabelList) deepCopy() LabelList { return LabelList{ return LabelList{ Includes: ll.Includes[:], Includes: ll.Includes[:], Loading bp2build/android_app_certificate_conversion_test.go +10 −10 Original line number Original line Diff line number Diff line Loading @@ -21,28 +21,28 @@ import ( "testing" "testing" ) ) func runAndroidAppCertificateTestCase(t *testing.T, tc bp2buildTestCase) { func runAndroidAppCertificateTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc) RunBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc) } } func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) { func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) { } } func TestAndroidAppCertificateSimple(t *testing.T) { func TestAndroidAppCertificateSimple(t *testing.T) { runAndroidAppCertificateTestCase(t, bp2buildTestCase{ runAndroidAppCertificateTestCase(t, Bp2buildTestCase{ description: "Android app certificate - simple example", Description: "Android app certificate - simple example", moduleTypeUnderTest: "android_app_certificate", ModuleTypeUnderTest: "android_app_certificate", moduleTypeUnderTestFactory: java.AndroidAppCertificateFactory, ModuleTypeUnderTestFactory: java.AndroidAppCertificateFactory, filesystem: map[string]string{}, Filesystem: map[string]string{}, blueprint: ` Blueprint: ` android_app_certificate { android_app_certificate { name: "com.android.apogee.cert", name: "com.android.apogee.cert", certificate: "chamber_of_secrets_dir", certificate: "chamber_of_secrets_dir", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", attrNameToString{ MakeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", AttrNameToString{ "certificate": `"chamber_of_secrets_dir"`, "certificate": `"chamber_of_secrets_dir"`, }), }), }}) }}) Loading bp2build/android_app_conversion_test.go +26 −26 Original line number Original line Diff line number Diff line Loading @@ -21,33 +21,33 @@ import ( "testing" "testing" ) ) func runAndroidAppTestCase(t *testing.T, tc bp2buildTestCase) { func runAndroidAppTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerAndroidAppModuleTypes, tc) RunBp2BuildTestCase(t, registerAndroidAppModuleTypes, tc) } } func registerAndroidAppModuleTypes(ctx android.RegistrationContext) { func registerAndroidAppModuleTypes(ctx android.RegistrationContext) { } } func TestMinimalAndroidApp(t *testing.T) { func TestMinimalAndroidApp(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - simple example", Description: "Android app - simple example", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "app.java": "", "app.java": "", "res/res.png": "", "res/res.png": "", "AndroidManifest.xml": "", "AndroidManifest.xml": "", }, }, blueprint: ` Blueprint: ` android_app { android_app { name: "TestApp", name: "TestApp", srcs: ["app.java"], srcs: ["app.java"], sdk_version: "current", sdk_version: "current", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `["app.java"]`, "srcs": `["app.java"]`, "manifest": `"AndroidManifest.xml"`, "manifest": `"AndroidManifest.xml"`, "resource_files": `["res/res.png"]`, "resource_files": `["res/res.png"]`, Loading @@ -56,17 +56,17 @@ android_app { } } func TestAndroidAppAllSupportedFields(t *testing.T) { func TestAndroidAppAllSupportedFields(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - all supported fields", Description: "Android app - all supported fields", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "app.java": "", "app.java": "", "resa/res.png": "", "resa/res.png": "", "resb/res.png": "", "resb/res.png": "", "manifest/AndroidManifest.xml": "", "manifest/AndroidManifest.xml": "", }, }, blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` Blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` android_app { android_app { name: "TestApp", name: "TestApp", srcs: ["app.java"], srcs: ["app.java"], Loading @@ -78,8 +78,8 @@ android_app { java_version: "7", java_version: "7", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `["app.java"]`, "srcs": `["app.java"]`, "manifest": `"manifest/AndroidManifest.xml"`, "manifest": `"manifest/AndroidManifest.xml"`, "resource_files": `[ "resource_files": `[ Loading @@ -94,17 +94,17 @@ android_app { } } func TestAndroidAppArchVariantSrcs(t *testing.T) { func TestAndroidAppArchVariantSrcs(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - arch variant srcs", Description: "Android app - arch variant srcs", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "arm.java": "", "arm.java": "", "x86.java": "", "x86.java": "", "res/res.png": "", "res/res.png": "", "AndroidManifest.xml": "", "AndroidManifest.xml": "", }, }, blueprint: ` Blueprint: ` android_app { android_app { name: "TestApp", name: "TestApp", sdk_version: "current", sdk_version: "current", Loading @@ -118,8 +118,8 @@ android_app { } } } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `select({ "srcs": `select({ "//build/bazel/platforms/arch:arm": ["arm.java"], "//build/bazel/platforms/arch:arm": ["arm.java"], "//build/bazel/platforms/arch:x86": ["x86.java"], "//build/bazel/platforms/arch:x86": ["x86.java"], Loading bp2build/apex_conversion_test.go +170 −170 File changed.Preview size limit exceeded, changes collapsed. Show changes bp2build/apex_key_conversion_test.go +9 −9 Original line number Original line Diff line number Diff line Loading @@ -21,28 +21,28 @@ import ( "testing" "testing" ) ) func runApexKeyTestCase(t *testing.T, tc bp2buildTestCase) { func runApexKeyTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerApexKeyModuleTypes, tc) RunBp2BuildTestCase(t, registerApexKeyModuleTypes, tc) } } func registerApexKeyModuleTypes(ctx android.RegistrationContext) { func registerApexKeyModuleTypes(ctx android.RegistrationContext) { } } func TestApexKeySimple(t *testing.T) { func TestApexKeySimple(t *testing.T) { runApexKeyTestCase(t, bp2buildTestCase{ runApexKeyTestCase(t, Bp2buildTestCase{ description: "apex key - simple example", Description: "apex key - simple example", moduleTypeUnderTest: "apex_key", ModuleTypeUnderTest: "apex_key", moduleTypeUnderTestFactory: apex.ApexKeyFactory, ModuleTypeUnderTestFactory: apex.ApexKeyFactory, filesystem: map[string]string{}, Filesystem: map[string]string{}, blueprint: ` Blueprint: ` apex_key { apex_key { name: "com.android.apogee.key", name: "com.android.apogee.key", public_key: "com.android.apogee.avbpubkey", public_key: "com.android.apogee.avbpubkey", private_key: "com.android.apogee.pem", private_key: "com.android.apogee.pem", } } `, `, expectedBazelTargets: []string{makeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", attrNameToString{ ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{ "private_key": `"com.android.apogee.pem"`, "private_key": `"com.android.apogee.pem"`, "public_key": `"com.android.apogee.avbpubkey"`, "public_key": `"com.android.apogee.avbpubkey"`, }), }), Loading Loading
bazel/properties.go +4 −0 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,10 @@ func (ll *LabelList) IsNil() bool { return ll.Includes == nil && ll.Excludes == nil return ll.Includes == nil && ll.Excludes == nil } } func (ll *LabelList) IsEmpty() bool { return len(ll.Includes) == 0 && len(ll.Excludes) == 0 } func (ll *LabelList) deepCopy() LabelList { func (ll *LabelList) deepCopy() LabelList { return LabelList{ return LabelList{ Includes: ll.Includes[:], Includes: ll.Includes[:], Loading
bp2build/android_app_certificate_conversion_test.go +10 −10 Original line number Original line Diff line number Diff line Loading @@ -21,28 +21,28 @@ import ( "testing" "testing" ) ) func runAndroidAppCertificateTestCase(t *testing.T, tc bp2buildTestCase) { func runAndroidAppCertificateTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc) RunBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc) } } func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) { func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) { } } func TestAndroidAppCertificateSimple(t *testing.T) { func TestAndroidAppCertificateSimple(t *testing.T) { runAndroidAppCertificateTestCase(t, bp2buildTestCase{ runAndroidAppCertificateTestCase(t, Bp2buildTestCase{ description: "Android app certificate - simple example", Description: "Android app certificate - simple example", moduleTypeUnderTest: "android_app_certificate", ModuleTypeUnderTest: "android_app_certificate", moduleTypeUnderTestFactory: java.AndroidAppCertificateFactory, ModuleTypeUnderTestFactory: java.AndroidAppCertificateFactory, filesystem: map[string]string{}, Filesystem: map[string]string{}, blueprint: ` Blueprint: ` android_app_certificate { android_app_certificate { name: "com.android.apogee.cert", name: "com.android.apogee.cert", certificate: "chamber_of_secrets_dir", certificate: "chamber_of_secrets_dir", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", attrNameToString{ MakeBazelTargetNoRestrictions("android_app_certificate", "com.android.apogee.cert", AttrNameToString{ "certificate": `"chamber_of_secrets_dir"`, "certificate": `"chamber_of_secrets_dir"`, }), }), }}) }}) Loading
bp2build/android_app_conversion_test.go +26 −26 Original line number Original line Diff line number Diff line Loading @@ -21,33 +21,33 @@ import ( "testing" "testing" ) ) func runAndroidAppTestCase(t *testing.T, tc bp2buildTestCase) { func runAndroidAppTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerAndroidAppModuleTypes, tc) RunBp2BuildTestCase(t, registerAndroidAppModuleTypes, tc) } } func registerAndroidAppModuleTypes(ctx android.RegistrationContext) { func registerAndroidAppModuleTypes(ctx android.RegistrationContext) { } } func TestMinimalAndroidApp(t *testing.T) { func TestMinimalAndroidApp(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - simple example", Description: "Android app - simple example", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "app.java": "", "app.java": "", "res/res.png": "", "res/res.png": "", "AndroidManifest.xml": "", "AndroidManifest.xml": "", }, }, blueprint: ` Blueprint: ` android_app { android_app { name: "TestApp", name: "TestApp", srcs: ["app.java"], srcs: ["app.java"], sdk_version: "current", sdk_version: "current", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `["app.java"]`, "srcs": `["app.java"]`, "manifest": `"AndroidManifest.xml"`, "manifest": `"AndroidManifest.xml"`, "resource_files": `["res/res.png"]`, "resource_files": `["res/res.png"]`, Loading @@ -56,17 +56,17 @@ android_app { } } func TestAndroidAppAllSupportedFields(t *testing.T) { func TestAndroidAppAllSupportedFields(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - all supported fields", Description: "Android app - all supported fields", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "app.java": "", "app.java": "", "resa/res.png": "", "resa/res.png": "", "resb/res.png": "", "resb/res.png": "", "manifest/AndroidManifest.xml": "", "manifest/AndroidManifest.xml": "", }, }, blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` Blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + ` android_app { android_app { name: "TestApp", name: "TestApp", srcs: ["app.java"], srcs: ["app.java"], Loading @@ -78,8 +78,8 @@ android_app { java_version: "7", java_version: "7", } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `["app.java"]`, "srcs": `["app.java"]`, "manifest": `"manifest/AndroidManifest.xml"`, "manifest": `"manifest/AndroidManifest.xml"`, "resource_files": `[ "resource_files": `[ Loading @@ -94,17 +94,17 @@ android_app { } } func TestAndroidAppArchVariantSrcs(t *testing.T) { func TestAndroidAppArchVariantSrcs(t *testing.T) { runAndroidAppTestCase(t, bp2buildTestCase{ runAndroidAppTestCase(t, Bp2buildTestCase{ description: "Android app - arch variant srcs", Description: "Android app - arch variant srcs", moduleTypeUnderTest: "android_app", ModuleTypeUnderTest: "android_app", moduleTypeUnderTestFactory: java.AndroidAppFactory, ModuleTypeUnderTestFactory: java.AndroidAppFactory, filesystem: map[string]string{ Filesystem: map[string]string{ "arm.java": "", "arm.java": "", "x86.java": "", "x86.java": "", "res/res.png": "", "res/res.png": "", "AndroidManifest.xml": "", "AndroidManifest.xml": "", }, }, blueprint: ` Blueprint: ` android_app { android_app { name: "TestApp", name: "TestApp", sdk_version: "current", sdk_version: "current", Loading @@ -118,8 +118,8 @@ android_app { } } } } `, `, expectedBazelTargets: []string{ ExpectedBazelTargets: []string{ makeBazelTarget("android_binary", "TestApp", attrNameToString{ makeBazelTarget("android_binary", "TestApp", AttrNameToString{ "srcs": `select({ "srcs": `select({ "//build/bazel/platforms/arch:arm": ["arm.java"], "//build/bazel/platforms/arch:arm": ["arm.java"], "//build/bazel/platforms/arch:x86": ["x86.java"], "//build/bazel/platforms/arch:x86": ["x86.java"], Loading
bp2build/apex_conversion_test.go +170 −170 File changed.Preview size limit exceeded, changes collapsed. Show changes
bp2build/apex_key_conversion_test.go +9 −9 Original line number Original line Diff line number Diff line Loading @@ -21,28 +21,28 @@ import ( "testing" "testing" ) ) func runApexKeyTestCase(t *testing.T, tc bp2buildTestCase) { func runApexKeyTestCase(t *testing.T, tc Bp2buildTestCase) { t.Helper() t.Helper() runBp2BuildTestCase(t, registerApexKeyModuleTypes, tc) RunBp2BuildTestCase(t, registerApexKeyModuleTypes, tc) } } func registerApexKeyModuleTypes(ctx android.RegistrationContext) { func registerApexKeyModuleTypes(ctx android.RegistrationContext) { } } func TestApexKeySimple(t *testing.T) { func TestApexKeySimple(t *testing.T) { runApexKeyTestCase(t, bp2buildTestCase{ runApexKeyTestCase(t, Bp2buildTestCase{ description: "apex key - simple example", Description: "apex key - simple example", moduleTypeUnderTest: "apex_key", ModuleTypeUnderTest: "apex_key", moduleTypeUnderTestFactory: apex.ApexKeyFactory, ModuleTypeUnderTestFactory: apex.ApexKeyFactory, filesystem: map[string]string{}, Filesystem: map[string]string{}, blueprint: ` Blueprint: ` apex_key { apex_key { name: "com.android.apogee.key", name: "com.android.apogee.key", public_key: "com.android.apogee.avbpubkey", public_key: "com.android.apogee.avbpubkey", private_key: "com.android.apogee.pem", private_key: "com.android.apogee.pem", } } `, `, expectedBazelTargets: []string{makeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", attrNameToString{ ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{ "private_key": `"com.android.apogee.pem"`, "private_key": `"com.android.apogee.pem"`, "public_key": `"com.android.apogee.avbpubkey"`, "public_key": `"com.android.apogee.avbpubkey"`, }), }), Loading