-
Notifications
You must be signed in to change notification settings - Fork 63
Add Addressables Report support #29
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for importing Unity Addressables build reports by parsing JSON build layout files and writing their data into new SQLite tables.
- Introduce
WriteAddressablesBuild
inSQLiteWriter
and register all related commands. - Add dozens of
AbstractCommand
subclasses to support addressables tables. - Update database schema (
Init.sql
) and analyzer tool to handle.json
Addressables build reports.
Reviewed Changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
Analyzer/SQLite/SQLiteWriter.cs | Register and use new Addressables build commands; implement WriteAddressablesBuild . |
Analyzer/SQLite/Commands/*.cs | Add command classes for each addressables-related table. |
Analyzer/Resources/Init.sql | Create all addr_build_* tables for addressables data. |
Analyzer/AnalyzerTool.cs | Detect .json files and route to ProcessAddressablesBuild . |
Analyzer/Analyzer.csproj | Add Newtonsoft.Json package for JSON deserialization. |
Comments suppressed due to low confidence (2)
Analyzer/SQLite/SQLiteWriter.cs:62
- [nitpick] The field name 'm_AddressablesDataFromOtherAsset' is missing 'Build' after 'Addressables'. Consider renaming to 'm_AddressablesBuildDataFromOtherAsset' for consistency.
private AddressablesBuildDataFromOtherAsset m_AddressablesDataFromOtherAsset = new AddressablesBuildDataFromOtherAsset();
Analyzer/SQLite/SQLiteWriter.cs:259
- This new method contains substantial logic for parsing and inserting data; consider adding unit tests to cover key code paths and error handling.
public void WriteAddressablesBuild(string filename, BuildLayout buildLayout)
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.
I took an initial peek at the code (but didn't try it out)
So far just a few suggestions about organizing the new functionality with a bit more structure, which probably could pay off as establishing a pattern for other build-pipeline-specific tables we might add in future.
4ea43ea
to
6206b19
Compare
This refactors the code to have separate parsers for Asset Bundles and Addressables Build Layout files. The parser implements a CanParse and Parse method to handle applicability. Currently there's no overlap so we won't be double-parsing, but it's possible in the future.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull Request Overview
Copilot reviewed 87 out of 89 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- Analyzer/Properties/Resources.Designer.cs: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f4832e3
to
8303ae0
Compare
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.
Pull Request Overview
Copilot reviewed 87 out of 89 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- Analyzer/Properties/Resources.Designer.cs: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildSubFile.cs
Show resolved
Hide resolved
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.
Looks good Tim. I have a few suggestions but also see this as an ongoing iteration. Now that you've adjusted your fix to work "on demand" it won't have risk of impact on existing use cases. I do plan to try it out more as well.
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.
It looks like copilot mentioned a few fixes that look worth doing.
And I think there is an issue still with the /Build/ file that should be addressed.
But in terms of adding more examples and docs that can also happen in follow ups.
**Files** - the file in the asset bundle that contains serialized files | ||
**SubFiles** - files that are bundled in the asset bundle, but not stored with the rest of the serialized files (resS, scene sharedAssets) |
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.
**Files** - the file in the asset bundle that contains serialized files | |
**SubFiles** - files that are bundled in the asset bundle, but not stored with the rest of the serialized files (resS, scene sharedAssets) | |
**Files** - the files of the Unity serialized file format in the asset bundle. | |
**SubFiles** - Additional files in the asset bundle that are not serialized files. These are referenced from serialized files, for example resS and resource. |
One question i have is about .sharedAssets that you mention - those are actually serialized flies, which does make the definition of sub file a bit more complicated. Is it closely aligned with Addressables tracking that they are treated as a "sub files". I think the regular UnityDataTools tables would list .sharedAssets in the main tables.
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.
Yup, right or wrong the addressables report treats them as sub files and puts them in the addressables_build_sub_files table:
5214|1|0|CAB-0e7808e7a61f3cca1f2d183e4a2d90d0.resS|50332672
5270|1|1|CAB-2c23c67af208a1a10429ef1458fc4a68.sharedAssets|4000
5271|1|1|CAB-2c23c67af208a1a10429ef1458fc4a68|28688
5272|1|1|CAB-2414edc0ddcd3b56e6e7e6a3280dc0e5.sharedAssets|3768
5273|1|1|CAB-2414edc0ddcd3b56e6e7e6a3280dc0e5|21040
5275|1|1|CAB-cb639d53e9792fd67401eb9cc4b8b84b|3744
5276|1|0|CAB-cb639d53e9792fd67401eb9cc4b8b84b.resource|400864
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.
ok, thanks for checking it out.
It feels like that will make it harder to correctly cross reference from serialized_files and other tables into the Addressables tables when actual serialized files are reported into both files and subfiles table. But for the moment matching the Addressables schema probably is the most informative about how things work.
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.
Pull Request Overview
Copilot reviewed 88 out of 90 changed files in this pull request and generated 6 comments.
Files not reviewed (1)
- Analyzer/Properties/Resources.Designer.cs: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
Copilot reviewed 88 out of 90 changed files in this pull request and generated 7 comments.
Files not reviewed (1)
- Analyzer/Properties/Resources.Designer.cs: Language not supported
Comments suppressed due to low confidence (9)
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildGroup.cs:1
- Remove excessive blank lines at the end of the file (lines 35-37). Only one blank line should remain.
using Microsoft.Data.Sqlite;
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildBundleRegularDependency.cs:1
- Remove excessive blank lines at the end of the file (lines 32-34). Only one blank line should remain.
using Microsoft.Data.Sqlite;
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildBundleFile.cs:1
- Remove excessive blank lines at the end of the file (lines 32-34). Only one blank line should remain.
using Microsoft.Data.Sqlite;
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildBundleDependentBundle.cs:1
- Remove excessive blank lines at the end of the file (lines 32-34). Only one blank line should remain.
using Microsoft.Data.Sqlite;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildSchemaDataPair.cs
Outdated
Show resolved
Hide resolved
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildGroupSchema.cs
Outdated
Show resolved
Hide resolved
Analyzer/SQLite/Commands/AddressablesBuildReport/AddressablesBuildGroupBundle.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…uildGroupBundle.cs Co-authored-by: Copilot <[email protected]>
…uildGroupSchema.cs Co-authored-by: Copilot <[email protected]>
…uildSchemaDataPair.cs Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
||
namespace UnityDataTools.Analyzer.SQLite.Writers; | ||
|
||
public class AssetBundleSQLiteWriter : IDisposable |
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.
UnityDataTools also supports Content Files from Dots and Player content in addition to AssetBundles
Some existing code is a bit unclear about that, e.g. code that works with Unity Archive files calls then AssetBundles.
This could be renamed as SerializedFileSQLiteWriter, that matches with WriteSerializedFile() which is what does the work.
**Files** - the file in the asset bundle that contains serialized files | ||
**SubFiles** - files that are bundled in the asset bundle, but not stored with the rest of the serialized files (resS, scene sharedAssets) |
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.
ok, thanks for checking it out.
It feels like that will make it harder to correctly cross reference from serialized_files and other tables into the Addressables tables when actual serialized files are reported into both files and subfiles table. But for the moment matching the Addressables schema probably is the most informative about how things work.
This PR adds support for reading Addressables build reports and adding them to the Analyzer sqlite database. This provides data that is only available at build time and can be useful when cross-referenced with built asset bundles.
It does a fairly major refactor of the code to add in a concept of a parser that can read different data types and then add their data to the database. SerializedFileParser encapsulates the old functionality and AddressablesBuildLayoutParser adds support for Addressables build reports.
You can point the analyzer at a mixture of build reports and asset bundles. An example of this sort of mixed directory: