Commit 50bc2b6
committed
build: implement --builder host (skip docker, use ./gradlew)
Adds realHostRunner: runs the source tree's ./gradlew wrapper
natively on the host, no eclipse-temurin container. Selected by
`trond build --builder host` (or `build.builder: host` in intent);
previously stubbed with "not implemented in Phase 1".
Key design points:
- Builder identity: hashes `java -version` output as
BuilderImageDigest so the cache invalidates when the host's
JDK changes. The ref shows up as `host:openjdk version "..."`
in `trond build list` tables for visual distinction from
pinned docker refs.
- resolveBuild bypasses pins.Resolve when Builder=host — host
builds work with any JDK version, not just the ones with
pinned eclipse-temurin images. (Pre-fix, --builder host
with --jdk 99 would fail at pin lookup, never reaching the
runner.)
- findLargestFatJAR walks build/libs/ subdirs picking the
largest matching JAR, mirroring the docker runner's
`find ... | xargs ls -S | head -n1` so the two builders
agree on which fat jar to promote out of a multi-module
gradle layout.
- For image artifacts, snapshots `docker images` host-side
before/after gradle so image.go's diff logic still works
unchanged. No docker.sock bind-mount needed (we're on the
host already).
- Refuses to run if the source tree has no ./gradlew so we
don't silently fall back to the host's PATH `gradle`, which
would break the "version pinned by source" guarantee.
Interface rename for clarity: internal dockerRunner →
buildRunner, RunDockerBuild → RunBuild. The exported TestRunner
API keeps its historical RunDockerBuild method name (adapter
bridges); existing test fakes were updated to the new internal
method name.
Smoke-tested against real java-tron source on macOS arm64 + JDK
17.0.15: ./gradlew help completed in 4.2s, manifest correctly
records `builder: host` + `builder_image: host:openjdk version
"17.0.15" ...`. Bad-task path returns the same structured
BUILD_FAILED envelope as the docker path.
Tests: 5 new (TestResolveHostIdentity, TestFindLargestFatJAR,
TestFindLargestFatJAR_NoMatches, TestHostRunner_RequiresGradlew,
TestResolveBuild_HostBuilderSkipsPins). Test that touches
`java -version` skips when no JDK is on PATH so CI without a JVM
isn't blocked.1 parent 41b2a34 commit 50bc2b6
7 files changed
Lines changed: 511 additions & 31 deletions
File tree
- internal/build
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
225 | 230 | | |
226 | | - | |
227 | | - | |
| 231 | + | |
228 | 232 | | |
229 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
230 | 256 | | |
231 | 257 | | |
232 | 258 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | 259 | | |
241 | 260 | | |
242 | 261 | | |
| |||
280 | 299 | | |
281 | 300 | | |
282 | 301 | | |
283 | | - | |
| 302 | + | |
284 | 303 | | |
285 | 304 | | |
286 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
19 | | - | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | | - | |
| 98 | + | |
90 | 99 | | |
91 | | - | |
| 100 | + | |
92 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
93 | 106 | | |
| 107 | + | |
94 | 108 | | |
95 | 109 | | |
96 | 110 | | |
| |||
0 commit comments