mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-26 10:00:23 +00:00
Compare commits
4 Commits
master
...
711668459c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
711668459c | ||
|
|
16895054f1 | ||
|
|
d3e71502d6 | ||
|
|
63708841f5 |
4
.github/dependabot.yaml
vendored
4
.github/dependabot.yaml
vendored
@@ -5,10 +5,6 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly" # Check for updates to GitHub Actions every week
|
||||
groups:
|
||||
dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
cooldown:
|
||||
default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact.
|
||||
ignore:
|
||||
|
||||
34
.github/workflows/build-release.yaml
vendored
34
.github/workflows/build-release.yaml
vendored
@@ -35,10 +35,10 @@ jobs:
|
||||
with:
|
||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||
# build and pack nuget (.nupkg and .symbols.nupkg will be created)
|
||||
# build and pack
|
||||
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
|
||||
- run: dotnet test -c Release --no-build
|
||||
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -p:IncludeSymbols=true -o ./publish
|
||||
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
|
||||
# Store artifacts.
|
||||
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
|
||||
with:
|
||||
@@ -96,48 +96,24 @@ jobs:
|
||||
path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage
|
||||
retention-days: 1
|
||||
|
||||
# publish
|
||||
publish:
|
||||
name: "Publish NuGet packages"
|
||||
needs: [build-dotnet, build-unity]
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # required for NuGet Trusted Publish
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||
- uses: Cysharp/Actions/.github/actions/download-artifact@main
|
||||
# push nuget
|
||||
- name: NuGet login (OIDC)
|
||||
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
|
||||
id: login
|
||||
with:
|
||||
user: ${{ secrets.NUGET_USER }}
|
||||
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
|
||||
if: ${{ !inputs.dry-run }}
|
||||
env:
|
||||
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
|
||||
|
||||
# release
|
||||
create-release:
|
||||
needs: [update-packagejson, publish]
|
||||
needs: [update-packagejson, build-dotnet, build-unity]
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write # required for NuGet Trusted Publish
|
||||
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
|
||||
with:
|
||||
commit-id: ${{ needs.update-packagejson.outputs.sha }}
|
||||
dry-run: ${{ inputs.dry-run }}
|
||||
tag: ${{ inputs.tag }}
|
||||
nuget-push: false
|
||||
nuget-push: true
|
||||
release-upload: true
|
||||
release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage
|
||||
secrets: inherit
|
||||
|
||||
cleanup:
|
||||
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
|
||||
needs: [update-packagejson, create-release]
|
||||
needs: [update-packagejson, build-dotnet, build-unity]
|
||||
permissions:
|
||||
contents: write
|
||||
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
|
||||
|
||||
@@ -10,11 +10,6 @@ using UnityEditor.IMGUI.Controls;
|
||||
using Cysharp.Threading.Tasks.Internal;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
#if UNITY_6000_2_OR_NEWER
|
||||
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
|
||||
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
|
||||
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
|
||||
#endif
|
||||
|
||||
namespace Cysharp.Threading.Tasks.Editor
|
||||
{
|
||||
@@ -184,3 +179,4 @@ namespace Cysharp.Threading.Tasks.Editor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,13 @@ namespace Cysharp.Threading.Tasks
|
||||
return (UniTask.FromCanceled(cancellationToken), default(CancellationTokenRegistration));
|
||||
}
|
||||
|
||||
var promise = new UniTaskCompletionSource();
|
||||
var promise = AutoResetUniTaskCompletionSource.Create();
|
||||
return (promise.Task, cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationTokenCallback, promise));
|
||||
}
|
||||
|
||||
static void Callback(object state)
|
||||
{
|
||||
var promise = (UniTaskCompletionSource)state;
|
||||
var promise = (AutoResetUniTaskCompletionSource)state;
|
||||
promise.TrySetResult();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
readonly Queue<T> items;
|
||||
readonly SingleConsumerUnboundedChannelReader readerSource;
|
||||
UniTaskCompletionSource completedTaskSource;
|
||||
AutoResetUniTaskCompletionSource completedTaskSource;
|
||||
UniTask completedTask;
|
||||
|
||||
Exception completionError;
|
||||
@@ -208,7 +208,7 @@ namespace Cysharp.Threading.Tasks
|
||||
return parent.completedTask;
|
||||
}
|
||||
|
||||
parent.completedTaskSource = new UniTaskCompletionSource();
|
||||
parent.completedTaskSource = AutoResetUniTaskCompletionSource.Create();
|
||||
return parent.completedTaskSource.Task;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace Cysharp.Threading.Tasks.Linq
|
||||
|
||||
public UniTask<bool> MoveNextAsync()
|
||||
{
|
||||
var tcs = new UniTaskCompletionSource<bool>();
|
||||
var tcs = AutoResetUniTaskCompletionSource<bool>.Create();
|
||||
|
||||
cancellationToken.Register(state =>
|
||||
{
|
||||
var task = (UniTaskCompletionSource<bool>)state;
|
||||
var task = (AutoResetUniTaskCompletionSource<bool>)state;
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
}, tcs);
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace Cysharp.Threading.Tasks
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
/// <summary>This CancellationToken is canceled when the GameObject will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject)
|
||||
{
|
||||
return gameObject.GetAsyncDestroyTrigger().CancellationToken;
|
||||
}
|
||||
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
/// <summary>This CancellationToken is canceled when the Component will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this Component component)
|
||||
{
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace Cysharp.Threading.Tasks
|
||||
/// </summary>
|
||||
public static UniTask<T> AsUniTask<T>(this Task<T> task, bool useCurrentSynchronizationContext = true)
|
||||
{
|
||||
var promise = new UniTaskCompletionSource<T>();
|
||||
var promise = AutoResetUniTaskCompletionSource<T>.Create();
|
||||
|
||||
task.ContinueWith((x, state) =>
|
||||
{
|
||||
var p = (UniTaskCompletionSource<T>)state;
|
||||
var p = (AutoResetUniTaskCompletionSource<T>)state;
|
||||
|
||||
switch (x.Status)
|
||||
{
|
||||
@@ -46,11 +46,11 @@ namespace Cysharp.Threading.Tasks
|
||||
/// </summary>
|
||||
public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true)
|
||||
{
|
||||
var promise = new UniTaskCompletionSource();
|
||||
var promise = AutoResetUniTaskCompletionSource.Create();
|
||||
|
||||
task.ContinueWith((x, state) =>
|
||||
{
|
||||
var p = (UniTaskCompletionSource)state;
|
||||
var p = (AutoResetUniTaskCompletionSource)state;
|
||||
|
||||
switch (x.Status)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
public static UniTask<T> ToUniTask<T>(this IObservable<T> source, bool useFirstValue = false, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var promise = new UniTaskCompletionSource<T>();
|
||||
var promise = AutoResetUniTaskCompletionSource<T>.Create();
|
||||
var disposable = new SingleAssignmentDisposable();
|
||||
|
||||
var observer = useFirstValue
|
||||
@@ -109,7 +109,7 @@ namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
static readonly Action<object> callback = OnCanceled;
|
||||
|
||||
readonly UniTaskCompletionSource<T> promise;
|
||||
readonly IPromise<T> promise;
|
||||
readonly SingleAssignmentDisposable disposable;
|
||||
readonly CancellationToken cancellationToken;
|
||||
readonly CancellationTokenRegistration registration;
|
||||
@@ -117,7 +117,7 @@ namespace Cysharp.Threading.Tasks
|
||||
bool hasValue;
|
||||
T latestValue;
|
||||
|
||||
public ToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
|
||||
public ToUniTaskObserver(IPromise<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
|
||||
{
|
||||
this.promise = promise;
|
||||
this.disposable = disposable;
|
||||
@@ -180,14 +180,14 @@ namespace Cysharp.Threading.Tasks
|
||||
{
|
||||
static readonly Action<object> callback = OnCanceled;
|
||||
|
||||
readonly UniTaskCompletionSource<T> promise;
|
||||
readonly IPromise<T> promise;
|
||||
readonly SingleAssignmentDisposable disposable;
|
||||
readonly CancellationToken cancellationToken;
|
||||
readonly CancellationTokenRegistration registration;
|
||||
|
||||
bool hasValue;
|
||||
|
||||
public FirstValueToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
|
||||
public FirstValueToUniTaskObserver(IPromise<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
|
||||
{
|
||||
this.promise = promise;
|
||||
this.disposable = disposable;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "com.cysharp.unitask",
|
||||
"displayName": "UniTask",
|
||||
"author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" },
|
||||
"version": "2.5.11",
|
||||
"version": "2.5.10",
|
||||
"unity": "2018.4",
|
||||
"description": "Provides an efficient async/await integration to Unity.",
|
||||
"keywords": [ "async/await", "async", "Task", "UniTask" ],
|
||||
|
||||
Reference in New Issue
Block a user