Skip to content

Commit e05622c

Browse files
authored
Run ./update-apis.ps1 as part of build (#181)
This change fixes up the ./update-apis.ps1 script to only make changes if something has changed. As part of this, the build server can now run the script to ensure all the APIs are in the type forwards or reference assembly.
1 parent ed08e32 commit e05622c

File tree

11 files changed

+459
-391
lines changed

11 files changed

+459
-391
lines changed

azure-pipelines.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ stages:
9191
name: Build
9292
displayName: Build
9393
condition: succeeded()
94+
- task: PowerShell@2
95+
inputs:
96+
filePath: update_apis.ps1
97+
argument: -c $(_BuildConfig)
98+
name: VerifyTypeForwardsRef
99+
displayName: Verify TypeForwards/Reference assembly
100+
condition: succeeded()
94101
- task: PublishTestResults@2
95102
displayName: Publish xUnit Test Results
96103
condition: always()
@@ -136,6 +143,13 @@ stages:
136143
name: Build
137144
displayName: Build
138145
condition: succeeded()
146+
- task: PowerShell@2
147+
inputs:
148+
filePath: update_apis.ps1
149+
argument: -c $(_BuildConfig)
150+
name: VerifyTypeForwardsRef
151+
displayName: Verify TypeForwards/Reference assembly
152+
condition: succeeded()
139153
- task: PublishTestResults@2
140154
displayName: Publish xUnit Test Results
141155
condition: always()
@@ -173,6 +187,13 @@ stages:
173187
name: Build
174188
displayName: Build
175189
condition: succeeded()
190+
- task: PowerShell@2
191+
inputs:
192+
filePath: update_apis.ps1
193+
argument: -c $(_BuildConfig)
194+
name: VerifyTypeForwardsRef
195+
displayName: Verify TypeForwards/Reference assembly
196+
condition: succeeded()
176197
- task: PublishTestResults@2
177198
displayName: Publish xUnit Test Results
178199
condition: always()

src/Microsoft.AspNetCore.SystemWebAdapters/ExcludedApis.txt renamed to src/Microsoft.AspNetCore.SystemWebAdapters/Generated/ExcludedApis.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ M:System.Web.HttpRequest.op_Implicit(Microsoft.AspNetCore.Http.HttpRequest)~Syst
77
M:System.Web.HttpRequest.op_Implicit(System.Web.HttpRequest)~Microsoft.AspNetCore.Http.HttpRequest
88
M:System.Web.HttpResponse.op_Implicit(Microsoft.AspNetCore.Http.HttpResponse)~System.Web.HttpResponse
99
M:System.Web.HttpResponse.op_Implicit(System.Web.HttpResponse)~Microsoft.AspNetCore.Http.HttpResponse
10+
M:System.Web.HttpResponseBase.op_Implicit(Microsoft.AspNetCore.Http.HttpResponse)~System.Web.HttpResponseBase
11+
M:System.Web.HttpRequestBase.op_Implicit(Microsoft.AspNetCore.Http.HttpRequest)~System.Web.HttpRequestBase
1012

1113
T:Microsoft.AspNetCore.SystemWebAdapters.ISessionState
1214
T:Microsoft.AspNetCore.SystemWebAdapters.ISessionKeySerializer
1315
T:Microsoft.AspNetCore.SystemWebAdapters.SessionState.Serialization.ISessionSerializer
16+
17+
# We manually type forward this only for .NET 4.7.2+
18+
T:System.Web.SameSiteMode

src/Microsoft.AspNetCore.SystemWebAdapters/GenerateApis.targets renamed to src/Microsoft.AspNetCore.SystemWebAdapters/Generated/GenerateApis.targets

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project>
2-
32
<PropertyGroup>
4-
<PlatformNotSupportedMessage>Only support when running on ASP.NET Core or System.Web</PlatformNotSupportedMessage>
3+
<PlatformNotSupportedMessage>Only supported when running on ASP.NET Core or System.Web</PlatformNotSupportedMessage>
54
<GenerateTypeForwards Condition=" '$(GenerateTypeForwards)' == '' ">false</GenerateTypeForwards>
65
<GenerateStandard Condition=" '$(GenerateStandard)' == '' ">false</GenerateStandard>
76

87
<__Generate>false</__Generate>
98
<__Generate Condition="$(GenerateTypeForwards) OR $(GenerateStandard)">true</__Generate>
109

11-
<GenAPITargetPath Condition="$(GenerateTypeForwards)">$(MSBuildProjectDirectory)\TypeForwards.Framework.cs</GenAPITargetPath>
12-
<GenAPITargetPath Condition="!$(GenerateTypeForwards)">$(MSBuildProjectDirectory)\Ref.Standard.cs</GenAPITargetPath>
13-
<GenAPIAdditionalParameters>-excludeApiList $(MSBuildThisFileDirectory)ExcludedApis.txt -throw "$(PlatformNotSupportedMessage)"</GenAPIAdditionalParameters>
14-
<GenAPIAdditionalParameters Condition="$(GenerateTypeForwards)"> -writer TypeForwards</GenAPIAdditionalParameters>
10+
<GenAPIHeaderFile>$(MSBuildThisFileDirectory)\Header.txt</GenAPIHeaderFile>
11+
<GenAPITargetPath Condition="$(GenerateTypeForwards)">$(MSBuildThisFileDirectory)\TypeForwards.Framework.cs</GenAPITargetPath>
12+
<GenAPITargetPath Condition="!$(GenerateTypeForwards)">$(MSBuildThisFileDirectory)\Ref.Standard.cs</GenAPITargetPath>
13+
<GenAPIAdditionalParameters>-excludeApiList $(MSBuildThisFileDirectory)ExcludedApis.txt -throw "$(PlatformNotSupportedMessage)" -HeaderFile "$(GenAPIHeaderFile)"</GenAPIAdditionalParameters>
14+
<GenAPIAdditionalParameters Condition="$(GenerateTypeForwards)">$(GenAPIAdditionalParameters) -writer TypeForwards</GenAPIAdditionalParameters>
1515
</PropertyGroup>
1616

1717
<ItemGroup Condition="$(__Generate)">
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
#pragma warning disable CA1822 // Mark members as static
5+
#pragma warning disable CA1010 // Generic interface should also be implemented
6+
#pragma warning disable CA1055 // URI-like return values should not be strings
7+
#pragma warning disable CA1710 // Identifiers should have correct suffix
8+
#pragma warning disable CA1008 // Enums should have zero value
9+
#pragma warning disable CA1027 // Mark enums with FlagsAttribute
10+
#pragma warning disable CA1069 // Enums values should not be duplicated
11+
#pragma warning disable CA1819 // Properties should not return arrays
12+
#pragma warning disable CA1056 // URI-like properties should not be strings
13+
#pragma warning disable CA1024 // Use properties where appropriate
14+
#pragma warning disable CA1724 // Type names should not match namespaces
15+
#pragma warning disable CA1716 // Using a reserved keyword as the name of a virtual/interface member makes it harder for consumers in other languages to override/implement the member.
16+
#pragma warning disable CA1054 // URI parameters should not be strings
17+
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
18+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace System.Web;
5+
6+
public enum SameSiteMode
7+
{
8+
None = 0,
9+
Lax = 1,
10+
Strict = 2,
11+
}

0 commit comments

Comments
 (0)