Skip to content

Commit

Permalink
Merge pull request #418 from timcassell/develop
Browse files Browse the repository at this point in the history
v3.0.0 merge to master
  • Loading branch information
timcassell authored Mar 18, 2024
2 parents 3d9d46e + 4d3e64c commit cd28b24
Show file tree
Hide file tree
Showing 401 changed files with 12,077 additions and 32,591 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/csproj-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
config: [Release, Release_NoProgress, Debug, Debug_NoProgress]
config: [Release, Debug]
developerMode: [true, false]

steps:
Expand All @@ -27,7 +27,11 @@ jobs:
with:
global-json-file: global.json

- name: Build
- name: Build Core
run: |
dotnet build -c ${{ matrix.config }} -p:DeveloperMode=${{ matrix.developerMode }}
dotnet build -c ${{ matrix.config }} /p:DeveloperMode=${{ matrix.developerMode }} /p:IsNugetBuild=true
timeout-minutes: 10

- name: Build Analyzer
run: dotnet build ./ProtoPromise.Analyzer/ProtoPromise.Analyzer -c ${{ matrix.config }}
timeout-minutes: 10
6 changes: 1 addition & 5 deletions .github/workflows/dotnet-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
config: [Release, Release_NoProgress, Debug, Debug_NoProgress]
config: [Release, Debug]
objectPooling:
- {
name: Pool_Enabled,
Expand All @@ -40,10 +40,6 @@ jobs:
config: Debug,
objectPooling: { name: Pool_Enabled }
}
- {
config: Debug_NoProgress,
objectPooling: { name: Pool_Enabled }
}

steps:
- name: Checkout
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ jobs:
echo "version ${VERSION} not found in ProtoPromise.csproj"
exit 1
fi
if ! grep -q "<Version>${VERSION}</Version>" ProtoPromiseUnityHelpers/ProtoPromiseUnityHelpers.csproj; then
echo "version ${VERSION} not found in ProtoPromiseUnityHelpers.csproj"
if ! grep -q "<Version>${VERSION}</Version>" ProtoPromise.UnityHelpers/2018.3/ProtoPromise.UnityHelpers.2018.3.csproj; then
echo "version ${VERSION} not found in ProtoPromise.UnityHelpers.2018.3.csproj"
exit 1
fi
if ! grep -q "<Version>${VERSION}</Version>" ProtoPromise.UnityHelpers/2023.1/ProtoPromise.UnityHelpers.2023.1.csproj; then
echo "version ${VERSION} not found in ProtoPromise.UnityHelpers.2023.1.csproj"
exit 1
fi
if ! grep -q "\"version\": \"${VERSION}\"" Package/package.json; then
Expand All @@ -50,8 +54,11 @@ jobs:
- name: Overwrite ProtoPromise nuspec version
run: sed -i "{s/{VERSION}/${{ steps.set_tag.outputs.version }}/g}" ProtoPromise/nuget/ProtoPromise.nuspec

- name: Overwrite ProtoPromiseUnityHelpers nuspec version
run: sed -i "{s/{VERSION}/${{ steps.set_tag.outputs.version }}/g}" ProtoPromiseUnityHelpers/nuget/ProtoPromiseUnityHelpers.nuspec
- name: Overwrite ProtoPromise.UnityHelpers.2018.3 nuspec version
run: sed -i "{s/{VERSION}/${{ steps.set_tag.outputs.version }}/g}" ProtoPromise.UnityHelpers/2018.3/nuget/ProtoPromise.UnityHelpers.2018.3.nuspec

- name: Overwrite ProtoPromise.UnityHelpers.2023.1 nuspec version
run: sed -i "{s/{VERSION}/${{ steps.set_tag.outputs.version }}/g}" ProtoPromise.UnityHelpers/2023.1/nuget/ProtoPromise.UnityHelpers.2023.1.nuspec

- name: Overwrite ProtoPromise nuspec release notes
env:
Expand All @@ -63,7 +70,8 @@ jobs:
- name: Print nuspecs
run: |
cat ProtoPromise/nuget/ProtoPromise.nuspec
cat ProtoPromiseUnityHelpers/nuget/ProtoPromiseUnityHelpers.nuspec
cat ProtoPromise.UnityHelpers/2018.3/nuget/ProtoPromise.UnityHelpers.2018.3.nuspec
cat ProtoPromise.UnityHelpers/2023.1/nuget/ProtoPromise.UnityHelpers.2023.1.nuspec
- name: Setup nuget
uses: nuget/setup-nuget@v1
Expand All @@ -84,15 +92,23 @@ jobs:
- name: Pack ProtoPromise
run: nuget pack ProtoPromise/nuget/ProtoPromise.nuspec

