The general question is: How can I import/use functions from a pleasing inside of a build_defs file?
In my example I am trying to create a set of rules around the
kotlin pleasing which internally will use its functions but with some extra functionality convenient for my project (default srcs, resources, etc).
My code looks like:
kotlin/BUILD
subinclude(""pleasings/kotlin")
filegroup(
name = "kotlin",
srcs = ["kotlin.build_defs"],
deps = [":kotlin_pleasing"],
visibility = ["PUBLIC"]
)
kotlin/kotlin.build_defs
def kt_library(
name:str,
srcs:list = None,
resources:list = None,
deps:list = [],
exported_deps:list = [],
test_only:bool = False,
visibility:list = None):
if not srcs:
srcs = glob(["src/main/kotlin/**/*.kt"])
if not resources:
resources = glob(["src/main/resources/**"])
result = kotlin_library(
name = name,
srcs = srcs,
resources = resources,
deps = deps,
exported_deps = exported_deps,
visibility = visibility
)
return result
From elsewhere I would use kt_library instead of kotlin_library. Now, the issue is that kotlin_library does not exist in the scope of the build_defs and I would like to use it. How can I import it?
Thanks!