fix(installer): complete context bundle roots
This commit is contained in:
@@ -36,6 +36,12 @@ public static class ShrinkInstallerDevelopmentValidation
|
||||
?.GetValue(null) as IEnumerable;
|
||||
Require(Count(packages) == 20, "包目录数量不是 20。");
|
||||
Require(Count(bundles) == 8, "推荐组合数量不是 8。");
|
||||
Require(BundleContainsInstallRoot(bundles, "基础应用(推荐)",
|
||||
"com.cneicy.shrink-context-eventbus-adapter"),
|
||||
"基础应用组合没有显式安装 Context 事件适配。");
|
||||
Require(BundleContainsInstallRoot(bundles, "常用完整套件",
|
||||
"com.cneicy.shrink-context-eventbus-adapter"),
|
||||
"常用完整套件没有显式安装 Context 事件适配。");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -60,6 +66,32 @@ public static class ShrinkInstallerDevelopmentValidation
|
||||
return count;
|
||||
}
|
||||
|
||||
private static bool BundleContainsInstallRoot(IEnumerable bundles, string bundleName, string packageName)
|
||||
{
|
||||
foreach (var bundle in bundles)
|
||||
{
|
||||
var bundleType = bundle.GetType();
|
||||
if (!string.Equals(bundleType.GetProperty("DisplayName")?.GetValue(bundle) as string, bundleName,
|
||||
StringComparison.Ordinal))
|
||||
continue;
|
||||
|
||||
var roots = bundleType.GetProperty("InstallRoots")?.GetValue(bundle) as IEnumerable;
|
||||
if (roots == null)
|
||||
return false;
|
||||
|
||||
foreach (var root in roots)
|
||||
{
|
||||
var value = root.GetType().GetProperty("PackageName")?.GetValue(root) as string;
|
||||
if (string.Equals(value, packageName, StringComparison.Ordinal))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Type FindType(string fullName) => AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Select(assembly => assembly.GetType(fullName, false))
|
||||
.FirstOrDefault(type => type != null)
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace ShrinkSDK.Installer
|
||||
DataSaverApp, DataSaverEventBus, NetworkApp, NetworkEventBus,
|
||||
StarterBasic
|
||||
},
|
||||
new[] { StarterBasic },
|
||||
new[] { StarterBasic, ContextEventBusAdapter },
|
||||
recommended: true),
|
||||
new ShrinkSdkPackageBundle(
|
||||
"Context 最小基座",
|
||||
@@ -195,7 +195,7 @@ namespace ShrinkSDK.Installer
|
||||
DataSaverApp, DataSaverEventBus, NetworkApp, NetworkEventBus,
|
||||
StarterBasic
|
||||
},
|
||||
new[] { StarterBasic, ModFramework, Tutorial })
|
||||
new[] { StarterBasic, ContextEventBusAdapter, ModFramework, Tutorial })
|
||||
};
|
||||
|
||||
internal static IReadOnlyList<ShrinkSdkPackageEntry> DistinctInstallRoots(
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
## 引导地址
|
||||
|
||||
```text
|
||||
https://git.crash.work/ShrinkSDK/Installer.git#v0.2.1
|
||||
https://git.crash.work/ShrinkSDK/Installer.git#v0.2.2
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.cneicy.shrink-installer",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"displayName": "ShrinkSDK 包管理",
|
||||
"description": "基于 UI Toolkit 的 ShrinkSDK 固定版本包管理器,提供安装状态、Context 分层与推荐组合。",
|
||||
"unity": "2022.3",
|
||||
|
||||
Reference in New Issue
Block a user