Merge "Support bssl hash injection for libcrypto." am: febce2dfa7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1966148 Change-Id: Ia89d6d05ed9b2c3b436c7a86a7e02fc1f02e7298
This commit is contained in:
@@ -1287,6 +1287,7 @@ func makeCcLibraryTargets(name string, attrs attrNameToString) []string {
|
|||||||
"strip": true,
|
"strip": true,
|
||||||
"stubs_symbol_file": true,
|
"stubs_symbol_file": true,
|
||||||
"stubs_versions": true,
|
"stubs_versions": true,
|
||||||
|
"inject_bssl_hash": true,
|
||||||
}
|
}
|
||||||
sharedAttrs := attrNameToString{}
|
sharedAttrs := attrNameToString{}
|
||||||
staticAttrs := attrNameToString{}
|
staticAttrs := attrNameToString{}
|
||||||
@@ -1822,6 +1823,33 @@ cc_library {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLibcryptoHashInjection(t *testing.T) {
|
||||||
|
runCcLibraryTestCase(t, bp2buildTestCase{
|
||||||
|
description: "cc_library - libcrypto hash injection",
|
||||||
|
moduleTypeUnderTest: "cc_library",
|
||||||
|
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
|
filesystem: map[string]string{},
|
||||||
|
blueprint: soongCcLibraryPreamble + `
|
||||||
|
cc_library {
|
||||||
|
name: "libcrypto",
|
||||||
|
target: {
|
||||||
|
android: {
|
||||||
|
inject_bssl_hash: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include_build_directory: false,
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
expectedBazelTargets: makeCcLibraryTargets("libcrypto", attrNameToString{
|
||||||
|
"inject_bssl_hash": `select({
|
||||||
|
"//build/bazel/platforms/os:android": True,
|
||||||
|
"//conditions:default": None,
|
||||||
|
})`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func TestCcLibraryCppStdWithGnuExtensions_ConvertsToFeatureAttr(t *testing.T) {
|
func TestCcLibraryCppStdWithGnuExtensions_ConvertsToFeatureAttr(t *testing.T) {
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
cpp_std string
|
cpp_std string
|
||||||
|
@@ -386,6 +386,21 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
|||||||
Stubs_versions: compilerAttrs.stubsVersions,
|
Stubs_versions: compilerAttrs.stubsVersions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for axis, configToProps := range m.GetArchVariantProperties(ctx, &LibraryProperties{}) {
|
||||||
|
for config, props := range configToProps {
|
||||||
|
if props, ok := props.(*LibraryProperties); ok {
|
||||||
|
if props.Inject_bssl_hash != nil {
|
||||||
|
// This is an edge case applies only to libcrypto
|
||||||
|
if m.Name() == "libcrypto" {
|
||||||
|
sharedTargetAttrs.Inject_bssl_hash.SetSelectValue(axis, config, props.Inject_bssl_hash)
|
||||||
|
} else {
|
||||||
|
ctx.PropertyErrorf("inject_bssl_hash", "only applies to libcrypto")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
staticProps := bazel.BazelTargetModuleProperties{
|
staticProps := bazel.BazelTargetModuleProperties{
|
||||||
Rule_class: "cc_library_static",
|
Rule_class: "cc_library_static",
|
||||||
Bzl_load_location: "//build/bazel/rules:cc_library_static.bzl",
|
Bzl_load_location: "//build/bazel/rules:cc_library_static.bzl",
|
||||||
@@ -2602,4 +2617,5 @@ type bazelCcLibrarySharedAttributes struct {
|
|||||||
|
|
||||||
Stubs_symbol_file *string
|
Stubs_symbol_file *string
|
||||||
Stubs_versions bazel.StringListAttribute
|
Stubs_versions bazel.StringListAttribute
|
||||||
|
Inject_bssl_hash bazel.BoolAttribute
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user