Skip to content

Commit 0c2bad2

Browse files
authored
Merge pull request #29 from WeihanLi/dev
1.4.0 preview
2 parents b377400 + dfa6139 commit 0c2bad2

40 files changed

+780
-256
lines changed

.editorconfig

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ csharp_new_line_before_members_in_anonymous_types = true
8787

8888
# Fix formatting, https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#rule-id-ide0055-fix-formatting
8989
dotnet_diagnostic.IDE00055.severity = warning
90-
# Remove unnecessary usings, https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005
91-
dotnet_diagnostic.IDE0005.severity = warning
9290
# File header template
9391
dotnet_diagnostic.IDE0073.severity = warning
92+
93+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/unnecessary-code-rules
94+
# Remove unnecessary import
95+
dotnet_diagnostic.IDE0005.severity = warning
96+
# Private member is unused
97+
dotnet_diagnostic.IDE0051.severity = warning
98+
# Private member is unread
99+
dotnet_diagnostic.IDE0052.severity = warning
100+
101+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
102+
# Avoid unused private fields
103+
dotnet_diagnostic.CA1823.severity = warning

.github/workflows/dotnet-format.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v1
14-
- name: Setup .NET 6
14+
- name: Setup .NET 6 SDK
1515
uses: actions/setup-dotnet@v1
1616
with:
17-
dotnet-version: '6.0.100'
17+
dotnet-version: '6.0.x'
18+
include-prerelease: true
19+
- name: Setup .NET 7 SDK
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: '7.0.x'
1823
include-prerelease: true
1924
- name: build
2025
run: dotnet build

.github/workflows/dotnetcore.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v1
11-
- name: Setup .NET SDK
11+
- name: Setup .NET 6 SDK
1212
uses: actions/setup-dotnet@v1
1313
with:
1414
dotnet-version: '6.0.x'
1515
include-prerelease: true
16+
- name: Setup .NET 7 SDK
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: '7.0.x'
20+
include-prerelease: true
1621
- name: dotnet info
1722
run: dotnet --info
1823
- name: build

.vscode/launch.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/samples/WeihanLi.Web.Extensions.Samples/bin/Debug/net7.0/WeihanLi.Web.Extensions.Samples.dll",
13+
"args": [],
14+
"cwd": "${workspaceFolder}/samples/WeihanLi.Web.Extensions.Samples",
15+
"stopAtEntry": false,
16+
"serverReadyAction": {
17+
"action": "openExternally",
18+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
19+
},
20+
"env": {
21+
"ASPNETCORE_ENVIRONMENT": "Development"
22+
},
23+
"sourceFileMap": {
24+
"/Views": "${workspaceFolder}/Views"
25+
}
26+
},
27+
{
28+
"name": ".NET Core Attach",
29+
"type": "coreclr",
30+
"request": "attach"
31+
}
32+
]
33+
}

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/samples/WeihanLi.Web.Extensions.Samples/WeihanLi.Web.Extensions.Samples.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/samples/WeihanLi.Web.Extensions.Samples/WeihanLi.Web.Extensions.Samples.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/samples/WeihanLi.Web.Extensions.Samples/WeihanLi.Web.Extensions.Samples.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

Directory.Build.props

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<Project>
2-
<Import Project="./build/sign.props" />
3-
42
<PropertyGroup>
53
<VersionMajor>1</VersionMajor>
6-
<VersionMinor>2</VersionMinor>
4+
<VersionMinor>4</VersionMinor>
75
<VersionPatch>0</VersionPatch>
86
<VersionRevision>0</VersionRevision>
97
<VersionPrefix Condition="'$(VersionRevision)'=='0'">$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
@@ -15,20 +13,10 @@
1513
<PropertyGroup>
1614
<LangVersion>latest</LangVersion>
1715
<ImplicitUsings>enable</ImplicitUsings>
18-
1916
<RepositoryType>git</RepositoryType>
20-
<RepositoryUrl>https://github.com/WeihanLi/WeihanLi.Web.Extensions</RepositoryUrl>
21-
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
22-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
23-
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
24-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
25-
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
26-
<IncludeSymbols>true</IncludeSymbols>
27-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
28-
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true' or '$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
29-
17+
<RepositoryUrl>https://github.com/WeihanLi/WeihanLi.Web.Extensions</RepositoryUrl>
3018
<Authors>WeihanLi</Authors>
31-
<Copyright>Copyright 2016-2021 (c) WeihanLi</Copyright>
19+
<Copyright>Copyright 2016-$([System.DateTime]::Now.Year) (c) WeihanLi</Copyright>
3220
<NoWarn>$(NoWarn);NU5048;</NoWarn>
3321
</PropertyGroup>
3422
<ItemGroup>
@@ -41,7 +29,4 @@
4129
<Using Include="Microsoft.Extensions.DependencyInjection" />
4230
<Using Include="Microsoft.Extensions.Options" />
4331
</ItemGroup>
44-
<ItemGroup>
45-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
46-
</ItemGroup>
4732
</Project>

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ ASP.NET Core Web extensions
1414

1515
- MVC Pager
1616
- Data Protection
17-
- Access Control Helper
17+
- Authorization
18+
- Access Control Helper
19+
- JwtTokenService
1820
- Authentication
1921
- Query
2022
- Header
21-
- API-Key
23+
- Api-Key
24+
- Basic
2225
- Feature flag
2326
- Http context extensions

