Compare commits

..

26 Commits

Author SHA1 Message Date
Ikiru Yoshizaki
e5acc106ee Merge pull request #715 from Cysharp/ci/nuget
ci: use OIDC for NuGet package push authentication
2026-05-20 21:40:43 +09:00
Ikiru Yoshizaki
b0d26bebea ci: add dedicated publish job gated on build and build-unity 2026-05-20 19:38:57 +09:00
Ikiru Yoshizaki
4cfac5c9d2 ci: fix symbol generation options 61d8d3 2026-05-20 18:59:38 +09:00
Ikiru Yoshizaki
37251f09d4 ci: publish symbol files 2026-05-20 18:22:01 +09:00
Ikiru Yoshizaki
a18e8e38da ci: handle SymbolPackageFormat on build 2026-05-20 18:06:57 +09:00
Ikiru Yoshizaki
19b01fe8d6 ci: id-token permission 2026-05-20 16:48:40 +09:00
Ikiru Yoshizaki
a09a450b0f ci: use OIDC for NuGet package push authentication
This updates the build-release workflow to leverage OpenID Connect (OIDC) for authenticating with NuGet.org. The package push operation is now performed directly within the build job, replacing static API key usage with ephemeral credentials for enhanced security.
2026-05-20 16:12:26 +09:00
github-actions[bot]
2e993ff18f chore(automate): Update package.json to 2.5.11
Commit by [GitHub Actions](https://github.com/Cysharp/UniTask/actions/runs/26083685280)
2026-05-19 07:47:19 +00:00
Yoshifumi Kawai
f248391774 Merge pull request #706 from chikacc/master
fix: resolve TreeView deprecation in Unity 6.2+
2026-05-19 16:46:26 +09:00
Chika Chang
0d304f1feb fix: resolve TreeView deprecation in Unity 6.2+ 2026-03-28 15:36:49 +08:00
Ikiru Yoshizaki
a9e27c03d4 chore: add groups for dependabot 2026-02-25 18:03:24 +09:00
Ikiru Yoshizaki
73a63b7f67 Merge pull request #680 from Cysharp/ci/nuget_release
ci: add id-token: write for NuGet Trusted Publish
2025-10-01 16:31:33 +09:00
Ikiru Yoshizaki
30bec5d5c4 ci: add id-token: write for NuGet Trusted Publish 2025-10-01 16:03:54 +09:00
Ikiru Yoshizaki
ec9204d381 Merge pull request #679 from Cysharp/feature/nuget
chore: Specify IsPackable=false on Directory.Build.props, explicitly true for target packages.
2025-09-25 01:12:10 +09:00
Ikiru Yoshizaki
9a6584ff0d chore: Specify IsPackable=false on Directory.Build.props, explicitly true for target packages. 2025-09-24 21:17:25 +09:00
Ikiru Yoshizaki
98538ef7c7 Merge pull request #677 from Cysharp/feature/docs
ci: replace docfx build from container to docfx command
2025-09-13 01:23:03 +09:00
Ikiru Yoshizaki
519590ca6e chore: exclude tests assemblies 2025-09-10 18:38:31 +09:00
Ikiru Yoshizaki
dce4366f3e ci: change docfx target from source code to Unity built assemblies 2025-09-10 18:20:17 +09:00
Ikiru Yoshizaki
88026ab14a ci: replace docfx build from container to docfx command 2025-09-10 17:20:43 +09:00
Ikiru Yoshizaki
95998ff3f2 ci: dependabot cooldown 65d2ae 2025-09-10 12:34:40 +09:00
Ikiru Yoshizaki
64285ae060 Merge pull request #672 from Cysharp/ci/nuget_readme
chore: add README.md to nuget package
2025-08-19 18:37:19 +09:00
Ikiru Yoshizaki
40e020fb02 ci: add dotnet pack and use Release 2025-08-19 17:42:54 +09:00
Ikiru Yoshizaki
e63dba1350 chore: add README.md to nuget package 2025-08-19 17:37:09 +09:00
Ikiru Yoshizaki
f213ff497e ci: missing permission 2025-05-14 15:41:23 +09:00
Ikiru Yoshizaki
7568061eda ci: fix ghalint 2025-05-14 12:39:03 +09:00
Ikiru Yoshizaki
459a572c1d chore: add .editorconfig 2025-05-14 12:38:53 +09:00
28 changed files with 303 additions and 145 deletions

13
.config/dotnet-tools.json Normal file
View File

@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"docfx": {
"version": "2.78.3",
"commands": [
"docfx"
],
"rollForward": false
}
}
}

