Bp2build support for sdk_version and java_version.
This CL adds java_version and sdk_version support to bp2build converters for - java library - java binary - android library - android binary - android library import Although java import doesn't support java_version and sdk_version, the neverlink java_library wrapper around a java_import must specify a sdk_version when targetting a device. "none" is used by convention. Change-Id: I22a69dea2e351858368df69ed6a703b568d613ea Bug: 215230098 Test: Presubmits
This commit is contained in:
parent
15807fa7ed
commit
2eef2e13e9
16 changed files with 126 additions and 74 deletions
|
@ -406,8 +406,6 @@ var (
|
|||
// this BUILD file is globbed by //external/icu/icu4c/source:icu4c_test_data's "data/**/*".
|
||||
"external/icu/icu4c/source/data/unidata/norm2":/* recursive = */ false,
|
||||
|
||||
"frameworks/ex/common":/* recursive = */ true,
|
||||
|
||||
// Building manually due to b/179889880: resource files cross package boundary
|
||||
"packages/apps/Music":/* recursive = */ true,
|
||||
|
||||
|
@ -687,7 +685,6 @@ var (
|
|||
"libcodec2_soft_common",
|
||||
|
||||
// kotlin srcs in java libs
|
||||
"CtsPkgInstallerConstants",
|
||||
"kotlinx_atomicfu",
|
||||
|
||||
// kotlin srcs in java binary
|
||||
|
@ -700,6 +697,9 @@ var (
|
|||
//kotlin srcs in android_binary
|
||||
"MusicKotlin",
|
||||
|
||||
// java_library with prebuilt sdk_version
|
||||
"android-common",
|
||||
|
||||
// checked in current.txt for merged_txts
|
||||
"non-updatable-current.txt",
|
||||
"non-updatable-system-current.txt",
|
||||
|
@ -722,7 +722,6 @@ var (
|
|||
|
||||
// min_sdk_version in android_app
|
||||
"CtsShimUpgrade",
|
||||
"fake-framework",
|
||||
}
|
||||
|
||||
Bp2buildModuleTypeAlwaysConvertList = []string{
|
||||
|
@ -776,7 +775,8 @@ var (
|
|||
"tjbench", // TODO(b/240563612): Stem property
|
||||
|
||||
// java bugs
|
||||
"libbase_ndk", // TODO(b/186826477): fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
|
||||
"libbase_ndk", // TODO(b/186826477): fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
|
||||
"bouncycastle", // TODO(b/274474005): Need support for custom system_modules.
|
||||
|
||||
// python protos
|
||||
"libprotobuf-python", // Has a handcrafted alternative
|
||||
|
@ -843,7 +843,6 @@ var (
|
|||
"libgmock_ndk", // depends on unconverted modules: libgtest_ndk_c++
|
||||
"libnativehelper_lazy_mts_jni", "libnativehelper_mts_jni", // depends on unconverted modules: libnativetesthelper_jni, libgmock_ndk
|
||||
"libnativetesthelper_jni", // depends on unconverted modules: libgtest_ndk_c++
|
||||
"libprotobuf-java-nano", // b/220869005, depends on non-public_current SDK
|
||||
"libstatslog", // depends on unconverted modules: libstatspull, statsd-aidl-ndk
|
||||
"libstatslog_art", // depends on unconverted modules: statslog_art.cpp, statslog_art.h
|
||||
"linker_reloc_bench_main", // depends on unconverted modules: liblinker_reloc_bench_*
|
||||
|
@ -1393,6 +1392,16 @@ var (
|
|||
|
||||
// TODO(b/266459895): depends on libunwindstack
|
||||
"libutils_test",
|
||||
|
||||
// TODO(b/274805756): Support core_platform and current java APIs
|
||||
"fake-framework",
|
||||
|
||||
// TODO(b/277616982): These modules depend on private java APIs, but maybe they don't need to.
|
||||
"StreamingProtoTest",
|
||||
"textclassifierprotoslite",
|
||||
"styleprotoslite",
|
||||
"CtsPkgInstallerConstants",
|
||||
"guava-android-testlib",
|
||||
}
|
||||
|
||||
MixedBuildsDisabledList = []string{
|
||||
|
|
|
@ -66,9 +66,12 @@ android_library {
|
|||
"resource_files": `["res/res.png"]`,
|
||||
"deps": `[":static_lib_dep"]`,
|
||||
"exports": `[":static_lib_dep"]`,
|
||||
"javacopts": `["-source 1.7 -target 1.7"]`,
|
||||
"java_version": `"7"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("android_library", "TestLib"),
|
||||
MakeNeverlinkDuplicateTargetWithAttrs(
|
||||
"android_library",
|
||||
"TestLib",
|
||||
AttrNameToString{"java_version": `"7"`}),
|
||||
}})
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ android_app {
|
|||
"srcs": `["app.java"]`,
|
||||
"manifest": `"AndroidManifest.xml"`,
|
||||
"resource_files": `["res/res.png"]`,
|
||||
"sdk_version": `"current"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -91,7 +92,8 @@ android_app {
|
|||
]`,
|
||||
"custom_package": `"com.google"`,
|
||||
"deps": `[":static_lib_dep"]`,
|
||||
"javacopts": `["-source 1.7 -target 1.7"]`,
|
||||
"java_version": `"7"`,
|
||||
"sdk_version": `"current"`,
|
||||
"certificate_name": `"foocert"`,
|
||||
}),
|
||||
}})
|
||||
|
@ -131,6 +133,7 @@ android_app {
|
|||
})`,
|
||||
"manifest": `"AndroidManifest.xml"`,
|
||||
"resource_files": `["res/res.png"]`,
|
||||
"sdk_version": `"current"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -365,6 +368,7 @@ android_app {
|
|||
"manifest_values": `{
|
||||
"minSdkVersion": "24",
|
||||
}`,
|
||||
"sdk_version": `"current"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -388,6 +392,7 @@ android_app {
|
|||
"manifest_values": `{
|
||||
"minSdkVersion": "30",
|
||||
}`,
|
||||
"sdk_version": `"30"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
|
|
@ -57,24 +57,24 @@ func TestJavaBinaryHost(t *testing.T) {
|
|||
}`,
|
||||
ExpectedBazelTargets: []string{
|
||||
MakeBazelTarget("java_library", "java-binary-host-1_lib", AttrNameToString{
|
||||
"srcs": `["a.java"]`,
|
||||
"deps": `["//other:jni-lib-1"]`,
|
||||
"javacopts": `[
|
||||
"-Xdoclint:all/protected",
|
||||
"-source 1.8 -target 1.8",
|
||||
]`,
|
||||
"srcs": `["a.java"]`,
|
||||
"deps": `["//other:jni-lib-1"]`,
|
||||
"java_version": `"8"`,
|
||||
"javacopts": `["-Xdoclint:all/protected"]`,
|
||||
"target_compatible_with": `select({
|
||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})`}),
|
||||
})`,
|
||||
}),
|
||||
MakeBazelTarget("java_binary", "java-binary-host-1", AttrNameToString{
|
||||
"main_class": `"com.android.test.MainClass"`,
|
||||
"jvm_flags": `["-Djava.library.path=$${RUNPATH}other"]`,
|
||||
"runtime_deps": `[":java-binary-host-1_lib"]`,
|
||||
"main_class": `"com.android.test.MainClass"`,
|
||||
"jvm_flags": `["-Djava.library.path=$${RUNPATH}other"]`,
|
||||
"target_compatible_with": `select({
|
||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})`}),
|
||||
})`,
|
||||
"runtime_deps": `[":java-binary-host-1_lib"]`,
|
||||
}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -51,9 +51,11 @@ java_library {
|
|||
}`,
|
||||
ExpectedBazelTargets: []string{
|
||||
MakeBazelTarget("java_host_for_device", "java-lib-1", AttrNameToString{
|
||||
"deps": `[":java-lib-2"]`,
|
||||
"exports": `[":java-lib-2"]`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTargetWithAttrs("java_library", "java-lib-1", AttrNameToString{
|
||||
"sdk_version": `"none"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
|
||||
MakeBazelTarget("java_library", "java-lib-2", AttrNameToString{
|
||||
"srcs": `["b.java"]`,
|
||||
}),
|
||||
|
|
|
@ -49,8 +49,9 @@ java_import {
|
|||
"jars": `["import.jar"]`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"sdk_version": `"none"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -86,8 +87,9 @@ java_import {
|
|||
})`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"sdk_version": `"none"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
@ -112,8 +114,9 @@ java_import_host {
|
|||
"jars": `["import.jar"]`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "example_import-neverlink", AttrNameToString{
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"exports": `[":example_import"]`,
|
||||
"neverlink": `True`,
|
||||
"sdk_version": `"none"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
|
|
@ -172,10 +172,13 @@ func TestJavaLibraryJavaVersion(t *testing.T) {
|
|||
}`,
|
||||
ExpectedBazelTargets: []string{
|
||||
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
|
||||
"srcs": `["a.java"]`,
|
||||
"javacopts": `["-source 11 -target 11"]`,
|
||||
"srcs": `["a.java"]`,
|
||||
"java_version": `"11"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
|
||||
MakeNeverlinkDuplicateTargetWithAttrs(
|
||||
"java_library",
|
||||
"java-lib-1",
|
||||
AttrNameToString{"java_version": `"11"`}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ java_library_host {
|
|||
})`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "java-lib-host-2", AttrNameToString{
|
||||
"javacopts": `["-source 1.9 -target 1.9"]`,
|
||||
"srcs": `["c.java"]`,
|
||||
"java_version": `"9"`,
|
||||
"srcs": `["c.java"]`,
|
||||
"target_compatible_with": `select({
|
||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
|
@ -77,6 +77,7 @@ java_library_host {
|
|||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
"java_version": `"9"`,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -67,7 +67,7 @@ java_library {
|
|||
"a.java",
|
||||
"b.java",
|
||||
]`,
|
||||
"javacopts": `["-source 1.7 -target 1.7"]`,
|
||||
"java_version": `"7"`,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -114,13 +114,17 @@ func TestJavaProtoDefault(t *testing.T) {
|
|||
"java_lite_proto_library",
|
||||
"java-protos_java_proto_lite",
|
||||
AttrNameToString{
|
||||
"deps": `[":java-protos_proto"]`,
|
||||
"deps": `[":java-protos_proto"]`,
|
||||
"java_version": `"7"`,
|
||||
}),
|
||||
MakeBazelTarget("java_library", "java-protos", AttrNameToString{
|
||||
"exports": `[":java-protos_java_proto_lite"]`,
|
||||
"javacopts": `["-source 1.7 -target 1.7"]`,
|
||||
"exports": `[":java-protos_java_proto_lite"]`,
|
||||
"java_version": `"7"`,
|
||||
}),
|
||||
MakeNeverlinkDuplicateTarget("java_library", "java-protos"),
|
||||
MakeNeverlinkDuplicateTargetWithAttrs(
|
||||
"java_library",
|
||||
"java-protos",
|
||||
AttrNameToString{"java_version": `"7"`}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -642,10 +642,14 @@ func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string {
|
|||
}
|
||||
|
||||
func MakeNeverlinkDuplicateTarget(moduleType string, name string) string {
|
||||
return MakeBazelTarget(moduleType, name+"-neverlink", AttrNameToString{
|
||||
"neverlink": `True`,
|
||||
"exports": `[":` + name + `"]`,
|
||||
})
|
||||
return MakeNeverlinkDuplicateTargetWithAttrs(moduleType, name, AttrNameToString{})
|
||||
}
|
||||
|
||||
func MakeNeverlinkDuplicateTargetWithAttrs(moduleType string, name string, extraAttrs AttrNameToString) string {
|
||||
attrs := extraAttrs
|
||||
attrs["neverlink"] = `True`
|
||||
attrs["exports"] = `[":` + name + `"]`
|
||||
return MakeBazelTarget(moduleType, name+"-neverlink", attrs)
|
||||
}
|
||||
|
||||
func getTargetName(targetContent string) string {
|
||||
|
|
21
java/aar.go
21
java/aar.go
|
@ -1015,9 +1015,10 @@ type bazelAndroidLibrary struct {
|
|||
}
|
||||
|
||||
type bazelAndroidLibraryImport struct {
|
||||
Aar bazel.Label
|
||||
Deps bazel.LabelListAttribute
|
||||
Exports bazel.LabelListAttribute
|
||||
Aar bazel.Label
|
||||
Deps bazel.LabelListAttribute
|
||||
Exports bazel.LabelListAttribute
|
||||
Sdk_version bazel.StringAttribute
|
||||
}
|
||||
|
||||
func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.TopDownMutatorContext) *bazelAapt {
|
||||
|
@ -1059,9 +1060,10 @@ func (a *AARImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
},
|
||||
android.CommonAttributes{Name: name},
|
||||
&bazelAndroidLibraryImport{
|
||||
Aar: aars.Includes[0],
|
||||
Deps: bazel.MakeLabelListAttribute(deps),
|
||||
Exports: bazel.MakeLabelListAttribute(exports),
|
||||
Aar: aars.Includes[0],
|
||||
Deps: bazel.MakeLabelListAttribute(deps),
|
||||
Exports: bazel.MakeLabelListAttribute(exports),
|
||||
Sdk_version: bazel.StringAttribute{Value: a.properties.Sdk_version},
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -1073,6 +1075,9 @@ func (a *AARImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
javaLibraryAttributes: &javaLibraryAttributes{
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlink},
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
|
||||
javaCommonAttributes: &javaCommonAttributes{
|
||||
Sdk_version: bazel.StringAttribute{Value: a.properties.Sdk_version},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
@ -1119,6 +1124,10 @@ func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext)
|
|||
javaLibraryAttributes: &javaLibraryAttributes{
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlink},
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
|
||||
javaCommonAttributes: &javaCommonAttributes{
|
||||
Sdk_version: bazel.StringAttribute{Value: a.deviceProperties.Sdk_version},
|
||||
Java_version: bazel.StringAttribute{Value: a.properties.Java_version},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
@ -1565,6 +1565,9 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
|
||||
appAttrs.bazelAapt = &bazelAapt{Manifest: aapt.Manifest}
|
||||
appAttrs.Deps = bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + ktName})
|
||||
appAttrs.javaCommonAttributes = &javaCommonAttributes{
|
||||
Sdk_version: commonAttrs.Sdk_version,
|
||||
}
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(
|
||||
|
|
|
@ -21,6 +21,8 @@ import (
|
|||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"android/soong/dexpreopt"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
type DeviceHostConverter struct {
|
||||
|
@ -191,7 +193,7 @@ func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
|
|||
}
|
||||
|
||||
type bazelDeviceHostConverterAttributes struct {
|
||||
Deps bazel.LabelListAttribute
|
||||
Exports bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
|
@ -202,13 +204,15 @@ func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.TopDownMutatorCont
|
|||
},
|
||||
android.CommonAttributes{Name: d.Name()},
|
||||
&bazelDeviceHostConverterAttributes{
|
||||
Deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, d.properties.Libs)),
|
||||
Exports: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, d.properties.Libs)),
|
||||
},
|
||||
)
|
||||
neverlinkProp := true
|
||||
neverLinkAttrs := &javaLibraryAttributes{
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + d.Name()}),
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
|
||||
Neverlink: bazel.BoolAttribute{Value: proptools.BoolPtr(true)},
|
||||
javaCommonAttributes: &javaCommonAttributes{
|
||||
Sdk_version: bazel.StringAttribute{Value: proptools.StringPtr("none")},
|
||||
},
|
||||
}
|
||||
ctx.CreateBazelTargetModule(
|
||||
javaLibraryBazelTargetModuleProperties(),
|
||||
|
|
33
java/java.go
33
java/java.go
|
@ -2738,9 +2738,11 @@ func (m *Library) convertJavaResourcesAttributes(ctx android.TopDownMutatorConte
|
|||
type javaCommonAttributes struct {
|
||||
*javaResourcesAttributes
|
||||
*kotlinAttributes
|
||||
Srcs bazel.LabelListAttribute
|
||||
Plugins bazel.LabelListAttribute
|
||||
Javacopts bazel.StringListAttribute
|
||||
Srcs bazel.LabelListAttribute
|
||||
Plugins bazel.LabelListAttribute
|
||||
Javacopts bazel.StringListAttribute
|
||||
Sdk_version bazel.StringAttribute
|
||||
Java_version bazel.StringAttribute
|
||||
}
|
||||
|
||||
type javaDependencyLabels struct {
|
||||
|
@ -2871,10 +2873,6 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext)
|
|||
if m.properties.Javacflags != nil {
|
||||
javacopts = append(javacopts, m.properties.Javacflags...)
|
||||
}
|
||||
if m.properties.Java_version != nil {
|
||||
javaVersion := normalizeJavaVersion(ctx, *m.properties.Java_version).String()
|
||||
javacopts = append(javacopts, fmt.Sprintf("-source %s -target %s", javaVersion, javaVersion))
|
||||
}
|
||||
|
||||
epEnabled := m.properties.Errorprone.Enabled
|
||||
//TODO(b/227504307) add configuration that depends on RUN_ERROR_PRONE environment variable
|
||||
|
@ -2888,7 +2886,9 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext)
|
|||
Plugins: bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleDeps(ctx, m.properties.Plugins),
|
||||
),
|
||||
Javacopts: bazel.MakeStringListAttribute(javacopts),
|
||||
Javacopts: bazel.MakeStringListAttribute(javacopts),
|
||||
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
||||
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
|
||||
}
|
||||
|
||||
for axis, configToProps := range archVariantProps {
|
||||
|
@ -2979,19 +2979,9 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
|
|||
deps := depLabels.Deps
|
||||
if !commonAttrs.Srcs.IsEmpty() {
|
||||
deps.Append(depLabels.StaticDeps) // we should only append these if there are sources to use them
|
||||
|
||||
sdkVersion := m.SdkVersion(ctx)
|
||||
if sdkVersion.Kind == android.SdkPublic && sdkVersion.ApiLevel == android.FutureApiLevel {
|
||||
// TODO(b/220869005) remove forced dependency on current public android.jar
|
||||
deps.Add(bazel.MakeLabelAttribute("//prebuilts/sdk:public_current_android_sdk_java_import"))
|
||||
} else if sdkVersion.Kind == android.SdkSystem && sdkVersion.ApiLevel == android.FutureApiLevel {
|
||||
// TODO(b/215230098) remove forced dependency on current public android.jar
|
||||
deps.Add(bazel.MakeLabelAttribute("//prebuilts/sdk:system_current_android_sdk_java_import"))
|
||||
}
|
||||
} else if !deps.IsEmpty() {
|
||||
ctx.ModuleErrorf("Module has direct dependencies but no sources. Bazel will not allow this.")
|
||||
}
|
||||
|
||||
var props bazel.BazelTargetModuleProperties
|
||||
attrs := &javaLibraryAttributes{
|
||||
javaCommonAttributes: commonAttrs,
|
||||
|
@ -3011,6 +3001,10 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
|
|||
neverLinkAttrs := &javaLibraryAttributes{
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
|
||||
javaCommonAttributes: &javaCommonAttributes{
|
||||
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
|
||||
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
||||
},
|
||||
}
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name + "-neverlink"}, neverLinkAttrs)
|
||||
|
||||
|
@ -3150,6 +3144,9 @@ func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
neverlinkAttrs := &javaLibraryAttributes{
|
||||
Neverlink: bazel.BoolAttribute{Value: &neverlink},
|
||||
Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
|
||||
javaCommonAttributes: &javaCommonAttributes{
|
||||
Sdk_version: bazel.StringAttribute{Value: proptools.StringPtr("none")},
|
||||
},
|
||||
}
|
||||
ctx.CreateBazelTargetModule(
|
||||
javaLibraryBazelTargetModuleProperties(),
|
||||
|
|
|
@ -143,7 +143,9 @@ func protoFlags(ctx android.ModuleContext, j *CommonProperties, p *android.Proto
|
|||
}
|
||||
|
||||
type protoAttributes struct {
|
||||
Deps bazel.LabelListAttribute
|
||||
Deps bazel.LabelListAttribute
|
||||
Sdk_version bazel.StringAttribute
|
||||
Java_version bazel.StringAttribute
|
||||
}
|
||||
|
||||
func bp2buildProto(ctx android.Bp2buildMutatorContext, m *Module, protoSrcs bazel.LabelListAttribute) *bazel.Label {
|
||||
|
@ -175,8 +177,11 @@ func bp2buildProto(ctx android.Bp2buildMutatorContext, m *Module, protoSrcs baze
|
|||
}
|
||||
|
||||
protoLabel := bazel.Label{Label: ":" + m.Name() + "_proto"}
|
||||
var protoAttrs protoAttributes
|
||||
protoAttrs.Deps.SetValue(bazel.LabelList{Includes: []bazel.Label{protoLabel}})
|
||||
protoAttrs := &protoAttributes{
|
||||
Deps: bazel.MakeSingleLabelListAttribute(protoLabel),
|
||||
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
|
||||
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
|
||||
}
|
||||
|
||||
name := m.Name() + suffix
|
||||
|
||||
|
@ -186,7 +191,7 @@ func bp2buildProto(ctx android.Bp2buildMutatorContext, m *Module, protoSrcs baze
|
|||
Bzl_load_location: "//build/bazel/rules/java:proto.bzl",
|
||||
},
|
||||
android.CommonAttributes{Name: name},
|
||||
&protoAttrs)
|
||||
protoAttrs)
|
||||
|
||||
return &bazel.Label{Label: ":" + name}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue