Commit 6abe503
committed
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 #1674 for more information.1 parent c71c00a commit 6abe503
2 files changed
+52
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
| 2 | + | |
4 | 3 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 4 | + | |
15 | 5 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 6 | + | |
45 | 7 | | |
46 | 8 | | |
47 | 9 | | |
48 | 10 | | |
49 | | - | |
50 | 11 | | |
| 12 | + | |
51 | 13 | | |
52 | 14 | | |
53 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments