Merge "Handle java_resources as deps" into main
This commit is contained in:
commit
b5c3b018d9
2 changed files with 12 additions and 5 deletions
|
@ -463,6 +463,7 @@ func TestJavaLibraryResourcesWithMultipleDirs(t *testing.T) {
|
|||
},
|
||||
Blueprint: `java_library {
|
||||
name: "java-lib-1",
|
||||
srcs: ["foo.java"],
|
||||
java_resource_dirs: ["res", "res1"],
|
||||
sdk_version: "current",
|
||||
}`,
|
||||
|
@ -472,9 +473,10 @@ func TestJavaLibraryResourcesWithMultipleDirs(t *testing.T) {
|
|||
"resources": `["res1/b.res"]`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
|
||||
"additional_resources": `["java-lib-1_resource_dir_res1"]`,
|
||||
"deps": `["java-lib-1_resource_dir_res1"]`,
|
||||
"resources": `["res/a.res"]`,
|
||||
"resource_strip_prefix": `"res"`,
|
||||
"srcs": `["foo.java"]`,
|
||||
"sdk_version": `"current"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
|
||||
|
@ -492,6 +494,7 @@ func TestJavaLibraryJavaResourcesAndResourceDirs(t *testing.T) {
|
|||
java_resources: ["res1", "res2"],
|
||||
java_resource_dirs: ["resdir"],
|
||||
sdk_version: "current",
|
||||
srcs: ["foo.java"],
|
||||
}`,
|
||||
ExpectedBazelTargets: []string{
|
||||
MakeBazelTarget("java_resources", "java-lib-1_resource_dir_resdir", AttrNameToString{
|
||||
|
@ -499,12 +502,13 @@ func TestJavaLibraryJavaResourcesAndResourceDirs(t *testing.T) {
|
|||
"resources": `["resdir/a.res"]`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
|
||||
"additional_resources": `["java-lib-1_resource_dir_resdir"]`,
|
||||
"deps": `["java-lib-1_resource_dir_resdir"]`,
|
||||
"resource_strip_prefix": `"."`,
|
||||
"resources": `[
|
||||
"res1",
|
||||
"res2",
|
||||
]`,
|
||||
"srcs": `["foo.java"]`,
|
||||
"sdk_version": `"current"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
|
||||
|
@ -1064,7 +1068,7 @@ filegroup {
|
|||
"srcs": `["a.java"]`,
|
||||
"resources": `["a.res"]`,
|
||||
"resource_strip_prefix": `"."`,
|
||||
"additional_resources": `[
|
||||
"deps": `[
|
||||
"java-lib-1_filegroup_resources_filegroup1",
|
||||
"java-lib-1_filegroup_resources_filegroup2",
|
||||
]`,
|
||||
|
|
|
@ -2775,7 +2775,7 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
|
|||
type javaResourcesAttributes struct {
|
||||
Resources bazel.LabelListAttribute
|
||||
Resource_strip_prefix *string
|
||||
Additional_resources bazel.LabelListAttribute
|
||||
Additional_resources bazel.LabelListAttribute `blueprint:"mutated"`
|
||||
}
|
||||
|
||||
func (m *Library) getResourceFilegroupStripPrefix(ctx android.Bp2buildMutatorContext, resourceFilegroup string) (*string, bool) {
|
||||
|
@ -3052,9 +3052,11 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext
|
|||
javacopts.Append(bazel.MakeStringListAttribute([]string{"-XepDisableAllChecks"}))
|
||||
}
|
||||
|
||||
resourcesAttrs := m.convertJavaResourcesAttributes(ctx)
|
||||
|
||||
commonAttrs := &javaCommonAttributes{
|
||||
Srcs: javaSrcs,
|
||||
javaResourcesAttributes: m.convertJavaResourcesAttributes(ctx),
|
||||
javaResourcesAttributes: resourcesAttrs,
|
||||
Plugins: plugins,
|
||||
Javacopts: javacopts,
|
||||
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
||||
|
@ -3077,6 +3079,7 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext
|
|||
}
|
||||
|
||||
depLabels := &javaDependencyLabels{}
|
||||
deps.Append(resourcesAttrs.Additional_resources)
|
||||
depLabels.Deps = deps
|
||||
|
||||
for axis, configToProps := range archVariantProps {
|
||||
|
|
Loading…
Reference in a new issue