14 Commits
Author SHA1 Message Date
cneicy 30a6a11344 chore: update package catalog for Entities 0.1.2 2026-09-05 06:27:30 +08:00
cneicy 9e92d38a53 fix: preserve Installer content file metadata
Publish UPM package / publish (push) Failing after 2s
Publish NuGet packages / publish (push) Successful in 28s
2026-09-05 04:26:13 +08:00
cneicy 3650f9c08b fix: publish Godot Installer as content-only package
Publish UPM package / publish (push) Failing after 2s
Publish NuGet packages / publish (push) Successful in 28s
2026-09-05 04:24:17 +08:00
cneicy 907dda3c8e chore: exclude .NET metadata from UPM packages
Publish NuGet packages / publish (push) Successful in 31s
Publish UPM package / publish (push) Successful in 2s
2026-09-05 04:07:50 +08:00
cneicy b039efb813 ci: trust bundled CAs during NuGet publish 2026-09-05 04:05:22 +08:00
cneicy 302c10b687 ci: provide OpenSSL for .NET packaging 2026-09-05 04:02:16 +08:00
cneicy 84b976c70e ci: run .NET packaging in invariant mode 2026-09-05 03:57:58 +08:00
cneicy 93f66eaa0b ci: bootstrap .NET SDK without system packages 2026-09-05 03:55:13 +08:00
cneicy 87f7b2e408 ci: publish NuGet without external actions 2026-09-05 03:50:14 +08:00
cneicy d963c03081 ci: install .NET prerequisites for package publishing 2026-09-05 03:45:49 +08:00
cneicy b505c5ebb1 feat: add NuGet and Godot distribution 2026-09-05 03:41:45 +08:00
cneicy e97692e768 docs: update Unity installation guide 2026-09-05 02:46:09 +08:00
cneicy 2abf367f36 fix: compare installed package versions semantically 2026-09-05 02:33:59 +08:00
cneicy 012728ffac chore: release 0.2.4
Publish UPM package / publish (push) Successful in 2s
2026-08-28 04:31:05 +08:00
24 changed files with 808 additions and 43 deletions
+123
View File
@@ -0,0 +1,123 @@
name: Publish NuGet packages
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
NUGET_AUTH_TOKEN: ${{ secrets.SHRINKSDK_PACKAGE_TOKEN }}
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: '1'
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
LD_LIBRARY_PATH: /opt/dotnet-libs/usr/lib/x86_64-linux-gnu
SSL_CERT_FILE: /opt/ca-certificates.crt
steps:
- name: Fetch exact tagged source
env:
GITEA_REF: ${{ gitea.ref }}
GITEA_REPOSITORY: ${{ gitea.repository }}
shell: bash
run: |
set -euo pipefail
tag="${GITEA_REF#refs/tags/}"
case "$tag" in
v[0-9]*) ;;
*) echo "Expected a version tag ref, got: $GITEA_REF" >&2; exit 1 ;;
esac
export SHRINKSDK_ARCHIVE_URL="https://git.crash.work/${GITEA_REPOSITORY}/archive/${tag}.tar.gz"
node --input-type=module <<'NODE'
import { writeFile } from 'node:fs/promises';
const response = await fetch(process.env.SHRINKSDK_ARCHIVE_URL);
if (!response.ok) {
throw new Error(`Release archive download failed: ${response.status} ${response.statusText}`);
}
await writeFile('release.tar.gz', new Uint8Array(await response.arrayBuffer()));
NODE
mkdir release
tar -xzf release.tar.gz --strip-components=1 -C release
rm -f release.tar.gz
printf '%s' "$tag" > release/.shrink-sdk-release-tag
- name: Install .NET 8 SDK
shell: bash
run: |
set -euo pipefail
node --input-type=module <<'NODE'
import { writeFile } from 'node:fs/promises';
import { rootCertificates } from 'node:tls';
await writeFile('/opt/ca-certificates.crt', rootCertificates.join('\n'));
const metadataResponse = await fetch('https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/8.0/releases.json');
if (!metadataResponse.ok) throw new Error(`Release metadata download failed: ${metadataResponse.status}`);
const metadata = await metadataResponse.json();
const sdkVersion = metadata['latest-sdk'];
const release = metadata.releases.find(item => item.sdk?.version === sdkVersion);
const file = release?.sdk?.files?.find(item => item.rid === 'linux-x64' && item.name.endsWith('.tar.gz'));
if (!file) throw new Error(`Linux x64 SDK archive not found for ${sdkVersion}`);
const archiveResponse = await fetch(file.url);
if (!archiveResponse.ok) throw new Error(`SDK download failed: ${archiveResponse.status}`);
await writeFile('/tmp/dotnet-sdk.tar.gz', new Uint8Array(await archiveResponse.arrayBuffer()));
const poolUrl = 'https://deb.debian.org/debian-security/pool/updates/main/o/openssl/';
const poolResponse = await fetch(poolUrl);
if (!poolResponse.ok) throw new Error(`OpenSSL package index download failed: ${poolResponse.status}`);
const poolIndex = await poolResponse.text();
const packages = [...poolIndex.matchAll(/href="(libssl3_[^"]+_amd64\.deb)"/g)].map(match => match[1]).sort();
const packageName = packages.at(-1);
if (!packageName) throw new Error('Debian libssl3 package was not found');
const packageResponse = await fetch(poolUrl + packageName);
if (!packageResponse.ok) throw new Error(`OpenSSL package download failed: ${packageResponse.status}`);
await writeFile('/tmp/libssl3.deb', new Uint8Array(await packageResponse.arrayBuffer()));
NODE
mkdir -p /opt/dotnet
tar -xzf /tmp/dotnet-sdk.tar.gz -C /opt/dotnet
mkdir -p /opt/dotnet-libs
dpkg-deb -x /tmp/libssl3.deb /opt/dotnet-libs
rm -f /tmp/dotnet-sdk.tar.gz
rm -f /tmp/libssl3.deb
/opt/dotnet/dotnet --info
- name: Validate, pack and publish
shell: bash
run: |
set -euo pipefail
: "${NUGET_AUTH_TOKEN:?SHRINKSDK_PACKAGE_TOKEN is required}"
export PATH="/opt/dotnet:$PATH"
cd release
tag="$(cat .shrink-sdk-release-tag)"
projects=()
if [[ -d DotNet~ ]]; then
while IFS= read -r -d '' project; do projects+=("$project"); done < <(find DotNet~ -type f -name '*.csproj' -print0)
fi
if [[ -d Godot~ ]]; then
while IFS= read -r -d '' project; do projects+=("$project"); done < <(find Godot~ -type f -name '*.csproj' -print0)
fi
if [[ "${#projects[@]}" -eq 0 ]]; then
while IFS= read -r -d '' project; do projects+=("$project"); done < <(find . -maxdepth 1 -type f -name '*.csproj' -print0)
fi
test "${#projects[@]}" -gt 0
if [[ -f package.json ]]; then
version="$(node -p "require('./package.json').version")"
else
version="$(dotnet msbuild "${projects[0]}" -getProperty:Version -nologo)"
fi
test "$tag" = "v$version"
mkdir -p packages
for project in "${projects[@]}"; do
dotnet restore "$project" --configfile NuGet.Config
dotnet pack "$project" --configuration Release --no-restore --output "$PWD/packages"
done
find packages -maxdepth 1 -name '*.nupkg' -type f | grep -q .
dotnet nuget push 'packages/*.nupkg' --api-key "$NUGET_AUTH_TOKEN" --source https://git.crash.work/api/packages/ShrinkSDK/nuget/index.json --skip-duplicate
if compgen -G 'packages/*.snupkg' > /dev/null; then
dotnet nuget push 'packages/*.snupkg' --api-key "$NUGET_AUTH_TOKEN" --source https://git.crash.work/api/packages/ShrinkSDK/nuget/index.json --skip-duplicate
fi
+8
View File
@@ -8,3 +8,11 @@
/Tools~/**/[Oo]bj/ /Tools~/**/[Oo]bj/
*.user *.user
*.DotSettings.user *.DotSettings.user
/DotNet~/**/[Bb]in/
/DotNet~/**/[Oo]bj/
/Godot~/**/[Bb]in/
/Godot~/**/[Oo]bj/
/artifacts/
/packages/
!DotNet~/**/*.csproj
!Godot~/**/*.csproj
+6
View File
@@ -6,3 +6,9 @@ Tools~/
*.sln *.sln
*.user *.user
*.DotSettings.user *.DotSettings.user
DotNet~/
Godot~/
NuGet.Config
Directory.Build.props
NuGet.Config.meta
Directory.Build.props.meta
+19
View File
@@ -2,6 +2,25 @@
本文件记录 `ShrinkInstaller` 的包内变更。 本文件记录 `ShrinkInstaller` 的包内变更。
## [0.2.6] - 2026-09-05
### Changed
-`ShrinkEventBus.Entities` 目录版本更新到 `0.1.2`
## [0.2.5] - 2026-09-05
### Fixed
- 按 SemVer 比较已安装版本与目录版本;已安装较新版本不再被误判为旧版本,也不会提供降级操作。
- 更新内置包目录,使版本与当前 ShrinkSDK 模块清单一致。
## [0.2.4] - 2026-08-28
### Changed
- 目录切换到 `ShrinkEventBus 2.0.1` 及其精确依赖链,常用完整套件仍只安装四个直接根。
## [0.2.3] - 2026-08-28 ## [0.2.3] - 2026-08-28
### Changed ### Changed
+13
View File
@@ -0,0 +1,13 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Authors>ShrinkSDK</Authors>
<Company>ShrinkSDK</Company>
<RepositoryUrl>https://git.crash.work/ShrinkSDK</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
</Project>
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eda4b5bf19b0ba449900782335d92871
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+117
View File
@@ -0,0 +1,117 @@
#nullable enable
using System;
namespace ShrinkSDK.Installer
{
public enum ShrinkPackageVersionRelation
{
Unknown,
Older,
Equal,
Newer
}
public static class ShrinkPackageVersion
{
public static ShrinkPackageVersionRelation Classify(string? installedVersion, string? targetVersion)
{
return TryCompare(installedVersion, targetVersion, out var comparison)
? comparison < 0
? ShrinkPackageVersionRelation.Older
: comparison > 0
? ShrinkPackageVersionRelation.Newer
: ShrinkPackageVersionRelation.Equal
: ShrinkPackageVersionRelation.Unknown;
}
public static bool TryCompare(string? left, string? right, out int comparison)
{
comparison = 0;
if (!TryParse(left, out var leftVersion) || !TryParse(right, out var rightVersion))
return false;
for (var index = 0; index < 3; index++)
{
comparison = leftVersion.Core[index].CompareTo(rightVersion.Core[index]);
if (comparison != 0)
return true;
}
comparison = ComparePrerelease(leftVersion.Prerelease, rightVersion.Prerelease);
return true;
}
private static bool TryParse(string? raw, out ParsedVersion version)
{
version = default;
if (string.IsNullOrWhiteSpace(raw))
return false;
var value = raw.Trim();
if (value.StartsWith("v", StringComparison.OrdinalIgnoreCase))
value = value.Substring(1);
var buildIndex = value.IndexOf('+');
if (buildIndex >= 0)
value = value.Substring(0, buildIndex);
var prereleaseIndex = value.IndexOf('-');
var coreText = prereleaseIndex >= 0 ? value.Substring(0, prereleaseIndex) : value;
var prerelease = prereleaseIndex >= 0 ? value.Substring(prereleaseIndex + 1) : string.Empty;
var coreParts = coreText.Split('.');
if (coreParts.Length is < 1 or > 3)
return false;
var core = new int[3];
for (var index = 0; index < coreParts.Length; index++)
{
if (!int.TryParse(coreParts[index], out core[index]) || core[index] < 0)
return false;
}
if (prereleaseIndex >= 0 && string.IsNullOrWhiteSpace(prerelease))
return false;
version = new ParsedVersion(core, prerelease);
return true;
}
private static int ComparePrerelease(string left, string right)
{
var leftEmpty = string.IsNullOrEmpty(left);
var rightEmpty = string.IsNullOrEmpty(right);
if (leftEmpty || rightEmpty)
return leftEmpty == rightEmpty ? 0 : leftEmpty ? 1 : -1;
var leftParts = left.Split('.');
var rightParts = right.Split('.');
var count = Math.Min(leftParts.Length, rightParts.Length);
for (var index = 0; index < count; index++)
{
var leftNumeric = int.TryParse(leftParts[index], out var leftValue);
var rightNumeric = int.TryParse(rightParts[index], out var rightValue);
int comparison;
if (leftNumeric && rightNumeric)
comparison = leftValue.CompareTo(rightValue);
else if (leftNumeric != rightNumeric)
comparison = leftNumeric ? -1 : 1;
else
comparison = string.Compare(leftParts[index], rightParts[index], StringComparison.Ordinal);
if (comparison != 0)
return comparison;
}
return leftParts.Length.CompareTo(rightParts.Length);
}
private readonly struct ParsedVersion
{
public ParsedVersion(int[] core, string prerelease)
{
Core = core;
Prerelease = prerelease;
}
public int[] Core { get; }
public string Prerelease { get; }
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e6e04e7ab0ec4fbe87bb30cb04f7ce18
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+35 -17
View File
@@ -172,16 +172,16 @@ namespace ShrinkSDK.Installer
title.style.flexGrow = 1f; title.style.flexGrow = 1f;
titleRow.Add(title); titleRow.Add(title);
var exact = bundle.Packages.Count(IsExactInstalled); var ready = bundle.Packages.Count(IsInstalledAtLeast);
var button = new Button(() => BeginInstall(bundle.InstallRoots)); var button = new Button(() => BeginInstall(bundle.InstallRoots));
if (exact == bundle.Packages.Count) if (ready == bundle.Packages.Count)
{ {
button.text = "已完成"; button.text = "已完成";
button.SetEnabled(false); button.SetEnabled(false);
} }
else else
{ {
button.text = exact > 0 ? "补齐组合" : "安装组合"; button.text = ready > 0 ? "补齐组合" : "安装组合";
button.SetEnabled(!IsBusy); button.SetEnabled(!IsBusy);
} }
button.style.width = 100f; button.style.width = 100f;
@@ -193,9 +193,9 @@ namespace ShrinkSDK.Installer
summary.style.marginTop = 5f; summary.style.marginTop = 5f;
card.Add(summary); card.Add(summary);
var progress = new Label($"已就绪 {exact}/{bundle.Packages.Count}"); var progress = new Label($"已就绪 {ready}/{bundle.Packages.Count}");
progress.style.marginTop = 8f; progress.style.marginTop = 8f;
progress.style.color = exact == bundle.Packages.Count progress.style.color = ready == bundle.Packages.Count
? new Color(0.35f, 0.75f, 0.45f) ? new Color(0.35f, 0.75f, 0.45f)
: new Color(0.65f, 0.65f, 0.65f); : new Color(0.65f, 0.65f, 0.65f);
card.Add(progress); card.Add(progress);
@@ -266,7 +266,7 @@ namespace ShrinkSDK.Installer
row.Add(name); row.Add(name);
var status = new Label(GetInstalledStatus(package)); var status = new Label(GetInstalledStatus(package));
status.style.fontSize = 10f; status.style.fontSize = 10f;
status.style.color = IsExactInstalled(package) status.style.color = IsInstalledAtLeast(package)
? new Color(0.35f, 0.75f, 0.45f) ? new Color(0.35f, 0.75f, 0.45f)
: new Color(0.65f, 0.65f, 0.65f); : new Color(0.65f, 0.65f, 0.65f);
row.Add(status); row.Add(status);
@@ -278,13 +278,26 @@ namespace ShrinkSDK.Installer
var button = new Button(() => BeginInstall(new[] { package })); var button = new Button(() => BeginInstall(new[] { package }));
if (!_installed.TryGetValue(package.PackageName, out var installed)) if (!_installed.TryGetValue(package.PackageName, out var installed))
button.text = "安装 " + package.Version; button.text = "安装 " + package.Version;
else if (string.Equals(installed.version, package.Version, StringComparison.Ordinal))
{
button.text = "已安装 " + installed.version;
button.SetEnabled(false);
}
else else
button.text = installed.version + " → " + package.Version; {
switch (ShrinkPackageVersion.Classify(installed.version, package.Version))
{
case ShrinkPackageVersionRelation.Equal:
button.text = "已安装 " + installed.version;
button.SetEnabled(false);
break;
case ShrinkPackageVersionRelation.Newer:
button.text = "较新版本 " + installed.version;
button.SetEnabled(false);
break;
case ShrinkPackageVersionRelation.Older:
button.text = "升级 " + installed.version + " → " + package.Version;
break;
default:
button.text = installed.version + " → " + package.Version;
break;
}
}
if (IsBusy) if (IsBusy)
button.SetEnabled(false); button.SetEnabled(false);
@@ -326,17 +339,22 @@ namespace ShrinkSDK.Installer
package.Summary.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) >= 0 || package.Summary.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) >= 0 ||
package.PackageName.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) >= 0; package.PackageName.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) >= 0;
private bool IsExactInstalled(ShrinkSdkPackageEntry package) => private bool IsInstalledAtLeast(ShrinkSdkPackageEntry package) =>
_installed.TryGetValue(package.PackageName, out var installed) && _installed.TryGetValue(package.PackageName, out var installed) &&
string.Equals(installed.version, package.Version, StringComparison.Ordinal); ShrinkPackageVersion.Classify(installed.version, package.Version) is
ShrinkPackageVersionRelation.Equal or ShrinkPackageVersionRelation.Newer;
private string GetInstalledStatus(ShrinkSdkPackageEntry package) private string GetInstalledStatus(ShrinkSdkPackageEntry package)
{ {
if (!_installed.TryGetValue(package.PackageName, out var installed)) if (!_installed.TryGetValue(package.PackageName, out var installed))
return "未安装 · " + package.Version; return "未安装 · " + package.Version;
return string.Equals(installed.version, package.Version, StringComparison.Ordinal) return ShrinkPackageVersion.Classify(installed.version, package.Version) switch
? "已安装 " + installed.version {
: "已安装 " + installed.version + " · 固定 " + package.Version; ShrinkPackageVersionRelation.Equal => "已安装 " + installed.version,
ShrinkPackageVersionRelation.Newer => "已安装较新版本 " + installed.version,
ShrinkPackageVersionRelation.Older => "可升级 " + installed.version + " → " + package.Version,
_ => "已安装 " + installed.version + " · 目标 " + package.Version
};
} }
private bool IsBusy => _listRequest != null || _resolvePending || _listRetryPending; private bool IsBusy => _listRequest != null || _resolvePending || _listRetryPending;
+24 -21
View File
@@ -67,67 +67,70 @@ namespace ShrinkSDK.Installer
internal static readonly ShrinkSdkPackageEntry ContextCore = Package( internal static readonly ShrinkSdkPackageEntry ContextCore = Package(
"Context 核心", "可逆效应、响应式依赖与组件生命周期,是框架的组合基础。", "Context 核心", "可逆效应、响应式依赖与组件生命周期,是框架的组合基础。",
"com.cneicy.shrink-context-core", "0.1.0", ShrinkSdkPackageLayer.Context, true); "com.cneicy.shrink-context-core", "0.2.0", ShrinkSdkPackageLayer.Context, true);
internal static readonly ShrinkSdkPackageEntry ContextAppAdapter = Package( internal static readonly ShrinkSdkPackageEntry ContextAppAdapter = Package(
"Context 应用适配", "用 ContextLoader 承载 ShrinkApp 组合根和运行时诊断。", "Context 应用适配", "用 ContextLoader 承载 ShrinkApp 组合根和运行时诊断。",
"com.cneicy.shrink-context-app-adapter", "0.1.4", ShrinkSdkPackageLayer.Context, true); "com.cneicy.shrink-context-app-adapter", "0.2.0", ShrinkSdkPackageLayer.Context, true);
internal static readonly ShrinkSdkPackageEntry ContextEventBusAdapter = Package( internal static readonly ShrinkSdkPackageEntry ContextEventBusAdapter = Package(
"Context 事件适配", "把事件订阅纳入 Context 的安装与自动撤回。", "Context 事件适配", "把事件订阅纳入 Context 的安装与自动撤回。",
"com.cneicy.shrink-context-eventbus-adapter", "0.1.0", ShrinkSdkPackageLayer.Context, true); "com.cneicy.shrink-context-eventbus-adapter", "0.2.0", ShrinkSdkPackageLayer.Context, true);
internal static readonly ShrinkSdkPackageEntry AppCore = Package( internal static readonly ShrinkSdkPackageEntry AppCore = Package(
"应用宿主", "统一启动、服务门面与应用生命周期。", "应用宿主", "统一启动、服务门面与应用生命周期。",
"com.cneicy.shrink-app-core", "0.1.3", ShrinkSdkPackageLayer.Host, true); "com.cneicy.shrink-app-core", "0.2.0", ShrinkSdkPackageLayer.Host, true);
internal static readonly ShrinkSdkPackageEntry StarterBasic = Package( internal static readonly ShrinkSdkPackageEntry StarterBasic = Package(
"基础应用起步包", "默认 Context 组合根,包含命令、存档、网络及其集成。", "基础应用起步包", "默认 Context 组合根,包含命令、存档、网络及其集成。",
"com.cneicy.shrink-app-starter-basic", "0.2.1", ShrinkSdkPackageLayer.Host, true); "com.cneicy.shrink-app-starter-basic", "0.3.0", ShrinkSdkPackageLayer.Host, true);
internal static readonly ShrinkSdkPackageEntry Command = Package( internal static readonly ShrinkSdkPackageEntry Command = Package(
"命令系统", "命令路由、参数、权限与自动注册。", "命令系统", "命令路由、参数、权限与自动注册。",
"com.cneicy.shrink-command", "0.2.0", ShrinkSdkPackageLayer.Feature, true); "com.cneicy.shrink-command", "0.3.0", ShrinkSdkPackageLayer.Feature, true);
internal static readonly ShrinkSdkPackageEntry DataSaver = Package( internal static readonly ShrinkSdkPackageEntry DataSaver = Package(
"存档系统", "异步存档、设置、备份恢复与数据观察。", "存档系统", "异步存档、设置、备份恢复与数据观察。",
"com.cneicy.shrink-datasaver", "2.2.2", ShrinkSdkPackageLayer.Feature, true); "com.cneicy.shrink-datasaver", "2.3.0", ShrinkSdkPackageLayer.Feature, true);
internal static readonly ShrinkSdkPackageEntry EventBus = Package( internal static readonly ShrinkSdkPackageEntry EventBus = Package(
"事件总线", "类型安全事件、请求结果、调度与代码生成。", "事件总线", "类型安全事件、请求结果、调度与代码生成。",
"com.cneicy.shrink-eventbus", "2.0.0", ShrinkSdkPackageLayer.Feature, true); "com.cneicy.shrink-eventbus", "2.1.0", ShrinkSdkPackageLayer.Feature, true);
internal static readonly ShrinkSdkPackageEntry EventBusEntities = Package( internal static readonly ShrinkSdkPackageEntry EventBusEntities = Package(
"Entities 事件适配", "将事件总线接入 Unity Entities。", "Entities 事件适配", "将事件总线接入 Unity Entities。",
"com.cneicy.shrink-eventbus-entities", "0.1.0", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-eventbus-entities", "0.1.2", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry ModFramework = Package( internal static readonly ShrinkSdkPackageEntry ModFramework = Package(
"模组框架", "Context 托管的模组生命周期、热替换与外部 DLL 加载。", "模组框架", "Context 托管的模组生命周期、热替换与外部 DLL 加载。",
"com.cneicy.shrink-mod-framework", "0.2.3", ShrinkSdkPackageLayer.Feature, true); "com.cneicy.shrink-mod-framework", "0.3.0", ShrinkSdkPackageLayer.Feature, true);
internal static readonly ShrinkSdkPackageEntry Network = Package( internal static readonly ShrinkSdkPackageEntry Network = Package(
"网络系统", "消息、RPC、权限、序列化与多种传输层。", "网络系统", "消息、RPC、权限、序列化与多种传输层。",
"com.cneicy.shrink-network", "0.2.1", ShrinkSdkPackageLayer.Feature, true); "com.cneicy.shrink-network", "0.3.0", ShrinkSdkPackageLayer.Feature, true);
internal static readonly ShrinkSdkPackageEntry Tutorial = Package( internal static readonly ShrinkSdkPackageEntry Tutorial = Package(
"引导系统", "可复用的步骤式引导、遮罩、锚点与进度存储。", "引导系统", "可复用的步骤式引导、遮罩、锚点与进度存储。",
"com.cneicy.shrink-tutorial", "0.1.2", ShrinkSdkPackageLayer.Feature); "com.cneicy.shrink-tutorial", "0.2.0", ShrinkSdkPackageLayer.Feature);
internal static readonly ShrinkSdkPackageEntry CommandApp = Package( internal static readonly ShrinkSdkPackageEntry CommandApp = Package(
"命令 - 应用集成", "以原生 Context 组件向应用宿主发布命令服务。", "命令 - 应用集成", "以原生 Context 组件向应用宿主发布命令服务。",
"com.cneicy.shrink-command-integration-app", "0.1.2", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-command-integration-app", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry CommandEventBus = Package( internal static readonly ShrinkSdkPackageEntry CommandEventBus = Package(
"命令 - 事件集成", "通过事件总线执行命令并发布执行状态。", "命令 - 事件集成", "通过事件总线执行命令并发布执行状态。",
"com.cneicy.shrink-command-integration-eventbus", "0.1.1", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-command-integration-eventbus", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry CommandNetwork = Package( internal static readonly ShrinkSdkPackageEntry CommandNetwork = Package(
"命令 - 网络集成", "通过网络 RPC 执行远程命令。", "命令 - 网络集成", "通过网络 RPC 执行远程命令。",
"com.cneicy.shrink-command-integration-network", "0.1.1", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-command-integration-network", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry DataSaverApp = Package( internal static readonly ShrinkSdkPackageEntry DataSaverApp = Package(
"存档 - 应用集成", "以原生 Context 组件向应用宿主发布存档服务。", "存档 - 应用集成", "以原生 Context 组件向应用宿主发布存档服务。",
"com.cneicy.shrink-datasaver-integration-app", "0.1.2", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-datasaver-integration-app", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry DataSaverEventBus = Package( internal static readonly ShrinkSdkPackageEntry DataSaverEventBus = Package(
"存档 - 事件集成", "通过事件总线请求读写并观察存档变化。", "存档 - 事件集成", "通过事件总线请求读写并观察存档变化。",
"com.cneicy.shrink-datasaver-integration-eventbus", "2.1.2", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-datasaver-integration-eventbus", "2.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry NetworkApp = Package( internal static readonly ShrinkSdkPackageEntry NetworkApp = Package(
"网络 - 应用集成", "以原生 Context 组件向应用宿主发布网络服务。", "网络 - 应用集成", "以原生 Context 组件向应用宿主发布网络服务。",
"com.cneicy.shrink-network-integration-app", "0.1.2", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-network-integration-app", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry NetworkEventBus = Package( internal static readonly ShrinkSdkPackageEntry NetworkEventBus = Package(
"网络 - 事件集成", "把网络消息与事件请求桥接为可撤回的 Context 组件。", "网络 - 事件集成", "把网络消息与事件请求桥接为可撤回的 Context 组件。",
"com.cneicy.shrink-network-integration-eventbus", "0.1.2", ShrinkSdkPackageLayer.Integration, true); "com.cneicy.shrink-network-integration-eventbus", "0.2.0", ShrinkSdkPackageLayer.Integration, true);
internal static readonly ShrinkSdkPackageEntry SharedCodeGen = Package( internal static readonly ShrinkSdkPackageEntry SharedCodeGen = Package(
"共享代码生成", "各功能包使用的编译期注册表基础设施。", "共享代码生成", "各功能包使用的编译期注册表基础设施。",
"com.cneicy.shrink-shared-codegen", "0.1.0", ShrinkSdkPackageLayer.Tooling); "com.cneicy.shrink-shared-codegen", "0.1.1", ShrinkSdkPackageLayer.Tooling);
internal static readonly ShrinkSdkPackageEntry RuntimeAbstractions = Package(
"运行时抽象", "Unity 与其他 .NET 宿主共用的平台服务合同。",
"com.cneicy.shrink-runtime-abstractions", "0.1.0", ShrinkSdkPackageLayer.Tooling);
internal static readonly IReadOnlyList<ShrinkSdkPackageEntry> Packages = new[] internal static readonly IReadOnlyList<ShrinkSdkPackageEntry> Packages = new[]
{ {
@@ -137,7 +140,7 @@ namespace ShrinkSDK.Installer
CommandApp, CommandEventBus, CommandNetwork, CommandApp, CommandEventBus, CommandNetwork,
DataSaverApp, DataSaverEventBus, DataSaverApp, DataSaverEventBus,
NetworkApp, NetworkEventBus, EventBusEntities, NetworkApp, NetworkEventBus, EventBusEntities,
SharedCodeGen SharedCodeGen, RuntimeAbstractions
}; };
internal static readonly IReadOnlyList<ShrinkSdkPackageBundle> Bundles = new[] internal static readonly IReadOnlyList<ShrinkSdkPackageBundle> Bundles = new[]
+22
View File
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<AssemblyName>ShrinkSDK.Godot.Installer</AssemblyName>
<PackageId>ShrinkSDK.Godot.Installer</PackageId>
<Version>0.1.3</Version>
<Description>Godot Editor package manager and CodeGen diagnostics for ShrinkSDK.</Description>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>
<ItemGroup>
<Compile Include="addons\shrinksdk\*.cs" />
<Compile Include="..\Editor\ShrinkPackageVersion.cs" Link="addons\shrinksdk\ShrinkPackageVersion.cs" />
<PackageReference Include="GodotSharp" Version="4.6.3" />
<PackageReference Include="GodotSharpEditor" Version="4.6.3" />
<None Include="addons\shrinksdk\plugin.cfg" Pack="true" PackagePath="contentFiles\any\any\addons\shrinksdk\plugin.cfg" BuildAction="None" />
<None Include="addons\shrinksdk\*.cs" Pack="true" PackagePath="contentFiles\any\any\addons\shrinksdk" BuildAction="None" />
<None Include="..\Editor\ShrinkPackageVersion.cs" Pack="true" PackagePath="contentFiles\any\any\addons\shrinksdk\ShrinkPackageVersion.cs" BuildAction="None" />
</ItemGroup>
</Project>
@@ -0,0 +1,133 @@
#nullable enable
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Godot;
using ShrinkSDK.Installer;
namespace ShrinkSDK.Godot.Editor;
[Tool]
public partial class ShrinkGodotInstallerPlugin : EditorPlugin
{
private EditorDock? _panel;
private Label? _status;
private RichTextLabel? _output;
private readonly System.Collections.Generic.Dictionary<string, Button> _installActions =
new(StringComparer.OrdinalIgnoreCase);
private readonly System.Collections.Generic.Dictionary<string, Button> _removeActions =
new(StringComparer.OrdinalIgnoreCase);
private string ProjectDirectory => ProjectSettings.GlobalizePath("res://");
private string ProjectPath => Directory.GetFiles(ProjectDirectory, "*.csproj", SearchOption.TopDirectoryOnly).Single();
public override void _EnterTree()
{
_panel = new EditorDock { Name = "ShrinkSDK", Title = "ShrinkSDK", DefaultSlot = EditorDock.DockSlot.LeftBr };
var content = new VBoxContainer();
_panel.AddChild(content);
content.AddChild(new Label { Text = "ShrinkSDK Packages" });
_installActions.Clear();
_removeActions.Clear();
foreach (var package in ShrinkProjectPackageEditor.RecommendedPackages)
{
var row = new HBoxContainer();
row.AddChild(new Label { Text = $"{package.Key} {package.Value}", SizeFlagsHorizontal = Control.SizeFlags.ExpandFill });
var install = new Button { Text = "Install / Update" };
install.Pressed += () => ChangePackage(package.Key, package.Value);
row.AddChild(install);
_installActions[package.Key] = install;
var remove = new Button { Text = "Remove" };
remove.Pressed += () => ChangePackage(package.Key, null);
row.AddChild(remove);
_removeActions[package.Key] = remove;
content.AddChild(row);
}
var restore = new Button { Text = "Restore and Build" };
restore.Pressed += BuildProject;
content.AddChild(restore);
_status = new Label { Text = "CodeGen: not built" };
content.AddChild(_status);
_output = new RichTextLabel { FitContent = true, CustomMinimumSize = new Vector2(360, 180) };
content.AddChild(_output);
AddDock(_panel);
RefreshInstalledState();
}
public override void _ExitTree()
{
if (_panel == null) return;
RemoveDock(_panel);
_panel.QueueFree();
_panel = null;
}
private async void ChangePackage(string packageId, string? version)
{
try
{
ShrinkProjectPackageEditor.EnsureShrinkFeed(Path.Combine(ProjectDirectory, "NuGet.Config"));
ShrinkProjectPackageEditor.SetPackageReference(ProjectPath, packageId, version);
await RunBuild("restore");
}
catch (Exception exception) { ShowFailure(exception); }
}
private async void BuildProject()
{
try { await RunBuild("build"); }
catch (Exception exception) { ShowFailure(exception); }
}
private async System.Threading.Tasks.Task RunBuild(string command)
{
_status!.Text = $"CodeGen: running dotnet {command}";
var result = await ShrinkProjectPackageEditor.RunDotnetAsync(ProjectDirectory, $"{command} \"{ProjectPath}\" /nr:false");
_output!.Text = result.Output;
var match = Regex.Matches(result.Output, @"\[ShrinkSDK\.CodeGen\].*woven: instance=(\d+), static=(\d+), registry=(\d+)").Cast<Match>().LastOrDefault();
_status.Text = result.ExitCode == 0
? match == null ? "CodeGen: build succeeded (no attributed registrations)" : $"CodeGen: woven; instance={match.Groups[1].Value}, static={match.Groups[2].Value}, registry={match.Groups[3].Value}"
: "CodeGen: build failed";
RefreshInstalledState();
}
private void RefreshInstalledState()
{
if (_output == null) return;
var installed = File.Exists(ProjectPath)
? ShrinkProjectPackageEditor.ReadPackageReferences(ProjectPath)
: new System.Collections.Generic.Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
foreach (var package in ShrinkProjectPackageEditor.RecommendedPackages)
{
var hasInstalled = installed.TryGetValue(package.Key, out var installedVersion);
var relation = hasInstalled
? ShrinkPackageVersion.Classify(installedVersion, package.Value)
: ShrinkPackageVersionRelation.Unknown;
if (_installActions.TryGetValue(package.Key, out var install))
{
install.Text = !hasInstalled
? $"Install {package.Value}"
: relation switch
{
ShrinkPackageVersionRelation.Equal => $"Installed {installedVersion}",
ShrinkPackageVersionRelation.Newer => $"Newer {installedVersion}",
ShrinkPackageVersionRelation.Older => $"Upgrade {installedVersion} → {package.Value}",
_ => $"Update {installedVersion} → {package.Value}"
};
install.Disabled = hasInstalled && relation is
ShrinkPackageVersionRelation.Equal or ShrinkPackageVersionRelation.Newer;
}
if (_removeActions.TryGetValue(package.Key, out var remove))
remove.Disabled = !hasInstalled;
}
_output.Text = "Direct packages: " + string.Join(", ", installed.Select(item => $"{item.Key}@{item.Value}"));
}
private void ShowFailure(Exception exception)
{
_status!.Text = "CodeGen: operation failed";
_output!.Text = exception.ToString();
GD.PushError(exception.ToString());
}
}
@@ -0,0 +1,148 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace ShrinkSDK.Godot.Editor;
public static class ShrinkProjectPackageEditor
{
public static readonly IReadOnlyDictionary<string, string> RecommendedPackages =
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["ShrinkSDK.Godot"] = "0.1.0",
["ShrinkSDK.EventBus"] = "2.1.0",
["ShrinkSDK.Context.Core"] = "0.2.0",
["ShrinkSDK.Command"] = "0.3.0",
["ShrinkSDK.Command.Integration.EventBus"] = "0.2.0",
["ShrinkSDK.Command.Integration.Network"] = "0.2.0",
["ShrinkSDK.Command.Integration.App"] = "0.2.0",
["ShrinkSDK.Network"] = "0.3.0",
["ShrinkSDK.Network.Integration.EventBus"] = "0.2.0",
["ShrinkSDK.Network.Integration.App"] = "0.2.0",
["ShrinkSDK.DataSaver"] = "2.3.0",
["ShrinkSDK.DataSaver.Integration.EventBus"] = "2.2.0",
["ShrinkSDK.DataSaver.Integration.App"] = "0.2.0",
["ShrinkSDK.App.Core"] = "0.2.0",
["ShrinkSDK.Context.AppAdapter"] = "0.2.0",
["ShrinkSDK.App.Starter.Basic"] = "0.3.0",
["ShrinkSDK.ModFramework"] = "0.3.0",
["ShrinkSDK.ModFramework.Godot"] = "0.1.0",
["ShrinkSDK.Tutorial"] = "0.2.0",
["ShrinkSDK.Tutorial.Godot"] = "0.1.0"
};
public static IReadOnlyDictionary<string, string> ReadPackageReferences(string projectPath)
{
var document = XDocument.Load(projectPath, LoadOptions.PreserveWhitespace);
return document.Descendants("PackageReference")
.Select(element => new
{
Id = ((string?)element.Attribute("Include") ?? (string?)element.Attribute("Update"))?.Trim(),
Version = ((string?)element.Attribute("Version") ??
(string?)element.Attribute("VersionOverride") ??
element.Element("Version")?.Value)?.Trim() ?? string.Empty
})
.Where(item => !string.IsNullOrWhiteSpace(item.Id))
.GroupBy(item => item.Id!, StringComparer.OrdinalIgnoreCase)
.ToDictionary(group => group.Key, group => group.First().Version, StringComparer.OrdinalIgnoreCase);
}
public static void SetPackageReference(string projectPath, string packageId, string? version)
{
var document = XDocument.Load(projectPath, LoadOptions.PreserveWhitespace);
var root = document.Root ?? throw new InvalidDataException("The C# project has no root element.");
var references = root.Descendants("PackageReference").Where(element =>
string.Equals((string?)element.Attribute("Include"), packageId, StringComparison.OrdinalIgnoreCase)).ToArray();
foreach (var duplicate in references.Skip(1)) duplicate.Remove();
if (string.IsNullOrWhiteSpace(version))
{
foreach (var reference in references) reference.Remove();
}
else if (references.Length > 0)
{
var reference = references[0];
if (reference.Attribute("VersionOverride") != null)
reference.SetAttributeValue("VersionOverride", version);
else if (reference.Attribute("Version") != null)
reference.SetAttributeValue("Version", version);
else if (reference.Element("Version") != null)
reference.Element("Version")!.Value = version;
else
reference.SetAttributeValue("Version", version);
}
else
{
var group = root.Elements("ItemGroup").FirstOrDefault(element => element.Elements("PackageReference").Any());
if (group == null)
{
group = new XElement("ItemGroup");
root.Add(group);
}
group.Add(new XElement("PackageReference", new XAttribute("Include", packageId), new XAttribute("Version", version)));
}
WriteAtomically(projectPath, document);
}
public static void EnsureShrinkFeed(string nugetConfigPath)
{
XDocument document;
if (File.Exists(nugetConfigPath)) document = XDocument.Load(nugetConfigPath, LoadOptions.PreserveWhitespace);
else document = new XDocument(new XDeclaration("1.0", "utf-8", null), new XElement("configuration"));
var root = document.Root ?? throw new InvalidDataException("NuGet.Config has no root element.");
var sources = root.Element("packageSources");
if (sources == null)
{
sources = new XElement("packageSources");
root.Add(sources);
}
var existing = sources.Elements("add").FirstOrDefault(element =>
string.Equals((string?)element.Attribute("key"), "ShrinkSDK", StringComparison.OrdinalIgnoreCase));
if (existing == null)
sources.Add(new XElement("add", new XAttribute("key", "ShrinkSDK"),
new XAttribute("value", "https://git.crash.work/api/packages/ShrinkSDK/nuget/index.json")));
else
existing.SetAttributeValue("value", "https://git.crash.work/api/packages/ShrinkSDK/nuget/index.json");
WriteAtomically(nugetConfigPath, document);
}
public static async Task<(int ExitCode, string Output)> RunDotnetAsync(string projectDirectory,
string arguments, CancellationToken cancellationToken = default)
{
var output = new StringBuilder();
using var process = new Process
{
StartInfo = new ProcessStartInfo("dotnet", arguments)
{
WorkingDirectory = projectDirectory,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
process.OutputDataReceived += (_, args) => { if (args.Data != null) output.AppendLine(args.Data); };
process.ErrorDataReceived += (_, args) => { if (args.Data != null) output.AppendLine(args.Data); };
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
await process.WaitForExitAsync(cancellationToken);
return (process.ExitCode, output.ToString());
}
private static void WriteAtomically(string path, XDocument document)
{
Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path))!);
var temporaryPath = path + ".shrinksdk.tmp";
using (var writer = new StreamWriter(temporaryPath, false, new UTF8Encoding(false)))
document.Save(writer, SaveOptions.DisableFormatting);
File.Move(temporaryPath, path, true);
}
}
+7
View File
@@ -0,0 +1,7 @@
[plugin]
name="ShrinkSDK Installer"
description="Installs and diagnoses ShrinkSDK NuGet modules and CodeGen weaving."
author="ShrinkSDK"
version="0.1.1"
script="ShrinkGodotInstallerPlugin.cs"
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="ShrinkSDK" value="https://git.crash.work/api/packages/ShrinkSDK/nuget/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
+32
View File
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 7ce6566e89a950f489641c299d7bd7d6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
+16 -4
View File
@@ -1,19 +1,31 @@
# ShrinkSDK 包管理 # ShrinkSDK 包管理
`com.cneicy.shrink-installer` 是 ShrinkSDK 的固定版本引导包。通过不可变 Git 标签安装后,在 Unity 中打开 `ShrinkSDK/包管理` `com.cneicy.shrink-installer` 是 ShrinkSDK 的固定版本引导包。在 Unity Package Manager 中通过 Git URL 安装后,打开 `ShrinkSDK/包管理`
窗口使用 UI Toolkit 构建,提供: 窗口使用 UI Toolkit 构建,提供:
- 当前项目直接与间接依赖的真实安装状态; - 当前项目直接与间接依赖的真实安装状态;
- 已安装版本与目录固定版本的对比 - 按 SemVer 比较已安装版本与目录固定版本,较新版本不会被误判或降级
-`Context` 组合基础、应用与组合根、独立功能、模块集成、编译工具为层级的全部包列表; -`Context` 组合基础、应用与组合根、独立功能、模块集成、编译工具为层级的全部包列表;
- 基础应用、Context 最小基座、Context 应用宿主、事件与命令、存档、网络、模组开发、常用完整套件八种组合; - 基础应用、Context 最小基座、Context 应用宿主、事件与命令、存档、网络、模组开发、常用完整套件八种组合;
- 保留既有 scoped registry 的安全合并,以及固定版本安装或版本切换。 - 保留既有 scoped registry 的安全合并,以及固定版本安装或版本切换。
安装器只修改 `Packages/manifest.json` 的 registry 与依赖数据,不写认证信息,不复制模板到 `Assets`,也不添加浮动版本。需要 UniTask 的安装入口会同时固定到目录指定的 Git revision。 安装器只修改 `Packages/manifest.json` 的 registry 与依赖数据,不写认证信息,不复制模板到 `Assets`,也不添加浮动版本。需要 UniTask 的安装入口会同时固定到目录指定的 Git revision。
## 引导地址 ## 安装
```text ```text
https://git.crash.work/ShrinkSDK/Installer.git#v0.2.3 https://git.crash.work/ShrinkSDK/Installer.git#main
```
正式项目应在对应版本发布后将 `main` 换成固定 tag。安装完成后等待 Unity 编译,再打开 `ShrinkSDK/包管理`,选择单个模块或推荐组合。
## Godot 4.6 C#
Godot Installer 源码和 NuGet 打包工程位于 `Godot~`。取得 `ShrinkSDK.Godot.Installer 0.1.3` 后,将包内 `contentFiles/any/any/addons/shrinksdk` 复制到 Godot 项目的 `addons/shrinksdk`,再到 `Project > Project Settings > Plugins` 启用 **ShrinkSDK Installer**
Godot 面板直接修改项目 `.csproj``PackageReference`,安全合并项目级 `NuGet.Config`,并可执行 `dotnet restore/build`、显示 CodeGen 织入状态。已安装版本高于目录版本时不会执行降级。
```powershell
dotnet pack .\Godot~\ShrinkSDK.Godot.Installer.csproj -c Release --output .\artifacts
``` ```
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 238fc591f33a45dca54d074857959f87
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a5027bfa9e76434983f82652539bc42a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
{
"name": "ShrinkInstaller.Editor.Tests",
"rootNamespace": "ShrinkSDK.Installer.Tests",
"references": [
"ShrinkInstaller.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false,
"optionalUnityReferences": [
"TestAssemblies"
]
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 00a17f283465481592e764466d9c980d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+22
View File
@@ -0,0 +1,22 @@
#nullable enable
using NUnit.Framework;
namespace ShrinkSDK.Installer.Tests
{
public sealed class ShrinkPackageVersionTests
{
[TestCase("1.10.0", "1.9.0", ShrinkPackageVersionRelation.Newer)]
[TestCase("2.1.0", "2.1.0", ShrinkPackageVersionRelation.Equal)]
[TestCase("2.0.9", "2.1.0", ShrinkPackageVersionRelation.Older)]
[TestCase("1.0.0", "1.0.0-preview.9", ShrinkPackageVersionRelation.Newer)]
[TestCase("1.0.0-preview.10", "1.0.0-preview.2", ShrinkPackageVersionRelation.Newer)]
[TestCase("1.0.0+build.2", "1.0.0+build.1", ShrinkPackageVersionRelation.Equal)]
[TestCase("git+https://example.invalid/package", "1.0.0", ShrinkPackageVersionRelation.Unknown)]
public void Classify_UsesSemanticVersionOrdering(string installed, string target,
ShrinkPackageVersionRelation expected)
{
Assert.AreEqual(expected, ShrinkPackageVersion.Classify(installed, target));
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9152d73a7f3141429d048528d92b1ecf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "com.cneicy.shrink-installer", "name": "com.cneicy.shrink-installer",
"version": "0.2.3", "version": "0.2.6",
"displayName": "ShrinkSDK 包管理", "displayName": "ShrinkSDK 包管理",
"description": "基于 UI Toolkit 的 ShrinkSDK 固定版本包管理器,提供安装状态、Context 分层与推荐组合。", "description": "基于 UI Toolkit 的 ShrinkSDK 固定版本包管理器,提供安装状态、Context 分层与推荐组合。",
"unity": "2022.3", "unity": "2022.3",