feat: add Godot C# compatibility and shared codegen weaving
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
This commit is contained in:
Submodule Assets/Modules/ShrinkApp.Core updated: eac1fa595b...a5c5a70075
Submodule Assets/Modules/ShrinkApp.Starter.Basic updated: 85b4b591ae...f8906faaec
Submodule Assets/Modules/ShrinkCommand updated: 438cc27213...4ed7a91c79
Submodule Assets/Modules/ShrinkCommand.Integration.App updated: ef07791e2c...57246d5194
Submodule Assets/Modules/ShrinkCommand.Integration.EventBus updated: d94eeaf0e8...53720a3b71
Submodule Assets/Modules/ShrinkCommand.Integration.Network updated: 2c955bcffa...bf315619f0
Submodule Assets/Modules/ShrinkContext.AppAdapter updated: 0d1a7d0fb5...8b3121bc21
Submodule Assets/Modules/ShrinkContext.Core updated: 02a0ece826...a4c78ea7a7
Submodule Assets/Modules/ShrinkDataSaver updated: 1bfb99d4c3...0030f5b794
Submodule Assets/Modules/ShrinkDataSaver.Integration.App updated: 4c83b6ead6...e7da03273e
Submodule Assets/Modules/ShrinkDataSaver.Integration.EventBus updated: 66c70653b1...599b8e34c6
Submodule Assets/Modules/ShrinkEventBus updated: a6011cd01d...8aa4c79604
Submodule Assets/Modules/ShrinkInstaller updated: 012728ffac...2abf367f36
Submodule Assets/Modules/ShrinkModFramework updated: 9755e18087...fea6ec56fc
Submodule Assets/Modules/ShrinkNetwork updated: dd13a01bc9...26241cb534
Submodule Assets/Modules/ShrinkNetwork.Integration.App updated: 68e96edc10...2cd552ef25
Submodule Assets/Modules/ShrinkNetwork.Integration.EventBus updated: 005ebf43cf...eb7fa55656
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10936b7d408f403449df0946277a2d00
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdcff332146fc1d439fc0c82285637da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "ShrinkRuntime.Abstractions",
|
||||
"rootNamespace": "ShrinkSDK.Runtime",
|
||||
"autoReferenced": true
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9285a23e48a9fd04ea5d3a7507010d2b
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,127 @@
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShrinkSDK.Runtime
|
||||
{
|
||||
public enum ShrinkLogLevel { Trace, Debug, Information, Warning, Error }
|
||||
|
||||
public interface IShrinkLogger
|
||||
{
|
||||
void Log(ShrinkLogLevel level, string message, Exception? exception = null);
|
||||
}
|
||||
|
||||
public interface IShrinkMainThreadDispatcher
|
||||
{
|
||||
bool IsMainThread { get; }
|
||||
bool TryPost(Action action);
|
||||
}
|
||||
|
||||
public interface IShrinkClock
|
||||
{
|
||||
DateTimeOffset UtcNow { get; }
|
||||
double UnscaledTimeSeconds { get; }
|
||||
}
|
||||
|
||||
public interface IShrinkPathProvider
|
||||
{
|
||||
string PersistentDataPath { get; }
|
||||
string TemporaryDataPath { get; }
|
||||
}
|
||||
|
||||
public interface IShrinkScreenshotProvider
|
||||
{
|
||||
ValueTask<byte[]> CapturePngAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
public interface IShrinkApplicationLifecycle
|
||||
{
|
||||
event Action? Paused;
|
||||
event Action? Resumed;
|
||||
event Action? Exiting;
|
||||
}
|
||||
|
||||
public static class ShrinkLoggerExtensions
|
||||
{
|
||||
public static void Error(this IShrinkLogger logger, string message, Exception? exception = null) =>
|
||||
logger.Log(ShrinkLogLevel.Error, message, exception);
|
||||
}
|
||||
|
||||
public static class ShrinkRuntimeServices
|
||||
{
|
||||
private static IShrinkLogger _logger = new ConsoleLogger();
|
||||
private static IShrinkMainThreadDispatcher _dispatcher = new InlineDispatcher();
|
||||
private static IShrinkClock _clock = new SystemClock();
|
||||
private static IShrinkPathProvider _paths = new SystemPaths();
|
||||
|
||||
public static IShrinkLogger Logger => _logger;
|
||||
public static IShrinkMainThreadDispatcher Dispatcher => _dispatcher;
|
||||
public static IShrinkClock Clock => _clock;
|
||||
public static IShrinkPathProvider Paths => _paths;
|
||||
public static IShrinkScreenshotProvider? Screenshots { get; private set; }
|
||||
public static IShrinkApplicationLifecycle? Lifecycle { get; private set; }
|
||||
|
||||
public static void Configure(IShrinkLogger logger, IShrinkMainThreadDispatcher dispatcher,
|
||||
IShrinkClock clock, IShrinkPathProvider paths,
|
||||
IShrinkScreenshotProvider? screenshots = null, IShrinkApplicationLifecycle? lifecycle = null)
|
||||
{
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
|
||||
_clock = clock ?? throw new ArgumentNullException(nameof(clock));
|
||||
_paths = paths ?? throw new ArgumentNullException(nameof(paths));
|
||||
Screenshots = screenshots;
|
||||
Lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
private sealed class ConsoleLogger : IShrinkLogger
|
||||
{
|
||||
public void Log(ShrinkLogLevel level, string message, Exception? exception = null)
|
||||
{
|
||||
Console.WriteLine($"[{level}] {message}");
|
||||
if (exception != null) Console.WriteLine(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class InlineDispatcher : IShrinkMainThreadDispatcher
|
||||
{
|
||||
public bool IsMainThread => true;
|
||||
public bool TryPost(Action action)
|
||||
{
|
||||
if (action == null) return false;
|
||||
action();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class SystemClock : IShrinkClock
|
||||
{
|
||||
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
|
||||
public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
|
||||
public double UnscaledTimeSeconds => _stopwatch.Elapsed.TotalSeconds;
|
||||
}
|
||||
|
||||
private sealed class SystemPaths : IShrinkPathProvider
|
||||
{
|
||||
public string PersistentDataPath => Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ShrinkSDK");
|
||||
public string TemporaryDataPath => Path.GetTempPath();
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public sealed class ShrinkCodeGenWovenAttribute : Attribute
|
||||
{
|
||||
public ShrinkCodeGenWovenAttribute(string weaverVersion, string inputMvid)
|
||||
{
|
||||
WeaverVersion = weaverVersion;
|
||||
InputMvid = inputMvid;
|
||||
}
|
||||
|
||||
public string WeaverVersion { get; }
|
||||
public string InputMvid { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f9b07df5ab1dc345be31f33e94077d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "com.cneicy.shrink-runtime-abstractions",
|
||||
"version": "0.1.0",
|
||||
"displayName": "ShrinkSDK Runtime Abstractions",
|
||||
"description": "Engine-neutral runtime services and CodeGen marker contracts.",
|
||||
"unity": "2022.3"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f07481a8e08f454fa1d85c5afe4c92d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Submodule Assets/Modules/ShrinkShared.CodeGen updated: bfb463e4bc...5fd9b258d7
Submodule Assets/Modules/ShrinkTutorial updated: 46ed178e0b...5d66389bd6
Reference in New Issue
Block a user