41
.editorconfig Normal file
View File

@@ -0,0 +1,41 @@
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
# Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022#how-to-customize-the-spell-checker)
spelling_exclusion_path = ./exclusion.dic
[*.cs]
indent_size = 4
charset = utf-8-bom
end_of_line = unset
# Solution files
[*.{sln,slnx}]
end_of_line = unset
# MSBuild project files
[*.{csproj,props,targets}]
end_of_line = unset
# Xml config files
[*.{ruleset,config,nuspec,resx,runsettings,DotSettings}]
end_of_line = unset
[*{_AssemblyInfo.cs,.notsupported.cs}]
generated_code = true
# C# code style settings
[*.{cs}]
dotnet_diagnostic.IDE0044.severity = none # IDE0044: Make field readonly
# https://stackoverflow.com/questions/79195382/how-to-disable-fading-unused-methods-in-visual-studio-2022-17-12-0
dotnet_diagnostic.IDE0051.severity = none # IDE0051: Remove unused private member
dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure

View File

@@ -5,8 +5,14 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" # Check for updates to GitHub Actions every week 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: ignore:
# I just want update action when major/minor version is updated. patch updates are too noisy. # I just want update action when major/minor version is updated. patch updates are too noisy.
- dependency-name: '*' - dependency-name: "*"
update-types: update-types:
- version-update:semver-patch - version-update:semver-patch

View File

@@ -10,13 +10,16 @@ on:
jobs: jobs:
build-dotnet: build-dotnet:
runs-on: ubuntu-latest permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: Cysharp/Actions/.github/actions/checkout@main - uses: Cysharp/Actions/.github/actions/checkout@main
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main - uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: dotnet build -c Debug - run: dotnet build -c Release
- run: dotnet test -c Debug - run: dotnet test -c Release
- run: dotnet pack -c Release --no-build -p:IncludeSymbols=true -o $GITHUB_WORKSPACE/artifacts
build-unity: build-unity:
if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }} if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}
@@ -25,7 +28,9 @@ jobs:
max-parallel: 2 max-parallel: 2
matrix: matrix:
unity: ["2022.3.39f1", "6000.0.12f1"] # Test with LTS unity: ["2022.3.39f1", "6000.0.12f1"] # Test with LTS
runs-on: ubuntu-latest permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 30 # Unity build takes more than 20min. timeout-minutes: 30 # Unity build takes more than 20min.
steps: steps:
- name: Load secrets - name: Load secrets

58
.github/workflows/build-docs.yaml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: build-docs
on:
push:
branches:
- master
- feature/docs
jobs:
run-docfx:
if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}
permissions:
contents: write
pages: write
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username"
UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential"
UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial"
- uses: Cysharp/Actions/.github/actions/checkout@main
# Execute scripts: Export Package
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
- name: Build Unity (.unitypackage)
uses: Cysharp/Actions/.github/actions/unity-builder@main
env:
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
with:
projectPath: src/UniTask
unityVersion: "2022.3.39f1"
targetPlatform: StandaloneLinux64
buildMethod: PackageExporter.Export
- uses: Cysharp/Actions/.github/actions/checkout@main
with:
repository: Cysharp/DocfxTemplate
path: docs/_DocfxTemplate
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- name: dotnet tool restore
run: dotnet tool restore
- name: Docfx metadata
run: dotnet docfx metadata docs/docfx.json
- name: Docfx build
run: dotnet docfx build docs/docfx.json
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site

View File

@@ -1,31 +0,0 @@
name: build-docs
on:
push:
branches:
- master
- feature/docs
jobs:
run-docfx:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: Cysharp/Actions/.github/actions/checkout@main
- uses: Cysharp/Actions/.github/actions/checkout@main
with:
repository: Cysharp/DocfxTemplate
path: docs/_DocfxTemplate
- uses: Kirbyrawr/docfx-action@db9a22c8fe1e8693a2a21be54cb0b87dfaa72cc4
name: Docfx metadata
with:
args: metadata docs/docfx.json
- uses: Kirbyrawr/docfx-action@db9a22c8fe1e8693a2a21be54cb0b87dfaa72cc4
name: Docfx build
with:
args: build docs/docfx.json
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site

