Conversation
|
Even if we want something like this I think you completely overlooked that we still need checking |
|
you are right |
8cb7adb to
f537dc1
Compare
|
pushed my static libs fix |
c0d043e to
94e8c3e
Compare
|
@gingerBill @Kelimion please review, thanks |
d85e187 to
0a3a668
Compare
346df61 to
f618161
Compare
|
Rebased onto current master (e7b554e) — no conflicts. Verified locally: build/run -cached hits skip codegen, flag/compiler/static-lib changes correctly invalidate, committed tests/issues cached checks all pass, and run shares the single build cache path (test rides along via the same flag registration, no test-specific logic). |
|
@gingerBill @Kelimion this is rebased on current master and I verified it locally. Cache hits skip codegen, changing flags or the compiler or a static lib forces a rebuild, and the cached tests in tests/issues all pass. run -cached is just build -cached plus exec on the same path, and test comes along for free with no test specific logic. Ready for review when you have time. Happy to change anything, especially the rules for what counts as a cache hit. |
Reuse a previously built executable when nothing that affects it has changed. odin build [-cached] <dir | file.odin> odin run [-cached] <dir | file.odin> odin test [-cached] <dir | file.odin> `odin run` shares the `build` entry (cache identity only); `odin test` stays distinct via ODIN_TEST. An entry is reused only when sources (including #load files and static foreign libs), flags, the compiler binary, and the tracked environment are all unchanged. The cache lives in $ODIN_CACHE_DIR (else the user cache dir) and `odin clear-cache` empties it. Details: * Cache dir is keyed on source paths; flags, compiler mtime, and an env allowlist (ODIN_*, PATH, Windows SDK/MSVC vars, DEVELOPER_DIR, SDKROOT) are compared via manifests. Whole-environment comparison was dropped (PWD/SHLVL alone caused misses). * Publish is temp + rename per file; manifests are written only after the executable copy succeeds. No entry-level lock: concurrent same-entry builds interleave (last writer wins), so do not run them concurrently. * Hits are always copied, never linked, so the linker cannot truncate the cache through the output and `odin run` deleting its output is harmless. * clear-cache never follows symlinks (lstat on the child path; fullpath is realpathed and must not be used). Corrupt/zero timestamps always miss. tests/issues covers foreign-lib, flag, and compiler invalidation, no-temp leftovers, runnable restored output, entry survival across `odin run`, run/build sharing, symlink escape, corrupt manifests, and SDK env changes.
The path rotation only moved the last argument forward, so e.g. odin run -cached foo.odin -file failed with got .-cached.. Scan for the first non-flag token instead; all build flags are single argv tokens, so it can only be the path. Adds flag-order cases to tests/issues/run.sh.
|
@Kelimion @gingerBill can you take over this PR for me? Unfortunately I won't have time to shepherd this change in the coming months |
so we have the option to reuse cached binaries if it doesn't require a rebuild. makes runs after the first much less painful now
@gingerBill lmk how you feel about this, cool / not cool?