Merge "bp2build support .kt in android_library"
This commit is contained in:
@@ -673,6 +673,9 @@ var (
|
|||||||
// kotlin srcs in java binary
|
// kotlin srcs in java binary
|
||||||
"AnalyzerKt",
|
"AnalyzerKt",
|
||||||
"trebuchet-core",
|
"trebuchet-core",
|
||||||
|
|
||||||
|
// kotlin srcs in android_library
|
||||||
|
"renderscript_toolkit",
|
||||||
}
|
}
|
||||||
|
|
||||||
Bp2buildModuleTypeAlwaysConvertList = []string{
|
Bp2buildModuleTypeAlwaysConvertList = []string{
|
||||||
|
@@ -138,3 +138,36 @@ android_library_import {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConvertAndroidLibraryKotlin(t *testing.T) {
|
||||||
|
t.Helper()
|
||||||
|
RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
|
||||||
|
Description: "Android Library with .kt srcs and common_srcs attribute",
|
||||||
|
ModuleTypeUnderTest: "android_library",
|
||||||
|
ModuleTypeUnderTestFactory: java.AndroidLibraryFactory,
|
||||||
|
Filesystem: map[string]string{
|
||||||
|
"AndroidManifest.xml": "",
|
||||||
|
},
|
||||||
|
Blueprint: `
|
||||||
|
android_library {
|
||||||
|
name: "TestLib",
|
||||||
|
srcs: ["a.java", "b.kt"],
|
||||||
|
common_srcs: ["c.kt"],
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
ExpectedBazelTargets: []string{
|
||||||
|
MakeBazelTarget(
|
||||||
|
"android_library",
|
||||||
|
"TestLib",
|
||||||
|
AttrNameToString{
|
||||||
|
"srcs": `[
|
||||||
|
"a.java",
|
||||||
|
"b.kt",
|
||||||
|
]`,
|
||||||
|
"common_srcs": `["c.kt"]`,
|
||||||
|
"manifest": `"AndroidManifest.xml"`,
|
||||||
|
"resource_files": `[]`,
|
||||||
|
}),
|
||||||
|
MakeNeverlinkDuplicateTarget("android_library", "TestLib"),
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
@@ -1069,6 +1069,10 @@ func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext)
|
|||||||
ctx.ModuleErrorf("Module has direct dependencies but no sources. Bazel will not allow this.")
|
ctx.ModuleErrorf("Module has direct dependencies but no sources. Bazel will not allow this.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(a.properties.Common_srcs) != 0 {
|
||||||
|
commonAttrs.Common_srcs = bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, a.properties.Common_srcs))
|
||||||
|
}
|
||||||
|
|
||||||
name := a.Name()
|
name := a.Name()
|
||||||
props := bazel.BazelTargetModuleProperties{
|
props := bazel.BazelTargetModuleProperties{
|
||||||
Rule_class: "android_library",
|
Rule_class: "android_library",
|
||||||
|
Reference in New Issue
Block a user