Procházet zdrojové kódy

1.0.5 去掉绑定基线的逻辑

baxi před 3 dny
rodič
revize
1681fbf10c

+ 4 - 0
CHANGELOG.md

@@ -37,3 +37,7 @@
 ## 1.0.4
 ## 1.0.4
 
 
 - Preserve the original bytes of the Facebook iOS SDK 18.1.1 static XCFrameworks on Windows Git checkouts.
 - Preserve the original bytes of the Facebook iOS SDK 18.1.1 static XCFrameworks on Windows Git checkouts.
+
+## 1.0.5
+
+- Allow hot updates across build IDs and Development Build settings. Verify cached assembly and scene bundles by size and SHA-256 before downloading missing or corrupt content.

+ 1 - 1
Documentation~/HotPatch.md

@@ -109,7 +109,7 @@ Launch still initializes its original cache from the installed `manifest.json`.
 
 
 1. Read AppSettings.
 1. Read AppSettings.
 2. Extract the AOT bundle from StreamingAssets into `Application.temporaryCachePath/HotUpdate/<build-id-hash>`. If the cache is missing, also extract the original assembly bundle, scene bundle, and manifest. Verify the size and SHA-256 of every bundle.
 2. Extract the AOT bundle from StreamingAssets into `Application.temporaryCachePath/HotUpdate/<build-id-hash>`. If the cache is missing, also extract the original assembly bundle, scene bundle, and manifest. Verify the size and SHA-256 of every bundle.
-3. Download the remote manifest, validate the platform, assembly, scene, and baseline, compare against the cache, and download only changed or corrupt assembly and scene bundles.
+3. Validate the remote manifest's format, platform, assembly, and scene. Updates from a different build ID or Development Build setting are accepted. For each assembly or scene bundle in `resources`, reuse a cached file with the expected size and SHA-256, restore matching content from StreamingAssets, or download it from the server. The installed package supplies the AOT metadata used at launch.
 4. Once both bundles are complete, atomically commit the new manifest and remove obsolete files. Any download failure preserves the previous complete version. Unchanged manifests are not rewritten. Corrupt AOT data can only be repaired from the installed application.
 4. Once both bundles are complete, atomically commit the new manifest and remove obsolete files. Any download failure preserves the previous complete version. Unchanged manifests are not rewritten. Corrupt AOT data can only be repaired from the installed application.
 5. Load the cached AOT bundle, read and verify the four DLLs, and call the HybridCLR supplemental metadata API in the Player.
 5. Load the cached AOT bundle, read and verify the four DLLs, and call the HybridCLR supplemental metadata API in the Player.
 6. Load the assembly bundle and read the DLL. In the Player, call Assembly.Load and invoke methods marked with HotPatchInitializer. Unload AOT and assembly bundles after reading their bytes.
 6. Load the assembly bundle and read the DLL. In the Player, call Assembly.Load and invoke methods marked with HotPatchInitializer. Unload AOT and assembly bundles after reading their bytes.

+ 3 - 8
Runtime/HotPatch/HotPatchResourceStore.cs

@@ -105,13 +105,8 @@ namespace HotPatch
             fresh.Query = fresh.Query.TrimStart('?') + (fresh.Query.Length > 0 ? "&" : "") + "hotpatch=" + DateTime.UtcNow.Ticks;
             fresh.Query = fresh.Query.TrimStart('?') + (fresh.Query.Length > 0 ? "&" : "") + "hotpatch=" + DateTime.UtcNow.Ticks;
             var remote = Parse(await ReadTextAsync(fresh.Uri, ct, true));
             var remote = Parse(await ReadTextAsync(fresh.Uri, ct, true));
             HotPatchLog.Info($"remote_manifest platform={remote.platform} build={remote.playerBuildId} version={remote.version}");
             HotPatchLog.Info($"remote_manifest platform={remote.platform} build={remote.playerBuildId} version={remote.version}");
-            remote.ValidateAgainst(original);
-            var previous = local.resources.ToDictionary(r => r.name, StringComparer.OrdinalIgnoreCase);
-            var changed = remote.resources.Where(resource =>
-                !previous.TryGetValue(resource.name, out var old) || !resource.SameContent(old) ||
-                !IsVerified(Path.Combine(root, resource.RelativePath), resource)).ToArray();
-                                                                                                         
-            changed = changed.Where(r => !IsVerified(Path.Combine(root, r.RelativePath), r)).ToArray();
+            remote.Validate(original.assemblyName, original.platform, original.gameSceneName);
+            var changed = remote.resources.Where(r => !IsVerified(Path.Combine(root, r.RelativePath), r)).ToArray();
             long total = changed.Sum(r => checked(r.size)), completed = 0;
             long total = changed.Sum(r => checked(r.size)), completed = 0;
             HotPatchLog.Info($"version_compare local={local.version} remote={remote.version} changedFiles={changed.Length} transferBytes={total}");
             HotPatchLog.Info($"version_compare local={local.version} remote={remote.version} changedFiles={changed.Length} transferBytes={total}");
             foreach (var resource in changed)
             foreach (var resource in changed)
@@ -144,7 +139,7 @@ namespace HotPatch
             try
             try
             {
             {
                 var manifest = Parse(File.ReadAllText(path));
                 var manifest = Parse(File.ReadAllText(path));
-                manifest.ValidateAgainst(original);
+                manifest.Validate(original.assemblyName, original.platform, original.gameSceneName);
                 return manifest;
                 return manifest;
             }
             }
             catch (Exception e) when (e is IOException || e is ArgumentException || e is InvalidOperationException)
             catch (Exception e) when (e is IOException || e is ArgumentException || e is InvalidOperationException)

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "come.app.runtimes",
   "name": "come.app.runtimes",
-  "version": "1.0.4",
+  "version": "1.0.5",
   "displayName": "AppRuntimes",
   "displayName": "AppRuntimes",
   "description": "Shared AppRuntimes library with HybridCLR package setup, bundled UniTask, UniWebView, Facebook SDK, External Dependency Manager and GUPS.",
   "description": "Shared AppRuntimes library with HybridCLR package setup, bundled UniTask, UniWebView, Facebook SDK, External Dependency Manager and GUPS.",
   "unity": "6000.3",
   "unity": "6000.3",