View File

@@ -14,6 +14,9 @@ on:
jobs: jobs:
update-packagejson: update-packagejson:
permissions:
actions: read
contents: write
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
with: with:
file-path: ./src/UniTask/Assets/Plugins/UniTask/package.json file-path: ./src/UniTask/Assets/Plugins/UniTask/package.json
@@ -22,7 +25,9 @@ jobs:
build-dotnet: build-dotnet:
needs: [update-packagejson] needs: [update-packagejson]
runs-on: ubuntu-latest permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }} - run: echo ${{ needs.update-packagejson.outputs.sha }}
@@ -30,10 +35,10 @@ jobs:
with: with:
ref: ${{ needs.update-packagejson.outputs.sha }} ref: ${{ needs.update-packagejson.outputs.sha }}
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main - uses: Cysharp/Actions/.github/actions/setup-dotnet@main
# build and pack # build and pack nuget (.nupkg and .symbols.nupkg will be created)
- run: dotnet build -c Release -p:Version=${{ inputs.tag }} - run: dotnet build -c Release -p:Version=${{ inputs.tag }}
- run: dotnet test -c Release --no-build - run: dotnet test -c Release --no-build
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish - run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ inputs.tag }} -p:IncludeSymbols=true -o ./publish
# Store artifacts. # Store artifacts.
- uses: Cysharp/Actions/.github/actions/upload-artifact@main - uses: Cysharp/Actions/.github/actions/upload-artifact@main
with: with:
@@ -46,7 +51,9 @@ jobs:
strategy: strategy:
matrix: matrix:
unity: ["2022.3.39f1"] unity: ["2022.3.39f1"]
runs-on: ubuntu-latest permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- name: Load secrets - name: Load secrets
@@ -89,22 +96,50 @@ jobs:
path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage
retention-days: 1 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 # release
create-release: create-release:
needs: [update-packagejson, build-dotnet, build-unity] needs: [update-packagejson, publish]
permissions:
contents: write
id-token: write # required for NuGet Trusted Publish
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
with: with:
commit-id: ${{ needs.update-packagejson.outputs.sha }} commit-id: ${{ needs.update-packagejson.outputs.sha }}
dry-run: ${{ inputs.dry-run }} dry-run: ${{ inputs.dry-run }}
tag: ${{ inputs.tag }} tag: ${{ inputs.tag }}
nuget-push: true nuget-push: false
release-upload: true release-upload: true
release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage release-asset-path: ./UniTask.${{ inputs.tag }}.unitypackage/UniTask.${{ inputs.tag }}.unitypackage
secrets: inherit secrets: inherit
cleanup: cleanup:
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
needs: [update-packagejson, build-dotnet, build-unity] needs: [update-packagejson, create-release]
permissions:
contents: write
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
with: with:
branch: ${{ needs.update-packagejson.outputs.branch-name }} branch: ${{ needs.update-packagejson.outputs.branch-name }}

View File

@@ -7,4 +7,6 @@ on:
jobs: jobs:
detect: detect:
permissions:
contents: read
uses: Cysharp/Actions/.github/workflows/prevent-github-change.yaml@main uses: Cysharp/Actions/.github/workflows/prevent-github-change.yaml@main

View File

@@ -7,4 +7,8 @@ on:
jobs: jobs:
stale: stale:
permissions:
contents: read
pull-requests: write
issues: write
uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main

View File

@@ -6,8 +6,9 @@ on:
- 'README.md' - 'README.md'
jobs: jobs:
generateTOC: toc:
name: TOC Generator permissions:
contents: write
uses: Cysharp/Actions/.github/workflows/toc-generator.yaml@main uses: Cysharp/Actions/.github/workflows/toc-generator.yaml@main
with: with:
TOC_TITLE: "## Table of Contents" TOC_TITLE: "## Table of Contents"

14
.gitignore vendored
View File

