Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor scalac java_binary target creation
I'd like to remove Scala compiler extensions from the Scala toolchain, that I could be potentially building myself (in the same monorepo, build the compiler extension, but also use it). Till now the only way to add Scala compiler dependencies was a toolchain. If I left the compiler extension as a toolchain dependency there, I could not build the compiler extension due to a cycle in deps (building the compiler extension would depend on itself through the toolchain). I'd like to work this around by defining my own scalac java_binary target, where I can define my own dependencies (and then create rule names with macros that override the scalac target). To do this without duplicating code from rules_scala, refactor SCALAC_DEPS parameter and scalac target definitions to a Starlark file to make them reusable for outside users. Added: - define_scalac() - define_scalac_bootstrap() A user could do: ``` EXTENDED_SCALAC_DEPS = DEFAULT_SCALAC_DEPS + [ "@//my/compiler/dependency:library", ] define_scalac( name = "scalac_with_extensions", deps = EXTENDED_SCALAC_DEPS, ) ``` And then build that compiler library in the same monorepo, this way, providing compiler dependencies without toolchains (that would cause cycles for this usecase). See bazelbuild#1674 for more information.
- Loading branch information