Merge "Bp2build support for runtime_libs"
This commit is contained in:
@@ -328,6 +328,8 @@ var (
|
|||||||
"libpdx_headers",
|
"libpdx_headers",
|
||||||
"libprocpartition",
|
"libprocpartition",
|
||||||
"libruy_static",
|
"libruy_static",
|
||||||
|
"libandroidio",
|
||||||
|
"libandroidio_srcs",
|
||||||
"libserviceutils",
|
"libserviceutils",
|
||||||
"libstagefright_enc_common",
|
"libstagefright_enc_common",
|
||||||
"libstagefright_foundation_headers",
|
"libstagefright_foundation_headers",
|
||||||
@@ -487,8 +489,6 @@ var (
|
|||||||
"libartd-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libartd-compiler, libdexfiled, libprofiled, libartbased, libartbased-art-gtest
|
"libartd-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libartd-compiler, libdexfiled, libprofiled, libartbased, libartbased-art-gtest
|
||||||
"libdebuggerd_handler", // depends on unconverted module libdebuggerd_handler_core
|
"libdebuggerd_handler", // depends on unconverted module libdebuggerd_handler_core
|
||||||
"libdebuggerd_handler_core", "libdebuggerd_handler_fallback", // depends on unconverted module libdebuggerd
|
"libdebuggerd_handler_core", "libdebuggerd_handler_fallback", // depends on unconverted module libdebuggerd
|
||||||
"libdexfile", // depends on unconverted modules: dexfile_operator_srcs, libartbase, libartpalette,
|
|
||||||
"libdexfile_static", // depends on unconverted modules: libartbase, libdexfile
|
|
||||||
"libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
|
"libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
|
||||||
"libfastdeploy_host", // depends on unconverted modules: libandroidfw, libusb, AdbWinApi
|
"libfastdeploy_host", // depends on unconverted modules: libandroidfw, libusb, AdbWinApi
|
||||||
"libgmock_main_ndk", // depends on unconverted modules: libgtest_ndk_c++
|
"libgmock_main_ndk", // depends on unconverted modules: libgtest_ndk_c++
|
||||||
|
@@ -543,3 +543,41 @@ func TestCcBinaryConvertLex(t *testing.T) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCcBinaryRuntimeLibs(t *testing.T) {
|
||||||
|
runCcBinaryTests(t, ccBinaryBp2buildTestCase{
|
||||||
|
description: "cc_binary with runtime libs",
|
||||||
|
blueprint: `
|
||||||
|
cc_library {
|
||||||
|
name: "bar",
|
||||||
|
srcs: ["b.cc"],
|
||||||
|
}
|
||||||
|
|
||||||
|
{rule_name} {
|
||||||
|
name: "foo",
|
||||||
|
srcs: ["a.cc"],
|
||||||
|
runtime_libs: ["bar"],
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
targets: []testBazelTarget{
|
||||||
|
{"cc_library_static", "bar_bp2build_cc_library_static", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
"srcs": `["b.cc"]`,
|
||||||
|
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"cc_library_shared", "bar", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
"srcs": `["b.cc"]`,
|
||||||
|
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"cc_binary", "foo", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
"srcs": `["a.cc"]`,
|
||||||
|
"runtime_deps": `[":bar"]`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -2514,3 +2514,29 @@ func TestCcLibraryConvertLex(t *testing.T) {
|
|||||||
})...),
|
})...),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCCLibraryRuntimeDeps(t *testing.T) {
|
||||||
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
||||||
|
Blueprint: `cc_library_shared {
|
||||||
|
name: "bar",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "foo",
|
||||||
|
runtime_libs: ["foo"],
|
||||||
|
}`,
|
||||||
|
ExpectedBazelTargets: []string{
|
||||||
|
makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
|
||||||
|
"runtime_deps": `[":foo"]`,
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
makeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
||||||
|
"runtime_deps": `[":foo"]`,
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -624,3 +624,25 @@ func TestCCLibraryFlagSpaceSplitting(t *testing.T) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCCLibrarySharedRuntimeDeps(t *testing.T) {
|
||||||
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
||||||
|
Blueprint: `cc_library_shared {
|
||||||
|
name: "bar",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_shared {
|
||||||
|
name: "foo",
|
||||||
|
runtime_libs: ["foo"],
|
||||||
|
}`,
|
||||||
|
ExpectedBazelTargets: []string{
|
||||||
|
makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
makeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
||||||
|
"runtime_deps": `[":foo"]`,
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -15,12 +15,12 @@
|
|||||||
package bp2build
|
package bp2build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
"android/soong/genrule"
|
"android/soong/genrule"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -1559,3 +1559,25 @@ func TestCcLibraryStaticStl(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCCLibraryStaticRuntimeDeps(t *testing.T) {
|
||||||
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
||||||
|
Blueprint: `cc_library_shared {
|
||||||
|
name: "bar",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_static {
|
||||||
|
name: "foo",
|
||||||
|
runtime_libs: ["foo"],
|
||||||
|
}`,
|
||||||
|
ExpectedBazelTargets: []string{
|
||||||
|
makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
makeBazelTarget("cc_library_static", "foo", AttrNameToString{
|
||||||
|
"runtime_deps": `[":foo"]`,
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -617,6 +617,7 @@ func binaryBp2build(ctx android.TopDownMutatorContext, m *Module, typ string) {
|
|||||||
Dynamic_deps: baseAttrs.implementationDynamicDeps,
|
Dynamic_deps: baseAttrs.implementationDynamicDeps,
|
||||||
Whole_archive_deps: baseAttrs.wholeArchiveDeps,
|
Whole_archive_deps: baseAttrs.wholeArchiveDeps,
|
||||||
System_deps: baseAttrs.systemDynamicDeps,
|
System_deps: baseAttrs.systemDynamicDeps,
|
||||||
|
Runtime_deps: baseAttrs.runtimeDeps,
|
||||||
|
|
||||||
Local_includes: baseAttrs.localIncludes,
|
Local_includes: baseAttrs.localIncludes,
|
||||||
Absolute_includes: baseAttrs.absoluteIncludes,
|
Absolute_includes: baseAttrs.absoluteIncludes,
|
||||||
@@ -667,6 +668,7 @@ type binaryAttributes struct {
|
|||||||
Dynamic_deps bazel.LabelListAttribute
|
Dynamic_deps bazel.LabelListAttribute
|
||||||
Whole_archive_deps bazel.LabelListAttribute
|
Whole_archive_deps bazel.LabelListAttribute
|
||||||
System_deps bazel.LabelListAttribute
|
System_deps bazel.LabelListAttribute
|
||||||
|
Runtime_deps bazel.LabelListAttribute
|
||||||
|
|
||||||
Local_includes bazel.StringListAttribute
|
Local_includes bazel.StringListAttribute
|
||||||
Absolute_includes bazel.StringListAttribute
|
Absolute_includes bazel.StringListAttribute
|
||||||
|
@@ -52,6 +52,7 @@ type staticOrSharedAttributes struct {
|
|||||||
Implementation_dynamic_deps bazel.LabelListAttribute
|
Implementation_dynamic_deps bazel.LabelListAttribute
|
||||||
Whole_archive_deps bazel.LabelListAttribute
|
Whole_archive_deps bazel.LabelListAttribute
|
||||||
Implementation_whole_archive_deps bazel.LabelListAttribute
|
Implementation_whole_archive_deps bazel.LabelListAttribute
|
||||||
|
Runtime_deps bazel.LabelListAttribute
|
||||||
|
|
||||||
System_dynamic_deps bazel.LabelListAttribute
|
System_dynamic_deps bazel.LabelListAttribute
|
||||||
|
|
||||||
@@ -710,6 +711,7 @@ type linkerAttributes struct {
|
|||||||
implementationDeps bazel.LabelListAttribute
|
implementationDeps bazel.LabelListAttribute
|
||||||
dynamicDeps bazel.LabelListAttribute
|
dynamicDeps bazel.LabelListAttribute
|
||||||
implementationDynamicDeps bazel.LabelListAttribute
|
implementationDynamicDeps bazel.LabelListAttribute
|
||||||
|
runtimeDeps bazel.LabelListAttribute
|
||||||
wholeArchiveDeps bazel.LabelListAttribute
|
wholeArchiveDeps bazel.LabelListAttribute
|
||||||
implementationWholeArchiveDeps bazel.LabelListAttribute
|
implementationWholeArchiveDeps bazel.LabelListAttribute
|
||||||
systemDynamicDeps bazel.LabelListAttribute
|
systemDynamicDeps bazel.LabelListAttribute
|
||||||
@@ -825,6 +827,11 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||||||
if axisFeatures != nil {
|
if axisFeatures != nil {
|
||||||
la.features.SetSelectValue(axis, config, axisFeatures)
|
la.features.SetSelectValue(axis, config, axisFeatures)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runtimeDeps := android.BazelLabelForModuleDepsExcludes(ctx, props.Runtime_libs, props.Exclude_runtime_libs)
|
||||||
|
if !runtimeDeps.IsEmpty() {
|
||||||
|
la.runtimeDeps.SetSelectValue(axis, config, runtimeDeps)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (la *linkerAttributes) convertStripProps(ctx android.BazelConversionPathContext, module *Module) {
|
func (la *linkerAttributes) convertStripProps(ctx android.BazelConversionPathContext, module *Module) {
|
||||||
|
@@ -319,6 +319,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
|||||||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||||
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(staticAttrs.Whole_archive_deps),
|
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(staticAttrs.Whole_archive_deps),
|
||||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps),
|
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps),
|
||||||
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,6 +336,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
|||||||
Implementation_dynamic_deps: *linkerAttrs.implementationDynamicDeps.Clone().Append(sharedAttrs.Implementation_dynamic_deps),
|
Implementation_dynamic_deps: *linkerAttrs.implementationDynamicDeps.Clone().Append(sharedAttrs.Implementation_dynamic_deps),
|
||||||
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(sharedAttrs.Whole_archive_deps),
|
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(sharedAttrs.Whole_archive_deps),
|
||||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
|
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
|
||||||
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2552,6 +2554,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo
|
|||||||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||||
System_dynamic_deps: linkerAttrs.systemDynamicDeps,
|
System_dynamic_deps: linkerAttrs.systemDynamicDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
||||||
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
}
|
}
|
||||||
|
|
||||||
var attrs interface{}
|
var attrs interface{}
|
||||||
|
Reference in New Issue
Block a user