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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Registered by alef, one time, via `--init-script`. Not part of the consumer's build; alef never
// writes this file into the consumer's tree.
//
// Prints every `compile*Kotlin` task's resolved classpath and its own destination directory, one
// entry per line as `ALEF_CLASSPATH_ENTRY:<absolute path>`. Matched by task name rather than by
// Kotlin Gradle plugin type, so this needs no Kotlin/AGP classes on the init-script classpath and
// covers both the plain `kotlin("jvm")` plugin and every Android build variant alike.
//
// The match uses `=~` (find), not `==~` (full match): Kotlin Multiplatform compile task names put
// the target *after* `Kotlin` -- `compileKotlinJvm`, `compileKotlinIosArm64`, `compileKotlinJs` --
// so a full-string match against `compile.*Kotlin` silently excludes every one of them and every
// dependency (including transitive ones) reachable only through that target's classpath. `=~`
// matches the same single-target task names (`compileKotlin`, `compileDebugKotlin`) it always did,
// plus these. ~keep
//
// Each matched task also prints an unconditional `ALEF_CLASSPATH_TASK:<name>` marker before either
// try/catch below runs, so the Rust side can tell a resolution that legitimately found few
// dependencies apart from one where a task matched but its classpath/library property silently
// contributed nothing: every real Kotlin compilation depends on kotlin-stdlib at minimum, so a
// matched task contributing no more than its own destination directory is a resolution defect, not
// a small project. ~keep
//
// A compile task's own `libraries`/`classpath` property mirrors that variant's `compileClasspath`
// configuration, which by Gradle's own `api`/`implementation` design only exposes a dependency's
// `api`-scoped transitive dependencies -- an `implementation`-scoped transitive dependency stays
// invisible there even though it is a real, resolvable artifact the module ships with, because it
// also appears on that variant's `runtimeClasspath`. A doc snippet demonstrating a capability the
// module gets from such a dependency is not bound by the module's own internal api/implementation
// boundary the way the module's own source is, so this also unions in every `*RuntimeClasspath`
// configuration once a project has at least one matched Kotlin compile task, resolved leniently so
// one unresolvable artifact cannot silently drop every other real dependency the configuration
// would otherwise report. Matched by name suffix rather than a hardcoded variant name so this
// covers Android's per-variant configurations (`debugRuntimeClasspath`, `releaseRuntimeClasspath`,
// ...), a plain JVM project's single `runtimeClasspath`, and Kotlin Multiplatform's per-target ones
// alike. ~keep
allprojects