- name: Pack Unity Helpers
run: nuget pack ProtoPromiseUnityHelpers/nuget/ProtoPromiseUnityHelpers.nuspec
- name: Pack Unity Helpers 2018.3
run: nuget pack ProtoPromise.UnityHelpers/2018.3/nuget/ProtoPromise.UnityHelpers.2018.3.nuspec

- name: Pack Unity Helpers 2023.1
run: nuget pack ProtoPromise.UnityHelpers/2023.1/nuget/ProtoPromise.UnityHelpers.2023.1.nuspec

- name: Push ProtoPromise
run: dotnet nuget push ProtoPromise.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

- name: Push Unity Helpers
run: dotnet nuget push ProtoPromiseUnityHelpers.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
- name: Push Unity Helpers 2018.3
run: dotnet nuget push ProtoPromise.UnityHelpers.2018.3.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

- name: Push Unity Helpers 2023.1
run: dotnet nuget push ProtoPromise.UnityHelpers.2023.1.${VERSION}.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
33 changes: 2 additions & 31 deletions .github/workflows/unity-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,12 @@ concurrency:

jobs:
build:
name: Build (${{ matrix.scriptingRuntime.name }}, ${{ matrix.mode.name }}, ${{ matrix.progress.name }})
name: Build ${{ matrix.mode.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
scriptingRuntime:
- {
name: Net3.5,
version: 0,
apiCompatibilityLevel: 2
}
- {
name: Net4.x,
version: 1,
apiCompatibilityLevel: 6
}
mode:
- {
name: Release,
Expand All @@ -40,42 +29,24 @@ jobs:
name: Debug,
symbol: PROTO_PROMISE_DEBUG_ENABLE
}
progress:
- {
name: Progress_Enabled,
symbol: PROTO_PROMISE_PROGRESS_ENABLE
}
- {
name: Progress_Disabled,
symbol: PROTO_PROMISE_PROGRESS_DISABLE
}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Rewrite ProjectSettings
run: |
DefineSymbols="${{ matrix.mode.symbol }};${{ matrix.progress.symbol }}"
DefineSymbols="${{ matrix.mode.symbol }}"
DefineOriginal=" scriptingDefineSymbols: {}"
DefineReplace=" scriptingDefineSymbols: \\n 13: $DefineSymbols"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
RuntimeOriginal=" scriptingRuntimeVersion: 0"
RuntimeReplace=" scriptingRuntimeVersion: ${{ matrix.scriptingRuntime.version }}"
sed -i "{s/$RuntimeOriginal/$RuntimeReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
ApiOriginal=" apiCompatibilityLevel: 2"
ApiReplace=" apiCompatibilityLevel: ${{ matrix.scriptingRuntime.apiCompatibilityLevel }}"
sed -i "{s/$ApiOriginal/$ApiReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
- name: Build Project
uses: game-ci/unity-builder@v3
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_2018_4_36F1_UBUNTU }}
with:
projectPath: ProtoPromise_Unity
targetPlatform: WebGL
buildMethod: UnityBuilderAction.BuildScript.Build
allowDirtyBuild: true
timeout-minutes: 90
71 changes: 10 additions & 61 deletions .github/workflows/unity-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
unity-tests:
name: Test (${{ matrix.testMode.name }}, ${{ matrix.scriptingRuntime.name }}, ${{ matrix.mode.name }}, ${{ matrix.progress.name }}, ${{ matrix.objectPooling.name }}, ${{ matrix.unityVersion }}, ${{ matrix.devMode.name }})
name: Test (${{ matrix.testMode.name }}, ${{ matrix.mode.name }}, ${{ matrix.objectPooling.name }}, ${{ matrix.unityVersion }})
runs-on: ubuntu-latest

strategy:
Expand All @@ -31,17 +31,6 @@ jobs:
# value: WebGL,
# buildTargetId: 13
# }
scriptingRuntime:
- {
name: Net3.5,
version: 0,
apiCompatibilityLevel: 2,
}
- {
name: Net4.x,
version: 1,
apiCompatibilityLevel: 6
}
mode:
- {
name: Release,
Expand All @@ -51,15 +40,6 @@ jobs:
name: Debug,
symbol: PROTO_PROMISE_DEBUG_ENABLE
}
progress:
- {
name: Progress_Enabled,
symbol: PROTO_PROMISE_PROGRESS_ENABLE
}
- {
name: Progress_Disabled,
symbol: PROTO_PROMISE_PROGRESS_DISABLE
}
objectPooling:
- {
name: Pool_Enabled,
Expand All @@ -69,73 +49,42 @@ jobs:
name: Pool_Disabled,
symbol: PROTO_PROMISE_POOL_DISABLE
}
# Editor uses 2018.4 to test Net3.5 and Net4.x.
# Standalone uses 2019.4 and 2021.3 to test IL2CPP with netstandard 2.0 and netstandard2.1.
unityVersion: [2018.4.36f1, 2019.4.40f1, 2021.3.29f1]
devMode:
- {
name: devMode,
symbol: PROTO_PROMISE_DEVELOPER_MODE
}
- {
name: userMode,
symbol: PROTO_PROMISE_DEVELOPER_MODE_DISABLE
}
# Editor uses 2018.4 to test netstandard2.0 in Mono.
# Standalone uses 2019.4 and 2023.1 to test IL2CPP with netstandard2.0 and netstandard2.1.
unityVersion: [2018.4.36f1, 2019.4.40f1, 2023.1.0f1]

