Skip to content

Commit 8500857

Browse files
v1.3.1 Addressables BuildLayout.json Analyze fixes (#56)
Fix for error when running analyze on the buildreport.json on a build that hit a size > 2GB. E.g. an individual AssetBundle file was more than 2GB As precautionary measure change all "size" fields to long (although most should be very hard to reach that limit) Fix for UNIQUE constraint failed SQL error Avoid adding the same dependency more than once. This fixes errors discovered testing a large buildlayout.json
1 parent c4dd424 commit 8500857

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

Analyzer/SQLite/Parsers/Models/BuildLayout.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public class ReferenceData
9696
public ReferenceId[] InternalReferencedOtherAssets;
9797
public string[] Labels;
9898
public int MainAssetType;
99-
public int StreamedSize;
100-
public int SerializedSize;
99+
public long StreamedSize;
100+
public long SerializedSize;
101101
public string Name;
102102
public string CRC;
103103

@@ -107,11 +107,11 @@ public class ReferenceData
107107
public ReferenceId[] BundleDependencies;
108108
public string Compression;
109109
public ReferenceId[] Dependencies;
110-
public int DependencyFileSize;
110+
public long DependencyFileSize;
111111
public ReferenceId[] DependentBundles;
112112
public ReferenceId[] ExpandedDependencies;
113-
public int ExpandedDependencyFileSize;
114-
public int FileSize;
113+
public long ExpandedDependencyFileSize;
114+
public long FileSize;
115115
public ReferenceId[] Files;
116116
public ReferenceId Group;
117117
public object Hash; // Complex object containing Hash and serializedVersion
@@ -131,9 +131,9 @@ public class ReferenceData
131131
public BundleObjectInfo BundleObjectInfo; // Object with Size property
132132
public ReferenceId[] ExternalReferences;
133133
public int MonoScriptCount;
134-
public int MonoScriptSize;
134+
public long MonoScriptSize;
135135
public ReferenceId[] OtherAssets;
136-
public int PreloadInfoSize;
136+
public long PreloadInfoSize;
137137
public ReferenceId[] SubFiles;
138138
public string WriteResultFilename;
139139

@@ -148,7 +148,7 @@ public class ReferenceData
148148

149149
// For BuildLayout/SubFile
150150
public bool IsSerializedFile;
151-
public int Size;
151+
public long Size;
152152
}
153153

154154
public class ReferenceType
@@ -166,7 +166,7 @@ public class AssetHash
166166

167167
public class BundleObjectInfo
168168
{
169-
public int Size;
169+
public long Size;
170170
}
171171

172172
public class AssetObject
@@ -175,7 +175,7 @@ public class AssetObject
175175
public string ComponentName;
176176
public long LocalIdentifierInFile;
177177
public string ObjectName;
178-
public int SerializedSize;
178+
public long SerializedSize;
179179
public ObjectReference[] References; // Array of object references
180180
public int StreamedSize;
181181
}

Analyzer/SQLite/Writers/AddressablesBuildLayoutSQLWriter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using Microsoft.Data.Sqlite;
45
using Newtonsoft.Json;
@@ -245,11 +246,16 @@ private void WriteBuildLayoutBundle(Reference reference, long buildId, SqliteTra
245246
m_AddressablesBuildBundle.SetValue("result_type", reference.data.ResultType);
246247
m_AddressablesBuildBundle.ExecuteNonQuery();
247248

249+
var visited = new Dictionary<string, bool>();
248250
// Insert bundle dependencies
249251
if (reference.data.BundleDependencies != null)
250252
{
251253
foreach (var dep in reference.data.BundleDependencies)
252254
{
255+
var key = $"{buildId}_{reference.rid}_{dep.rid}";
256+
if (visited.ContainsKey(key))
257+
continue;
258+
visited.Add(key, true);
253259
m_AddressablesBuildBundleDependency.SetTransaction(transaction);
254260
m_AddressablesBuildBundleDependency.SetValue("bundle_id", reference.rid);
255261
m_AddressablesBuildBundleDependency.SetValue("build_id", buildId);

UnityDataTool/UnityDataTool.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net9.0</TargetFramework>
66
<LangVersion>latest</LangVersion>
7-
<Version>1.3.0</Version>
8-
<AssemblyVersion>1.3.0.0</AssemblyVersion>
9-
<FileVersion>1.3.0.0</FileVersion>
10-
<InformationalVersion>1.3.0</InformationalVersion>
7+
<Version>1.3.1</Version>
8+
<AssemblyVersion>1.3.1.0</AssemblyVersion>
9+
<FileVersion>1.3.1.0</FileVersion>
10+
<InformationalVersion>1.3.1</InformationalVersion>
1111
</PropertyGroup>
1212

1313
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">

0 commit comments

Comments
 (0)