azure-pipelines.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,16 @@ pool:
88

99
steps:
1010
- task: UseDotNet@2
11-
displayName: 'Use .NET Core 3.1 sdk'
12-
inputs:
13-
packageType: sdk
14-
version: 3.1.x
15-
16-
- task: UseDotNet@2
17-
displayName: 'Use .NET 5 sdk'
11+
displayName: 'Use .NET 6 sdk'
1812
inputs:
1913
packageType: sdk
20-
version: 5.0.x
21-
includePreviewVersions: true
14+
version: 6.0.x
2215

2316
- task: UseDotNet@2
24-
displayName: 'Use .NET 6 sdk'
17+
displayName: 'Use .NET 7 sdk'
2518
inputs:
2619
packageType: sdk
27-
version: 6.0.x
20+
version: 7.0.x
2821
includePreviewVersions: true
2922

3023
- script: dotnet --info

build.cake

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using System.Collections.Generic;
12
///////////////////////////////////////////////////////////////////////////////
23
// ARGUMENTS
34
///////////////////////////////////////////////////////////////////////////////
45

6+
var apiKey = Argument("apiKey", "");
7+
var stable = Argument("stable", "false");
58
var target = Argument("target", "Default");
69
var configuration = Argument("configuration", "Release");
710

@@ -56,7 +59,7 @@ Task("restore")
5659
{
5760
foreach(var project in srcProjects)
5861
{
59-
DotNetCoreRestore(project.FullPath);
62+
DotNetRestore(project.FullPath);
6063
}
6164
});
6265

@@ -66,13 +69,13 @@ Task("build")
6669
.IsDependentOn("restore")
6770
.Does(() =>
6871
{
69-
var buildSetting = new DotNetCoreBuildSettings{
72+
var buildSetting = new DotNetBuildSettings{
7073
NoRestore = true,
7174
Configuration = configuration
7275
};
7376
foreach(var project in srcProjects)
7477
{
75-
DotNetCoreBuild(project.FullPath, buildSetting);
78+
DotNetBuild(project.FullPath, buildSetting);
7679
}
7780
});
7881

@@ -81,54 +84,69 @@ Task("test")
8184
.IsDependentOn("build")
8285
.Does(() =>
8386
{
84-
var testSettings = new DotNetCoreTestSettings{
87+
var testSettings = new DotNetTestSettings{
8588
NoRestore = true,
8689
Configuration = configuration
8790
};
8891
foreach(var project in testProjects)
8992
{
90-
DotNetCoreTest(project.FullPath, testSettings);
93+
DotNetTest(project.FullPath, testSettings);
9194
}
9295
});
9396

9497
Task("pack")
9598
.Description("Pack package")
9699
.IsDependentOn("build")
97-
.Does(() =>
100+
.Does((context) =>
98101
{
99-
var settings = new DotNetCorePackSettings
102+
var settings = new DotNetPackSettings
100103
{
101104
Configuration = configuration,
102105
OutputDirectory = artifacts,
103106
VersionSuffix = "",
104107
NoRestore = true,
105108
NoBuild = true
106109
};
107-
if(branchName != "master"){
110+
if(branchName != "master" && stable != "true"){
108111
settings.VersionSuffix = $"preview-{DateTime.UtcNow:yyyyMMdd-HHmmss}";
109112
}
110113
foreach (var project in packProjects)
111114
{
112-
DotNetCorePack(project.FullPath, settings);
115+
DotNetPack(project.FullPath, settings);
113116
}
114-
PublishArtifacts();
117+
PublishArtifacts(context);
115118
});
116119

117-
bool PublishArtifacts(){
118-
if(!isWindowsAgent){
120+
bool PublishArtifacts(ICakeContext context)
121+
{
122+
if (context.Environment.Platform.IsUnix())
123+
{
119124
return false;
120125
}
121-
if(branchName == "master" || branchName == "preview")
126+
var publishBranches = new HashSet<string>()
127+
{
128+
"local",
129+
"main",
130+
"master",
131+
"preview"
132+
};
133+
134+
if (string.IsNullOrEmpty(apiKey) && publishBranches.Contains(branchName))
135+
{
136+
apiKey = EnvironmentVariable("Nuget__ApiKey");
137+
}
138+
if (!string.IsNullOrEmpty(apiKey))
122139
{
123-
var pushSetting =new DotNetCoreNuGetPushSettings
140+
var pushSetting = new DotNetNuGetPushSettings
124141
{
125-
Source = EnvironmentVariable("Nuget__SourceUrl") ?? "https://api.nuget.org/v3/index.json",
126-
ApiKey = EnvironmentVariable("Nuget__ApiKey")
142+
Source = "https://api.nuget.org/v3/index.json",
143+
ApiKey = apiKey,
144+
SkipDuplicate = true
127145
};
128146
var packages = GetFiles($"{artifacts}/*.nupkg");
129-
foreach(var package in packages)
147+
foreach (var package in packages)
130148
{
131-
DotNetCoreNuGetPush(package.FullPath, pushSetting);
149+
DotNetNuGetPush(package.FullPath, pushSetting);
132150
}
133151
return true;
134152
}

build/common.props

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)