exclude:
# DEBUG mode forces pooling disabled.
- {
mode: { name: Debug },
objectPooling: { name: Pool_Enabled }
}
# Editor tests only run in 2018.4 to test Net3.5 and Net4.x.
# Editor tests only run in 2018.4 to keep CI times down.
- {
testMode: { name: Editor },
unityVersion: 2019.4.40f1
}
- {
testMode: { name: Editor },
unityVersion: 2021.3.29f1
unityVersion: 2023.1.0f1
}
# Standalone with IL2CPP can only be built with 2019.4+ (unity-builder docker images constraint), which doesn't support Net3.5.
# Standalone with IL2CPP can only be built with 2019.4+ (unity-builder docker images constraint).
- {
testMode: { name: Standalone },
unityVersion: 2018.4.36f1
}
- {
testMode: { name: Standalone },
scriptingRuntime: { name: Net3.5 }
}
# Only test devMode in Net3.5 in editor, and 2021.3 IL2CPP
- {
devMode: { name: devMode },
testMode: { name: Editor },
scriptingRuntime: { name: Net4.x }
}
- {
devMode: { name: devMode },
unityVersion: 2019.4.40f1
}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Rewrite ProjectSettings
run: |
DefineSymbols="${{ matrix.mode.symbol }};${{ matrix.progress.symbol }};${{ matrix.objectPooling.symbol }};${{ matrix.devMode.symbol }}"
DefineSymbols="${{ matrix.mode.symbol }};${{ matrix.objectPooling.symbol }}"
DefineOriginal=" scriptingDefineSymbols: {}"
DefineReplace=" scriptingDefineSymbols: \\n ${{ matrix.testMode.buildTargetId }}: $DefineSymbols"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
RuntimeOriginal=" scriptingRuntimeVersion: 0"
RuntimeReplace=" scriptingRuntimeVersion: ${{ matrix.scriptingRuntime.version }}"
sed -i "{s/$RuntimeOriginal/$RuntimeReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
ApiOriginal=" apiCompatibilityLevel: 2"
ApiReplace=" apiCompatibilityLevel: ${{ matrix.scriptingRuntime.apiCompatibilityLevel }}"
sed -i "{s/$ApiOriginal/$ApiReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
- name: Run tests
id: tests
uses: game-ci/unity-test-runner@v3
Expand Down Expand Up @@ -174,12 +123,12 @@ jobs:
- uses: dorny/test-reporter@v1
if: always()
with:
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.scriptingRuntime.name }}-${{ matrix.mode.name }}-${{ matrix.progress.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}-${{ matrix.devMode.name }}
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.mode.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}
path: "*_junit.xml"
reporter: java-junit

