Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 266bbf2f authored by Alix's avatar Alix
Browse files

Libs support for * -> java_library_edge with kt sources

Bug: 244210934
Test: bo2build tests and built kotlinx_atomicfu
Change-Id: Id6eac2f104878e4d7902a32e846ef1cc87dd7863
parent ccfe6022
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -685,6 +685,7 @@ func TestJavaLibraryKotlinSrcs(t *testing.T) {
        "c.kt",
    ]`,
			}),
			MakeNeverlinkDuplicateTarget("kt_jvm_library", "java-lib-1"),
		},
	})
}
@@ -707,6 +708,7 @@ func TestJavaLibraryKotlinCommonSrcs(t *testing.T) {
    ]`,
				"common_srcs": `["c.kt"]`,
			}),
			MakeNeverlinkDuplicateTarget("kt_jvm_library", "java-lib-1"),
		},
	})
}
+8 −10
Original line number Diff line number Diff line
@@ -2710,14 +2710,6 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
			Rule_class:        "java_library",
			Bzl_load_location: "//build/bazel/rules/java:library.bzl",
		}

		ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
		neverlinkProp := true
		neverLinkAttrs := &javaLibraryAttributes{
			Exports:   bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
			Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
		}
		ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name + "-neverlink"}, neverLinkAttrs)
	} else {
		attrs.Common_srcs = bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Common_srcs))

@@ -2725,9 +2717,15 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
			Rule_class:        "kt_jvm_library",
			Bzl_load_location: "@rules_kotlin//kotlin:jvm_library.bzl",
		}
		// TODO (b/244210934): create neverlink-duplicate target once kt_jvm_library supports neverlink attribute
	}

	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
	neverlinkProp := true
	neverLinkAttrs := &javaLibraryAttributes{
		Exports:   bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
		Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
	}
	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name + "-neverlink"}, neverLinkAttrs)

}