[#99] Add --build-history option to analyze#109
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for analyzing a ContentDirectory build together with its matching Library/BuildHistory entry, avoiding accidental import of stale layouts or unrelated build reports while keeping positional path behavior unchanged.
Changes:
- Added
analyze --build-history <folder>CLI option and plumbed it into analyzer options. - Implemented build-history lookup via
BuildManifestHashmatching and “most recent wins” selection usingBuildReportSummary.json. - Added a new data model, updated docs, and introduced a dedicated test suite for the new behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| UnityDataTool/Program.cs | Adds --build-history option and passes it through to the analyzer. |
| Analyzer/AnalyzerTool.cs | Integrates build history lookup into ContentDirectory input preparation and de-duplication messaging. |
| Analyzer/Util/BuildHistoryHelper.cs | New helper for hash discovery, build folder selection, and collecting importable files. |
| UnityDataModels/BuildReportSummary.cs | Adds a JSON model used to read BuildReportSummary.json build start time. |
| UnityDataTool.Tests/AnalyzeBuildHistoryTests.cs | Adds coverage for happy path, failure modes, and most-recent selection logic. |
| Documentation/contentdirectory-format.md | Updates recommended workflow to use --build-history and explains summary usage. |
| Documentation/command-analyze.md | Documents the new option and ContentDirectory input combinations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Follow-up to #99. Analyzing a ContentDirectory build together with its
ContentLayout.jsonrequires finding the right folder insideLibrary/BuildHistory— the folder names are timestamp-derived and picking a stale layout by hand is easy to get wrong. Pointinganalyzeat the whole build history isn't a good answer either: a positional path means "analyze everything in here", which would import every.buildreportof every build in the history.This PR gives the lookup its own syntax instead of overloading positional paths:
analyzelocates the analyzed build's folder inside the build history (by matching theBuildManifestHashof eachContentLayout.jsonagainst the build'sBuildManifestHash.txt) and includes that folder'sContentLayout.jsonand.buildreportin the analysis. Positional paths keep their existing meaning unchanged.Changes
Behavior
--build-history <folder>option onanalyze. The lookup checks the given folder and its direct children only (no recursion — a build history is flat, and this keeps the scan bounded if a large unrelated folder is passed). When several folders match the hash (rebuilds of identical content), the most recent build wins, compared byBuildStartedAtfrom each folder'sBuildReportSummary.json; the selected folder is printed.Code
Analyzer/Util/BuildHistoryHelper: pure file lookup (find the build hash from the input, locate the matching history folder, collect its importable files). TheBuildManifestHash.txtdiscovery and streamingBuildManifestHashreader moved here fromAnalyzerTool, shrinkingPrepareContentDirectoryInputsto just candidate selection and validation.UnityDataModels/BuildReportSummary.cs: the schema ofBuildReportSummary.json, a convenience type for reading it outside the Unity Editor (fields documented in the Editor's ScriptReference).Documentation
command-analyze.md:--build-historyin the options table and examples; the ContentDirectory section now recommends it and covers the new input combinations.contentdirectory-format.md: the "how to analyze" instructions use the new form; note on howBuildReportSummary.jsonis used.Testing
dotnet test— full suite green (764 tests). NewAnalyzeBuildHistoryTests(8 tests) cover the happy path (layout imported, build report imported, references resolved), pointing at a build folder directly, no-match and no-ContentDirectory errors, most-recent selection viaBuildStartedAt(including a folder with a missing summary file), a duplicate positionally-passed layout, and hash discovery next to.archivefiles. Build history folders are assembled per test from the existing LeadingEdge reference build fixtures; all pre-existing ContentLayout tests pass unmodified.🤖 Generated with Claude Code