Repository navigation
feat: compile-check answers a method-body edit in a large assembly in seconds instead of a full recompile #3318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
68c1183
feat: Add the worker that lets compile-check check only changed files…
hatayama 72d6e3d
feat: compile-check can build and run its changed-files check worker …
hatayama 4ced3f2
feat: compile-check checks only the changed files after a body edit i…
hatayama 99eff0d
chore: split the compile-check changed-files check file under the lin…
hatayama 9a43fd0
fix: compile-check says why it compiled an assembly in full instead o…
hatayama b3071f0
perf: compile-check reads the project's directories once per run (#3321)
hatayama 1e39460
perf: compile-check reads the project's directories and build records…
hatayama 7d1ed15
perf: compile-check reads assembly definitions and checks assemblies …
hatayama 1c2d613
fix: compile-check walks local packages in a fixed order (#3324)
hatayama 38cb0b0
refactor: gather compile-check's records behind a record store (#3325)
hatayama f434fce
test: keep record internals in the record store's own tests (#3326)
hatayama 8c60da8
refactor: move compile-check's records into a resultstore package (#3…
hatayama 626c5d8
feat: compile-check's record store can keep the last changed-files ch…
hatayama f46b2a4
feat: compile-check replays a changed-files check whose inputs did no…
hatayama eb7989a
fix: compile-check does not record a compile whose inputs changed whi…
hatayama a148fde
fix: compile-check keeps the records of assemblies it blocks (#3331)
hatayama aebad28
fix: compile-check says how to get its changed-files check back (#3332)
hatayama 6e309c9
feat: compile-check writes what each run did to the CLI VibeLog (#3333)
hatayama 02fd830
fix: compile-check's summary says 1 assembly and 1 error (#3334)
hatayama 9e491a5
fix: compile-check no longer recompiles dependents when a rebuilt ass…
hatayama 65ec440
feat: compile-check's worker can tell whether two reference assemblie…
hatayama 32b4a6d
feat: compile-check skips dependents when a rebuilt assembly keeps th…
hatayama fa02f44
fix: compile-check no longer recompiles dependents of an assembly who…
hatayama cbddc27
feat: compile-check records whether a compile may still apply while i…
hatayama 68aaa81
feat: compile-check no longer makes dependents wait for each other wh…
hatayama 8b218a3
feat: compile-check starts the largest ready assembly first so long c…
hatayama 869c812
refactor: split compile-check input key writers into their own file (…
hatayama 5b69d3c
feat: compile-check learns which names a public API change touches (#…
hatayama c253245
feat: compile-check compiles only the dependents that use what a publ…
hatayama 9452a07
chore: document why compile-check skips dependents that use none of t…
hatayama 8de6940
perf: compile-check reads the names of the plan only when a run compi…
hatayama 22518a4
chore: compile-check docs say an assembly a run leaves out keeps its …
hatayama c74c3f8
fix: compile-check surface comparison leaves out the types the compil…
hatayama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| package compilecheck | ||
|
|
||
| import ( | ||
| "context" | ||
| "errors" | ||
| "fmt" | ||
| "path/filepath" | ||
| "strings" | ||
|
|
||
| "github.com/hatayama/unity-cli-loop/dispatcher/internal/compilecheck/fastcheck" | ||
| "github.com/hatayama/unity-cli-loop/dispatcher/internal/compilecheck/resultstore" | ||
| ) | ||
|
|
||
| // RecordBaseline records what the next changed-files check of a unit compares against, after a | ||
| // successful full compile. nonSourceKey is the unit's non-source key computed before the compile. | ||
| // Why every content hash must match the one the input key read, and the non-source key the one | ||
| // computed before the compile: the manifest describes the inputs csc compiled, and an input changed | ||
| // during the compile would otherwise enter the baseline as if that compile had seen it, and its | ||
| // effect would never be checked by the next run. | ||
| func (runner *fastPathRunner) RecordBaseline( | ||
| ctx context.Context, c Compiler, plan BuildPlan, unit CompileUnit, keyResult inputKeyResult, | ||
| nonSourceKey nonSourceIdentity, | ||
| ) error { | ||
| if nonSourceKey.Key == "" { | ||
| return errors.New("inputs other than source contents could not be read before the compile") | ||
| } | ||
| currentNonSourceKey, err := computeNonSourceKey(c.ProjectRoot, c.Paths, plan, unit) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| if currentNonSourceKey.Key != nonSourceKey.Key { | ||
| return errors.New("inputs other than source contents changed during the compile: " + | ||
| strings.Join(changedInputKinds(currentNonSourceKey, nonSourceKey), ", ")) | ||
| } | ||
|
|
||
| worker, err := runner.Worker.Ensure(ctx) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| request := fastcheck.FingerprintRequest{ | ||
| ProjectRoot: c.ProjectRoot, | ||
| ResponseFilePath: filepath.Join(c.ProjectRoot, plan.OutputDir, unit.Assembly.AssemblyName+responseFileExtension), | ||
| Sources: make([]string, 0, len(unit.Sources)), | ||
| } | ||
| for _, source := range unit.Sources { | ||
| request.Sources = append(request.Sources, projectPath(c.ProjectRoot, source)) | ||
| } | ||
|
|
||
| fingerprints, err := runner.Worker.Fingerprint(ctx, worker, request) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| files, err := baselineFiles(c.ProjectRoot, unit, keyResult, fingerprints) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| return c.records(plan).RecordBaseline(unit.Assembly.AssemblyName, resultstore.BaselineInputs{ | ||
| InputKey: keyResult.Key, | ||
| NonSourceKey: resultstore.KeyDigest(nonSourceKey), | ||
| WorkerKey: worker.Key, | ||
| Files: files, | ||
| }) | ||
| } | ||
|
|
||
| // baselineFiles pairs each source's content hash, as the input key read it, with its fingerprint. | ||
| func baselineFiles( | ||
| projectRoot string, unit CompileUnit, keyResult inputKeyResult, fingerprints fastcheck.FingerprintResponse, | ||
| ) (map[string]resultstore.BaselineFile, error) { | ||
| files := make(map[string]resultstore.BaselineFile, len(unit.Sources)) | ||
| for _, source := range unit.Sources { | ||
| absolute := projectPath(projectRoot, source) | ||
| fingerprint, hasFingerprint := fingerprints.Fingerprints[absolute] | ||
| contentHash, hasHash := fingerprints.ContentHashes[absolute] | ||
| if !hasFingerprint || !hasHash { | ||
| return nil, fmt.Errorf("worker returned no fingerprint for %s", source) | ||
| } | ||
| if contentHash != keyResult.SourceHashes[source] { | ||
| return nil, fmt.Errorf("source changed during the compile: %s", source) | ||
| } | ||
| files[source] = resultstore.BaselineFile{ContentHash: contentHash, Fingerprint: fingerprint} | ||
| } | ||
|
|
||
| return files, nil | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: hatayama/unity-cli-loop
Length of output: 264
🏁 Script executed:
Repository: hatayama/unity-cli-loop
Length of output: 3905
Regenerate the tool catalog.
The
--fullparameter-table entry is present inPackages/src/Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md, butcli/common/tools/default-tools.jsonis unchanged and contains nocompile-checkor--fullentry. Runscripts/sync-tool-docs.shand commit the regenerated catalog.The skill file is 6,452 bytes, so it remains within the 8,000-byte limit.
🤖 Prompt for AI Agents
Source: Coding guidelines