Skip to content

Commit 1c74e3d

Browse files
authored
Merge pull request #321 from DuendeSoftware/dh/vendor-razor-slices
Add Duende.RazorSlices component (vendored from DamianEdwards/RazorSlices)
2 parents c3b1d09 + 6580e8c commit 1c74e3d

169 files changed

Lines changed: 87662 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflow-gen/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
"ecm",
4848
[GitHubHostedRunners.UbuntuLatest],
4949
["net10.0"]),
50+
51+
new("razor-slices",
52+
["RazorSlices"],
53+
["RazorSlices.Tests", "SourceGenerator.Tests"],
54+
"rs",
55+
[GitHubHostedRunners.UbuntuLatest],
56+
["net10.0"]),
5057
];
5158

5259
foreach (var component in components)

.github/workflows/generate-test-reports.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'identity-model-oidc-client/ci'
1111
- 'introspection/ci'
1212
- 'memory-cache/ci'
13+
- 'razor-slices/ci'
1314
types:
1415
- completed
1516
jobs:
@@ -82,3 +83,23 @@ jobs:
8283
reporter: dotnet-trx
8384
fail-on-error: true
8485
fail-on-empty: true
86+
- name: Test report - razor-slices - RazorSlices.Tests-net10.0
87+
if: github.event.workflow.name == 'razor-slices/ci'
88+
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
89+
with:
90+
artifact: test-results
91+
name: Test Report - RazorSlices.Tests-net10.0
92+
path: RazorSlices.Tests-net10.0.trx
93+
reporter: dotnet-trx
94+
fail-on-error: true
95+
fail-on-empty: true
96+
- name: Test report - razor-slices - SourceGenerator.Tests-net10.0
97+
if: github.event.workflow.name == 'razor-slices/ci'
98+
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
99+
with:
100+
artifact: test-results
101+
name: Test Report - SourceGenerator.Tests-net10.0
102+
path: SourceGenerator.Tests-net10.0.trx
103+
reporter: dotnet-trx
104+
fail-on-error: true
105+
fail-on-empty: true
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# This was generated by tool. Edits will be overwritten.
2+
3+
name: razor-slices/ci
4+
on:
5+
workflow_dispatch:
6+
push:
7+
paths:
8+
- .github/workflows/razor-slices-**
9+
- razor-slices/**
10+
- .editorconfig
11+
- Directory.Packages.props
12+
- global.json
13+
- src.props
14+
- test.props
15+
pull_request:
16+
paths:
17+
- .github/workflows/razor-slices-**
18+
- razor-slices/**
19+
- .editorconfig
20+
- Directory.Packages.props
21+
- global.json
22+
- src.props
23+
- test.props
24+
env:
25+
DOTNET_NOLOGO: true
26+
DOTNET_CLI_TELEMETRY_OPTOUT: true
27+
jobs:
28+
build:
29+
name: Build
30+
runs-on: ubuntu-latest
31+
permissions:
32+
actions: read
33+
checks: write
34+
contents: read
35+
packages: write
36+
defaults:
37+
run:
38+
shell: bash
39+
working-directory: razor-slices
40+
timeout-minutes: 15
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
44+
with:
45+
fetch-depth: 0
46+
- name: Setup Dotnet
47+
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d
48+
with:
49+
dotnet-version: 10.0.100
50+
- name: Restore
51+
run: dotnet restore *.slnf
52+
- name: Verify Formatting
53+
run: dotnet format *.slnf --verify-no-changes --no-restore
54+
- name: Build - RazorSlices.Tests
55+
run: dotnet build -c Release test/RazorSlices.Tests
56+
- name: Test - RazorSlices.Tests
57+
run: >-
58+
for tfm in net10.0; do
59+
dotnet run --project test/RazorSlices.Tests -c Release --no-build -f $tfm -- \
60+
--report-xunit-trx --report-xunit-trx-filename RazorSlices.Tests-$tfm.trx \
61+
--coverage --coverage-output-format cobertura \
62+
--coverage-output RazorSlices.Tests-$tfm.cobertura.xml
63+
done
64+
- name: Build - SourceGenerator.Tests
65+
run: dotnet build -c Release test/SourceGenerator.Tests
66+
- name: Test - SourceGenerator.Tests
67+
run: >-
68+
for tfm in net10.0; do
69+
dotnet run --project test/SourceGenerator.Tests -c Release --no-build -f $tfm -- \
70+
--report-xunit-trx --report-xunit-trx-filename SourceGenerator.Tests-$tfm.trx \
71+
--coverage --coverage-output-format cobertura \
72+
--coverage-output SourceGenerator.Tests-$tfm.cobertura.xml
73+
done
74+
- name: Test report
75+
if: success() || failure()
76+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
77+
with:
78+
name: test-results
79+
path: |-
80+
razor-slices/test/RazorSlices.Tests/TestResults/RazorSlices.Tests-net10.0.trx
81+
razor-slices/test/SourceGenerator.Tests/TestResults/SourceGenerator.Tests-net10.0.trx
82+
retention-days: 5
83+
- name: Tool restore
84+
run: dotnet tool restore
85+
- name: Pack RazorSlices
86+
run: dotnet pack -c Release src/RazorSlices -o artifacts
87+
- name: Sign packages
88+
if: github.event_name == 'push'
89+
run: |-
90+
for file in artifacts/*.nupkg; do
91+
dotnet NuGetKeyVaultSignTool sign "$file" --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ --azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 --azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 --azure-key-vault-client-secret ${{ secrets.SignClientSecret }} --azure-key-vault-certificate NuGetPackageSigning
92+
done
93+
- name: Push packages to GitHub
94+
if: github.ref == 'refs/heads/main'
95+
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/DuendeSoftware/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
- name: Upload Artifacts
100+
if: github.event_name == 'push'
101+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
102+
with:
103+
name: artifacts
104+
path: razor-slices/artifacts/*.nupkg
105+
overwrite: true
106+
retention-days: 15
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# This was generated by tool. Edits will be overwritten.
2+
3+
name: razor-slices/release
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N'
9+
type: string
10+
required: true
11+
default: '0.0.0'
12+
branch:
13+
description: '(Optional) the name of the branch to release from'
14+
type: string
15+
required: false
16+
default: 'main'
17+
remove-tag-if-exists:
18+
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
19+
type: boolean
20+
required: false
21+
default: false
22+
env:
23+
DOTNET_NOLOGO: true
24+
DOTNET_CLI_TELEMETRY_OPTOUT: true
25+
jobs:
26+
tag:
27+
name: Tag and Pack
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
packages: write
32+
defaults:
33+
run:
34+
shell: bash
35+
working-directory: razor-slices
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
- name: Validate Version Input
42+
run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1)
43+
- name: Checkout target branch
44+
if: github.event.inputs.branch != 'main'
45+
run: git checkout ${{ github.event.inputs.branch }}
46+
- name: Setup Dotnet
47+
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d
48+
with:
49+
dotnet-version: 10.0.100
50+
- name: Git Config
51+
run: |-
52+
git config --global user.email "github-bot@duendesoftware.com"
53+
git config --global user.name "Duende Software GitHub Bot"
54+
- name: Remove previous git tag
55+
if: github.event.inputs['remove-tag-if-exists'] == 'true'
56+
run: |-
57+
if git rev-parse rs-${{ github.event.inputs.version }} >/dev/null 2>&1; then
58+
git tag -d rs-${{ github.event.inputs.version }}
59+
git push --delete origin rs-${{ github.event.inputs.version }}
60+
else
61+
echo 'Tag rs-${{ github.event.inputs.version }} does not exist.'
62+
fi
63+
- name: Git tag
64+
run: |-
65+
git tag -a rs-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
66+
git push origin rs-${{ github.event.inputs.version }}
67+
- name: Pack RazorSlices
68+
run: dotnet pack -c Release src/RazorSlices -o artifacts
69+
- name: Tool restore
70+
run: dotnet tool restore
71+
- name: Sign packages
72+
run: |-
73+
for file in artifacts/*.nupkg; do
74+
dotnet NuGetKeyVaultSignTool sign "$file" --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ --azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 --azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 --azure-key-vault-client-secret ${{ secrets.SignClientSecret }} --azure-key-vault-certificate NuGetPackageSigning
75+
done
76+
- name: Push packages to GitHub
77+
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/DuendeSoftware/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
- name: Upload Artifacts
82+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
83+
with:
84+
name: artifacts
85+
path: razor-slices/artifacts/*.nupkg
86+
overwrite: true
87+
retention-days: 15
88+
publish:
89+
name: Publish to nuget.org
90+
needs:
91+
- tag
92+
runs-on: ubuntu-latest
93+
environment:
94+
name: nuget.org
95+
steps:
96+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
97+
with:
98+
name: artifacts
99+
path: artifacts
100+
- name: Setup Dotnet
101+
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d
102+
with:
103+
dotnet-version: 10.0.100
104+
- name: List files
105+
run: tree
106+
shell: bash
107+
- name: Push packages to nuget.org
108+
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate

Directory.Packages.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageVersion Include="AngleSharp" Version="1.3.0" />
9+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
10+
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
11+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
912
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
1013
<PackageVersion Include="Duende.IdentityModel" Version="8.0.0" />
1114
<PackageVersion Include="Duende.IdentityServer" Version="7.4.2" />
@@ -39,6 +42,7 @@
3942
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
4043
<PackageVersion Include="System.Text.Json" Version="$(ExtensionsVersion)" />
4144
<PackageVersion Include="Verify.XunitV3" Version="31.8.0" />
45+
<PackageVersion Include="xunit.v3.assert" Version="3.2.1" />
4246
<PackageVersion Include="xunit.v3.core.mtp-v2" Version="3.2.1" />
4347
</ItemGroup>
4448
</Project>

foss.slnx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,22 @@
9191
<File Path="memory-cache/test/Directory.Build.props" />
9292
<Project Path="memory-cache/test/Extensions.Caching.Memory.Tests/Extensions.Caching.Memory.Tests.csproj" />
9393
</Folder>
94+
<Folder Name="/razor-slices/">
95+
<File Path="razor-slices/README.md" />
96+
</Folder>
97+
<Folder Name="/razor-slices/samples/">
98+
<Project Path="razor-slices/samples/PagesAndSlices/PagesAndSlices.csproj" />
99+
<Project Path="razor-slices/samples/RazorClassLibrary/RazorClassLibrary.csproj" />
100+
<Project Path="razor-slices/samples/WebApp/WebApp.csproj" />
101+
</Folder>
102+
<Folder Name="/razor-slices/src/">
103+
<File Path="razor-slices/src/Directory.Build.props" />
104+
<Project Path="razor-slices/src/RazorSlices/RazorSlices.csproj" />
105+
<Project Path="razor-slices/src/SourceGenerator/SourceGenerator.csproj" />
106+
</Folder>
107+
<Folder Name="/razor-slices/test/">
108+
<File Path="razor-slices/test/Directory.Build.props" />
109+
<Project Path="razor-slices/test/RazorSlices.Tests/RazorSlices.Tests.csproj" />
110+
<Project Path="razor-slices/test/SourceGenerator.Tests/SourceGenerator.Tests.csproj" />
111+
</Folder>
94112
</Solution>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"NuGetKeyVaultSignTool": {
6+
"version": "3.2.3",
7+
"commands": [
8+
"NuGetKeyVaultSignTool"
9+
]
10+
}
11+
}
12+
}

razor-slices/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Duende.RazorSlices
2+
3+
This is a vendored fork of [DamianEdwards/RazorSlices](https://github.com/DamianEdwards/RazorSlices), maintained here for supply-chain control reasons. Vendoring allows Duende to pin the exact source, apply security patches independently, and ship the package under the `Duende.*` namespace without taking a transitive dependency on an externally-published NuGet package.
4+
5+
The upstream project is copyright Damian Edwards and licensed under the [Apache 2.0 license](../LICENSE). See [ThirdPartyNotices.txt](ThirdPartyNotices.txt) for the full attribution.
6+
7+
## Differences from upstream
8+
9+
- Package ID, assembly name, and root namespace changed from `RazorSlices` to `Duende.RazorSlices`
10+
- Source generator package renamed from `RazorSlices.SourceGenerator` to `Duende.RazorSlices.SourceGenerator`
11+
- Target framework updated to `net10.0`
12+
- Strong-naming disabled (not required for vendored use)

razor-slices/ThirdPartyNotices.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Duende.RazorSlices uses third-party libraries or other resources that may be
2+
distributed under licenses different than the Duende.RazorSlices software.
3+
4+
License notice for RazorSlices (https://github.com/DamianEdwards/RazorSlices)
5+
Copyright (c) Damian Edwards
6+
Licensed under the MIT License.
7+
8+
License notice for ASP.NET Core (https://github.com/dotnet/aspnetcore/blob/main/LICENSE.txt)
9+
License notice for .NET Core (https://github.com/dotnet/runtime/blob/main/LICENSE.TXT)
10+
------------------------------------
11+
12+
The MIT License (MIT)
13+
14+
Copyright (c) .NET Foundation and Contributors
15+
16+
All rights reserved.
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy
19+
of this software and associated documentation files (the "Software"), to deal
20+
in the Software without restriction, including without limitation the rights
21+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22+
copies of the Software, and to permit persons to whom the Software is
23+
furnished to do so, subject to the following conditions:
24+
25+
The above copyright notice and this permission notice shall be included in all
26+
copies or substantial portions of the Software.
27+
28+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34+
SOFTWARE.

razor-slices/razor-slices.slnf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"solution": {
3+
"path": "..\\foss.slnx",
4+
"projects": [
5+
"razor-slices\\src\\RazorSlices\\RazorSlices.csproj",
6+
"razor-slices\\src\\SourceGenerator\\SourceGenerator.csproj",
7+
"razor-slices\\test\\RazorSlices.Tests\\RazorSlices.Tests.csproj",
8+
"razor-slices\\test\\SourceGenerator.Tests\\SourceGenerator.Tests.csproj"
9+
]
10+
}
11+
}

0 commit comments

Comments
 (0)