@@ -100,7 +100,19 @@ publish
*.Publish.xml *.Publish.xml
# NuGet Packages Directory # NuGet Packages Directory
packages *.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
# packages # upm pacakge will use Packages
# **/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
# !**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Windows Azure Build Output # Windows Azure Build Output
csx csx

27
Directory.Build.props Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)opensource.snk</AssemblyOriginatorKeyFile>
<!-- NuGet Package Information -->
<IsPackable>false</IsPackable>
<PackageVersion>$(Version)</PackageVersion>
<Company>Cysharp</Company>
<Authors>Cysharp</Authors>
<Copyright>© Cysharp, Inc.</Copyright>
<PackageTags>task;async</PackageTags>
<PackageProjectUrl>https://github.com/Cysharp/UniTask</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>$(PackageProjectUrl)</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>Icon.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Icon.png" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)LICENSE" />
</ItemGroup>
</Project>

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -4,7 +4,11 @@
"src": [ "src": [
{ {
"files": [ "files": [
"UniTask/Assets/Plugins/UniTask/Runtime/**/*.cs" "UniTask/Library/ScriptAssemblies/UniTask*.dll"
],
"exclude": [
"UniTask/Library/ScriptAssemblies/UniTask.Tests.dll",
"UniTask/Library/ScriptAssemblies/UniTask.Tests.Editor.dll"
], ],
"src": "../src" "src": "../src"
} }
@@ -54,7 +58,6 @@
} }
], ],
"dest": "_site", "dest": "_site",
"globalMetadataFiles": [], "globalMetadataFiles": [],
"fileMetadataFiles": [], "fileMetadataFiles": [],
"template": [ "template": [
@@ -67,4 +70,4 @@
"keepFileLink": false, "keepFileLink": false,
"cleanupCacheHistory": false "cleanupCacheHistory": false
} }
} }

View File

@@ -1,29 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>library</OutputType> <OutputType>library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsRoslynComponent>true</IsRoslynComponent> <IsRoslynComponent>true</IsRoslynComponent>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage> <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
<IncludeBuildOutput>false</IncludeBuildOutput> <IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols> <IncludeSymbols>false</IncludeSymbols>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<DevelopmentDependency>true</DevelopmentDependency> <DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
</ItemGroup>
<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup">
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2"> <TfmSpecificPackageFile Include="$(TargetDir)\*.dll" PackagePath="analyzers\dotnet\cs" />
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <TfmSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')" PackagePath="analyzers\dotnet\cs\%(SatelliteDllsProjectOutputGroupOutput.Culture)\" />
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
</ItemGroup> </ItemGroup>
</Target>
<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup"> </Project>
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetDir)\*.dll" PackagePath="analyzers\dotnet\cs" />
<TfmSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')" PackagePath="analyzers\dotnet\cs\%(SatelliteDllsProjectOutputGroupOutput.Culture)\" />
</ItemGroup>
</Target>
</Project>

View File

@@ -1,43 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net7.0;netstandard2.1;netstandard2.0</TargetFrameworks> <TargetFrameworks>net6.0;net7.0;netstandard2.1;netstandard2.0</TargetFrameworks>
<AssemblyName>UniTask</AssemblyName> <AssemblyName>UniTask</AssemblyName>
<LangVersion>8.0</LangVersion> <LangVersion>8.0</LangVersion>
<RootNamespace>Cysharp.Threading.Tasks</RootNamespace> <RootNamespace>Cysharp.Threading.Tasks</RootNamespace>
<DefineConstants>UNITASK_NETCORE</DefineConstants> <DefineConstants>UNITASK_NETCORE</DefineConstants>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- NuGet Packaging --> <!-- NuGet Packaging -->
<Id>UniTask</Id> <IsPackable>true</IsPackable>
<PackageVersion>$(Version)</PackageVersion> <Id>UniTask</Id>
<Company>Cysharp</Company> <Description>Provides an efficient async/await integration to Unity and .NET Core.</Description>
<Authors>Cysharp</Authors> </PropertyGroup>
<Copyright>© Cysharp, Inc.</Copyright>
<PackageTags>task;async</PackageTags>
<Description>Provides an efficient async/await integration to Unity and .NET Core.</Description>
<PackageProjectUrl>https://github.com/Cysharp/UniTask</PackageProjectUrl>
<RepositoryUrl>$(PackageProjectUrl)</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>Icon.png</PackageIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>opensource.snk</AssemblyOriginatorKeyFile>
<IsPackable>true</IsPackable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="Icon.png" Pack="true" PackagePath="/" /> <Compile Include="..\UniTask\Assets\Plugins\UniTask\Runtime\**\*.cs" Exclude="&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Editor\*.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Triggers\*.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Linq\UnityExtensions\*.cs;&#xD;&#xA; &#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs;&#xD;&#xA; &#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\TimeoutController.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopTimer.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.*;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs;&#xD;&#xA;" />
</ItemGroup> <Compile Remove="..\UniTask\Assets\Plugins\UniTask\Runtime\_InternalVisibleTo.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\UniTask\Assets\Plugins\UniTask\Runtime\**\*.cs" Exclude="&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Editor\*.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Triggers\*.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Linq\UnityExtensions\*.cs;&#xD;&#xA; &#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs;&#xD;&#xA; &#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\TimeoutController.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopTimer.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.*;&#xD;&#xA;..\UniTask\Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs;&#xD;&#xA;" /> <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<Compile Remove="..\UniTask\Assets\Plugins\UniTask\Runtime\_InternalVisibleTo.cs" /> </ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
</Project> </Project>