- uses: actions/upload-artifact@v3
if: always()
with:
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.scriptingRuntime.name }}-${{ matrix.mode.name }}-${{ matrix.progress.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}-${{ matrix.devMode.name }}
name: unity-test-results-${{ matrix.testMode.name }}-${{ matrix.mode.name }}-${{ matrix.objectPooling.name }}-${{ matrix.unityVersion }}
path: artifacts
12 changes: 4 additions & 8 deletions DeveloperNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

Before releasing, test the demo scene in Unity 5.5 to make sure it works (no need to run tests as the test runner didn't exist back then).

Update the version in `ProtoPromise.csproj`, `ProtoPromiseUnityHelpers.csproj`, and `package.json`.
Update the version in `ProtoPromise.csproj`, `ProtoPromise.UnityHelpers/**.csproj`s, and `package.json`.


To create the UnityPackage for releases:

Edit `Packages/README.md` to remove the `## Package Installation` and `## Latest Updates` sections, and other unnecessary information at the top (like benchmark results).

1. Open `ProtoPromise_Unity` in Unity 5.5
1. Open `ProtoPromise_Unity` in Unity 2018.3
2. Copy `Package` folder to `Assets/Plugins/ProtoPromise`
3. Delete `Tests` folder
4. Rename `Samples~` to `Demo`
Expand All @@ -28,8 +26,6 @@ For Unity Asset Store package upload:

Unity version may need to be updated to use the earliest version that the Asset Store Tools supports.

Revert changes to `Packages/README.md`.


For the ProtoPromise.Analyzer package, if changes were made:

Expand All @@ -42,6 +38,6 @@ For the ProtoPromise.Analyzer package, if changes were made:
- Run the `Publish analyzer nuget package` workflow on GitHub with the new version.


For Debugging:
For debugging internal library code:

By default, ProtoPromise types are marked with the `DebuggerNonUserCodeAttribute`, making the debugger skip over the library code instead of stepping into it. To disable this behavior and to get more detailed stack traces, define the compiler symbol `PROTO_PROMISE_DEVELOPER_MODE` in Unity, or change `<DeveloperMode>` to `true` in the non-unity csproj.
By default, ProtoPromise types are marked with the `[DebuggerNonUserCode]` and `[StackTraceHidden]`, making the debugger skip over the library code instead of stepping into it. To disable this behavior and to get more detailed stack traces, define the compiler symbol `PROTO_PROMISE_DEVELOPER_MODE` in Unity, or change `<DeveloperMode>` to `true` in the non-unity csproj.
44 changes: 44 additions & 0 deletions Docs/Changelog/v0.10.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Change Log

## v0.10 - August 21, 2020

API changes:

- Added `Proto.Promises.{CancelationSource, CancelationToken, CancelationRegistration}` structs which can be used for synchronous cancelation callbacks.
- Added optional `CancelationToken` parameter to `Promise.{Then, Catch, CatchCancelation, ContinueWith, Progress, Sequence, NewDeferred}`.
- Added `Promise(<T>).Deferred.New(CancelationToken)` that does the same thing as `Promise.NewDeferred(<T>)(CancelationToken)`.
- Changed Deferreds to structs with an implicit cast to DeferredBase (`DeferredBase.ToDeferred(<T>)()` to cast back explicitly).
- Removed `DeferredBase.Cancel`, replaced with the cancelation token.
- Removed `Promise.{Cancel, ThenDuplicate}`.
- Removed `Proto.Logger`, replaced it with `Promise.Config.WarningHandler`.

Behavior changes:

- Changed `Promise.First` to suppress rejections from any promises passed in that did not result in the rejection of the returned promise.
- Change `Deferred.Reject(null)` to convert to a `NullReferenceException` on any `T`. This means `Promise.Catch<T>` will never give a null value. This more closely matches normal `throw null;` behavior.
- `CancelationSource.Cancel(null)` now converts cancelation to a non-value. This mean if `Promise.ReasonContainer.ValueType` is not null, `Promise.ReasonContainer.Value` is also not null, and if `Promise.ReasonContainer.TryGetValue<T>` succeeds, the value will not be null.
- Removed requirement to include `Proto.Promises.Await` for awaiting promises in an async function.
- Check to make sure `RethrowException` is used properly, change to `InvalidOperationException` if not.

Optimizations:

- Deferreds are now structs, removing the memory overhead of classes.
- Added a static cached `Promise.Canceled()` void in RELEASE mode.
- When canceled, promises are now unlinked from their previous.
- No longer need check if promise is canceled when doing internal operations.
- Removed skipFrame calculations since that's now handled in `Internal.FormatStackTrace` in DEBUG mode.
- Pass by ref to pass large structs around internally more efficiently.
- Changed delegate wrappers to structs and changed internal promises to use generics with constraints to optimize composition (and use less memory in some promise objects).
- `PromiseMethodBuilder` caches `stateMachine.MoveNext` directly instead of lambda capturing.

Misc:

- Removed recursive type definitions so that Unity 2019.1.14 and older on .Net 4.X scripting runtime version will compile.
- Removed PROTO_PROMISE_CANCEL_DISABLE preprocessor checks since cancelations no longer slow down normal execution.
- No longer check for internal promise invoking when accessing `Promise.{RejectException, CancelException}`.
- Consolidated Rejection and Cancelation value container creations. Handle all internal rejection/cancelation types to not wrap them.
- Renamed asmdefs to include Proto in the names. Removed Utilities.asmdef.

Known Issues:

- A `Promise.Progress` callback subscribed to a promise chain where the chain is broken by a cancelation token and continued with `Promise.ContinueWith` reports incorrect progress (introduced in v 0.9 with `Promise.ContinueWith`).
Loading

0 comments on commit cd28b24

Please sign in to comment.