Loading bp2build/cc_library_conversion_test.go +0 −20 Original line number Diff line number Diff line Loading @@ -1367,26 +1367,6 @@ func makeCcLibraryTargets(name string, attrs AttrNameToString) []string { return []string{staticTarget, sharedTarget} } func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string { if _, hasStubs := attrs["stubs_symbol_file"]; !hasStubs { return "" } STUB_SUITE_ATTRS := map[string]string{ "stubs_symbol_file": "symbol_file", "stubs_versions": "versions", "soname": "soname", "source_library": "source_library", } stubSuiteAttrs := AttrNameToString{} for key, _ := range attrs { if _, stubSuiteAttr := STUB_SUITE_ATTRS[key]; stubSuiteAttr { stubSuiteAttrs[STUB_SUITE_ATTRS[key]] = attrs[key] } } return MakeBazelTarget("cc_stub_suite", name+"_stub_libs", stubSuiteAttrs) } func TestCCLibraryNoLibCrtFalse(t *testing.T) { runCcLibraryTestCase(t, Bp2buildTestCase{ ModuleTypeUnderTest: "cc_library", Loading bp2build/cc_library_shared_conversion_test.go +10 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,16 @@ cc_library_shared { ExpectedBazelTargets: []string{MakeBazelTarget("cc_library_shared", "a", AttrNameToString{ "has_stubs": `True`, }), makeCcStubSuiteTargets("a", AttrNameToString{ "soname": `"a.so"`, "source_library": `":a"`, "stubs_symbol_file": `"a.map.txt"`, "stubs_versions": `[ "28", "29", "current", ]`, }), }, }, ) Loading bp2build/testing.go +20 −0 Original line number Diff line number Diff line Loading @@ -463,3 +463,23 @@ type ExpectedRuleTarget struct { func (ebr ExpectedRuleTarget) String() string { return makeBazelTargetHostOrDevice(ebr.Rule, ebr.Name, ebr.Attrs, ebr.Hod) } func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string { if _, hasStubs := attrs["stubs_symbol_file"]; !hasStubs { return "" } STUB_SUITE_ATTRS := map[string]string{ "stubs_symbol_file": "symbol_file", "stubs_versions": "versions", "soname": "soname", "source_library": "source_library", } stubSuiteAttrs := AttrNameToString{} for key, _ := range attrs { if _, stubSuiteAttr := STUB_SUITE_ATTRS[key]; stubSuiteAttr { stubSuiteAttrs[STUB_SUITE_ATTRS[key]] = attrs[key] } } return MakeBazelTarget("cc_stub_suite", name+"_stub_libs", stubSuiteAttrs) } cc/library.go +6 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,10 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { android.CommonAttributes{Name: m.Name()}, sharedTargetAttrs, sharedAttrs.Enabled) createStubsBazelTargetIfNeeded(ctx, m, compilerAttrs, exportedIncludes, baseAttributes) } func createStubsBazelTargetIfNeeded(ctx android.TopDownMutatorContext, m *Module, compilerAttrs compilerAttributes, exportedIncludes BazelIncludes, baseAttributes baseAttributes) { if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 { stubSuitesProps := bazel.BazelTargetModuleProperties{ Rule_class: "cc_stub_suite", Loading Loading @@ -2707,6 +2711,8 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo } ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs) createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes) } // TODO(b/199902614): Can this be factored to share with the other Attributes? Loading Loading
bp2build/cc_library_conversion_test.go +0 −20 Original line number Diff line number Diff line Loading @@ -1367,26 +1367,6 @@ func makeCcLibraryTargets(name string, attrs AttrNameToString) []string { return []string{staticTarget, sharedTarget} } func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string { if _, hasStubs := attrs["stubs_symbol_file"]; !hasStubs { return "" } STUB_SUITE_ATTRS := map[string]string{ "stubs_symbol_file": "symbol_file", "stubs_versions": "versions", "soname": "soname", "source_library": "source_library", } stubSuiteAttrs := AttrNameToString{} for key, _ := range attrs { if _, stubSuiteAttr := STUB_SUITE_ATTRS[key]; stubSuiteAttr { stubSuiteAttrs[STUB_SUITE_ATTRS[key]] = attrs[key] } } return MakeBazelTarget("cc_stub_suite", name+"_stub_libs", stubSuiteAttrs) } func TestCCLibraryNoLibCrtFalse(t *testing.T) { runCcLibraryTestCase(t, Bp2buildTestCase{ ModuleTypeUnderTest: "cc_library", Loading
bp2build/cc_library_shared_conversion_test.go +10 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,16 @@ cc_library_shared { ExpectedBazelTargets: []string{MakeBazelTarget("cc_library_shared", "a", AttrNameToString{ "has_stubs": `True`, }), makeCcStubSuiteTargets("a", AttrNameToString{ "soname": `"a.so"`, "source_library": `":a"`, "stubs_symbol_file": `"a.map.txt"`, "stubs_versions": `[ "28", "29", "current", ]`, }), }, }, ) Loading
bp2build/testing.go +20 −0 Original line number Diff line number Diff line Loading @@ -463,3 +463,23 @@ type ExpectedRuleTarget struct { func (ebr ExpectedRuleTarget) String() string { return makeBazelTargetHostOrDevice(ebr.Rule, ebr.Name, ebr.Attrs, ebr.Hod) } func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string { if _, hasStubs := attrs["stubs_symbol_file"]; !hasStubs { return "" } STUB_SUITE_ATTRS := map[string]string{ "stubs_symbol_file": "symbol_file", "stubs_versions": "versions", "soname": "soname", "source_library": "source_library", } stubSuiteAttrs := AttrNameToString{} for key, _ := range attrs { if _, stubSuiteAttr := STUB_SUITE_ATTRS[key]; stubSuiteAttr { stubSuiteAttrs[STUB_SUITE_ATTRS[key]] = attrs[key] } } return MakeBazelTarget("cc_stub_suite", name+"_stub_libs", stubSuiteAttrs) }
cc/library.go +6 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,10 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { android.CommonAttributes{Name: m.Name()}, sharedTargetAttrs, sharedAttrs.Enabled) createStubsBazelTargetIfNeeded(ctx, m, compilerAttrs, exportedIncludes, baseAttributes) } func createStubsBazelTargetIfNeeded(ctx android.TopDownMutatorContext, m *Module, compilerAttrs compilerAttributes, exportedIncludes BazelIncludes, baseAttributes baseAttributes) { if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 { stubSuitesProps := bazel.BazelTargetModuleProperties{ Rule_class: "cc_stub_suite", Loading Loading @@ -2707,6 +2711,8 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo } ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs) createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes) } // TODO(b/199902614): Can this be factored to share with the other Attributes? Loading