View File

@@ -4,7 +4,6 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RootNamespace>NetCoreSandbox</RootNamespace> <RootNamespace>NetCoreSandbox</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -16,12 +15,10 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\UniTask.NetCore\UniTask.NetCore.csproj" /> <ProjectReference Include="..\UniTask.NetCore\UniTask.NetCore.csproj" />
<ProjectReference Include="..\UniTask.Analyzer\UniTask.Analyzer.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<ProjectReference Include="..\UniTask.Analyzer\UniTask.Analyzer.csproj"> <OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference>
<OutputItemType>Analyzer</OutputItemType>
</ProjectReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -2,9 +2,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>NetCoreTests</RootNamespace> <RootNamespace>NetCoreTests</RootNamespace>
</PropertyGroup> </PropertyGroup>

View File

@@ -10,6 +10,11 @@ using UnityEditor.IMGUI.Controls;
using Cysharp.Threading.Tasks.Internal; using Cysharp.Threading.Tasks.Internal;
using System.Text; using System.Text;
using System.Text.RegularExpressions; 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 namespace Cysharp.Threading.Tasks.Editor
{ {
@@ -179,4 +184,3 @@ namespace Cysharp.Threading.Tasks.Editor
} }
} }

View File

@@ -10,7 +10,7 @@ namespace Cysharp.Threading.Tasks
static Action<object> continuation = SetCompletionSource; static Action<object> continuation = SetCompletionSource;
Func<UniTask> taskFactory; Func<UniTask> taskFactory;
AutoResetUniTaskCompletionSource completionSource; UniTaskCompletionSource completionSource;
UniTask.Awaiter awaiter; UniTask.Awaiter awaiter;
object syncLock; object syncLock;
@@ -19,7 +19,7 @@ namespace Cysharp.Threading.Tasks
public AsyncLazy(Func<UniTask> taskFactory) public AsyncLazy(Func<UniTask> taskFactory)
{ {
this.taskFactory = taskFactory; this.taskFactory = taskFactory;
this.completionSource = AutoResetUniTaskCompletionSource.Create(); this.completionSource = new UniTaskCompletionSource();
this.syncLock = new object(); this.syncLock = new object();
this.initialized = false; this.initialized = false;
} }
@@ -27,7 +27,7 @@ namespace Cysharp.Threading.Tasks
internal AsyncLazy(UniTask task) internal AsyncLazy(UniTask task)
{ {
this.taskFactory = null; this.taskFactory = null;
this.completionSource = AutoResetUniTaskCompletionSource.Create(); this.completionSource = new UniTaskCompletionSource();
this.syncLock = null; this.syncLock = null;
this.initialized = true; this.initialized = true;
@@ -129,7 +129,7 @@ namespace Cysharp.Threading.Tasks
static Action<object> continuation = SetCompletionSource; static Action<object> continuation = SetCompletionSource;
Func<UniTask<T>> taskFactory; Func<UniTask<T>> taskFactory;
AutoResetUniTaskCompletionSource<T> completionSource; UniTaskCompletionSource<T> completionSource;
UniTask<T>.Awaiter awaiter; UniTask<T>.Awaiter awaiter;
object syncLock; object syncLock;
@@ -138,7 +138,7 @@ namespace Cysharp.Threading.Tasks
public AsyncLazy(Func<UniTask<T>> taskFactory) public AsyncLazy(Func<UniTask<T>> taskFactory)
{ {
this.taskFactory = taskFactory; this.taskFactory = taskFactory;
this.completionSource = AutoResetUniTaskCompletionSource<T>.Create(); this.completionSource = new UniTaskCompletionSource<T>();
this.syncLock = new object(); this.syncLock = new object();
this.initialized = false; this.initialized = false;
} }
@@ -146,7 +146,7 @@ namespace Cysharp.Threading.Tasks
internal AsyncLazy(UniTask<T> task) internal AsyncLazy(UniTask<T> task)
{ {
this.taskFactory = null; this.taskFactory = null;
this.completionSource = AutoResetUniTaskCompletionSource<T>.Create(); this.completionSource = new UniTaskCompletionSource<T>();
this.syncLock = null; this.syncLock = null;
this.initialized = true; this.initialized = true;

View File

@@ -67,13 +67,13 @@ namespace Cysharp.Threading.Tasks
return (UniTask.FromCanceled(cancellationToken), default(CancellationTokenRegistration)); return (UniTask.FromCanceled(cancellationToken), default(CancellationTokenRegistration));
} }
var promise = AutoResetUniTaskCompletionSource.Create(); var promise = new UniTaskCompletionSource();
return (promise.Task, cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationTokenCallback, promise)); return (promise.Task, cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationTokenCallback, promise));
} }
static void Callback(object state) static void Callback(object state)
{ {
var promise = (AutoResetUniTaskCompletionSource)state; var promise = (UniTaskCompletionSource)state;
promise.TrySetResult(); promise.TrySetResult();
} }

View File

@@ -91,7 +91,7 @@ namespace Cysharp.Threading.Tasks
{ {
readonly Queue<T> items; readonly Queue<T> items;
readonly SingleConsumerUnboundedChannelReader readerSource; readonly SingleConsumerUnboundedChannelReader readerSource;
AutoResetUniTaskCompletionSource completedTaskSource; UniTaskCompletionSource completedTaskSource;
UniTask completedTask; UniTask completedTask;
Exception completionError; Exception completionError;
@@ -208,7 +208,7 @@ namespace Cysharp.Threading.Tasks
return parent.completedTask; return parent.completedTask;
} }
parent.completedTaskSource = AutoResetUniTaskCompletionSource.Create(); parent.completedTaskSource = new UniTaskCompletionSource();
return parent.completedTaskSource.Task; return parent.completedTaskSource.Task;
} }
} }

View File

@@ -36,11 +36,11 @@ namespace Cysharp.Threading.Tasks.Linq
public UniTask<bool> MoveNextAsync() public UniTask<bool> MoveNextAsync()
{ {
var tcs = AutoResetUniTaskCompletionSource<bool>.Create(); var tcs = new UniTaskCompletionSource<bool>();
cancellationToken.Register(state => cancellationToken.Register(state =>
{ {
var task = (AutoResetUniTaskCompletionSource<bool>)state; var task = (UniTaskCompletionSource<bool>)state;
task.TrySetCanceled(cancellationToken); task.TrySetCanceled(cancellationToken);
}, tcs); }, tcs);

View File

@@ -18,13 +18,13 @@ namespace Cysharp.Threading.Tasks
#endif #endif
/// <summary>This CancellationToken is canceled when the GameObject will be destroyed.</summary> /// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject) public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject)
{ {
return gameObject.GetAsyncDestroyTrigger().CancellationToken; return gameObject.GetAsyncDestroyTrigger().CancellationToken;
} }
/// <summary>This CancellationToken is canceled when the Component will be destroyed.</summary> /// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
public static CancellationToken GetCancellationTokenOnDestroy(this Component component) public static CancellationToken GetCancellationTokenOnDestroy(this Component component)
{ {
#if UNITY_2022_2_OR_NEWER #if UNITY_2022_2_OR_NEWER

View File

@@ -16,11 +16,11 @@ namespace Cysharp.Threading.Tasks
/// </summary> /// </summary>
public static UniTask<T> AsUniTask<T>(this Task<T> task, bool useCurrentSynchronizationContext = true) public static UniTask<T> AsUniTask<T>(this Task<T> task, bool useCurrentSynchronizationContext = true)
{ {
var promise = AutoResetUniTaskCompletionSource<T>.Create(); var promise = new UniTaskCompletionSource<T>();
task.ContinueWith((x, state) => task.ContinueWith((x, state) =>
{ {
var p = (AutoResetUniTaskCompletionSource<T>)state; var p = (UniTaskCompletionSource<T>)state;
switch (x.Status) switch (x.Status)
{ {
@@ -46,11 +46,11 @@ namespace Cysharp.Threading.Tasks
/// </summary> /// </summary>
public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true) public static UniTask AsUniTask(this Task task, bool useCurrentSynchronizationContext = true)
{ {
var promise = AutoResetUniTaskCompletionSource.Create(); var promise = new UniTaskCompletionSource();
task.ContinueWith((x, state) => task.ContinueWith((x, state) =>
{ {
var p = (AutoResetUniTaskCompletionSource)state; var p = (UniTaskCompletionSource)state;
switch (x.Status) switch (x.Status)
{ {

View File

@@ -11,7 +11,7 @@ namespace Cysharp.Threading.Tasks
{ {
public static UniTask<T> ToUniTask<T>(this IObservable<T> source, bool useFirstValue = false, CancellationToken cancellationToken = default) public static UniTask<T> ToUniTask<T>(this IObservable<T> source, bool useFirstValue = false, CancellationToken cancellationToken = default)
{ {
var promise = AutoResetUniTaskCompletionSource<T>.Create(); var promise = new UniTaskCompletionSource<T>();
var disposable = new SingleAssignmentDisposable(); var disposable = new SingleAssignmentDisposable();
var observer = useFirstValue var observer = useFirstValue
@@ -109,7 +109,7 @@ namespace Cysharp.Threading.Tasks
{ {
static readonly Action<object> callback = OnCanceled; static readonly Action<object> callback = OnCanceled;
readonly IPromise<T> promise; readonly UniTaskCompletionSource<T> promise;
readonly SingleAssignmentDisposable disposable; readonly SingleAssignmentDisposable disposable;
readonly CancellationToken cancellationToken; readonly CancellationToken cancellationToken;
readonly CancellationTokenRegistration registration; readonly CancellationTokenRegistration registration;
@@ -117,7 +117,7 @@ namespace Cysharp.Threading.Tasks
bool hasValue; bool hasValue;
T latestValue; T latestValue;
public ToUniTaskObserver(IPromise<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken) public ToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
{ {
this.promise = promise; this.promise = promise;
this.disposable = disposable; this.disposable = disposable;
@@ -180,14 +180,14 @@ namespace Cysharp.Threading.Tasks
{ {
static readonly Action<object> callback = OnCanceled; static readonly Action<object> callback = OnCanceled;
readonly IPromise<T> promise; readonly UniTaskCompletionSource<T> promise;
readonly SingleAssignmentDisposable disposable; readonly SingleAssignmentDisposable disposable;
readonly CancellationToken cancellationToken; readonly CancellationToken cancellationToken;
readonly CancellationTokenRegistration registration; readonly CancellationTokenRegistration registration;
bool hasValue; bool hasValue;
public FirstValueToUniTaskObserver(IPromise<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken) public FirstValueToUniTaskObserver(UniTaskCompletionSource<T> promise, SingleAssignmentDisposable disposable, CancellationToken cancellationToken)
{ {
this.promise = promise; this.promise = promise;
this.disposable = disposable; this.disposable = disposable;

View File

@@ -2,7 +2,7 @@
"name": "com.cysharp.unitask", "name": "com.cysharp.unitask",
"displayName": "UniTask", "displayName": "UniTask",
"author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" }, "author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" },
"version": "2.5.10", "version": "2.5.11",
"unity": "2018.4", "unity": "2018.4",
"description": "Provides an efficient async/await integration to Unity.", "description": "Provides an efficient async/await integration to Unity.",
"keywords": [ "async/await", "async", "Task", "UniTask" ], "keywords": [ "async/await", "async", "Task", "UniTask" ],