Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft.AspNetCore.BuildTools.ApiCheck to builds #205

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ project.lock.json
.build
.vs/
.vscode/
global.json
launchSettings.json
33 changes: 19 additions & 14 deletions BuildTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{60A938B2-D95A-403C-AA7A-3683AD64DFA0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGetPackageVerifier", "src\NuGetPackageVerifier\NuGetPackageVerifier.csproj", "{657AFF5E-164E-493D-8501-8026B7C20808}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetPackageVerifier", "src\NuGetPackageVerifier\NuGetPackageVerifier.csproj", "{657AFF5E-164E-493D-8501-8026B7C20808}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reverse this? VS probably changed it, but the FAE04EC0 guid is correct. This VS bug is being tracked here: dotnet/project-system#1821

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 Not a fan of fighting Visual Studio. We can revert this part of the change when dotnet/project-system#1821 is fixed or wait for a future VS update to change the solution for us.

EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SplitPackages", "src\SplitPackages\SplitPackages.csproj", "{C98F7832-85FB-451B-9152-87425ACF8EEB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SplitPackages", "src\SplitPackages\SplitPackages.csproj", "{C98F7832-85FB-451B-9152-87425ACF8EEB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DependenciesPackager", "src\DependenciesPackager\DependenciesPackager.csproj", "{183BBD52-FFC3-4636-9C6F-EAFA5CDBFEAB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DependenciesPackager", "src\DependenciesPackager\DependenciesPackager.csproj", "{183BBD52-FFC3-4636-9C6F-EAFA5CDBFEAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageClassifier", "src\PackageClassifier\PackageClassifier.csproj", "{5F13329B-48C4-418A-A495-E9F58949C43E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageClassifier", "src\PackageClassifier\PackageClassifier.csproj", "{5F13329B-48C4-418A-A495-E9F58949C43E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersionTool", "src\VersionTool\VersionTool.csproj", "{102216C8-55CB-49EA-B20E-D41B1F0E42B1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VersionTool", "src\VersionTool\VersionTool.csproj", "{102216C8-55CB-49EA-B20E-D41B1F0E42B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiCheckBaseline.V1", "test\ApiCheckBaseline.V1\ApiCheckBaseline.V1.csproj", "{1B1731E0-4ADB-4A04-9418-FCD7F5CFB79E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCheckBaseline.V1", "test\ApiCheckBaseline.V1\ApiCheckBaseline.V1.csproj", "{1B1731E0-4ADB-4A04-9418-FCD7F5CFB79E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiCheckBaseline.V2", "test\ApiCheckBaseline.V2\ApiCheckBaseline.V2.csproj", "{ECA89839-3332-43F3-B1B1-9C2D91B7285E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCheckBaseline.V2", "test\ApiCheckBaseline.V2\ApiCheckBaseline.V2.csproj", "{ECA89839-3332-43F3-B1B1-9C2D91B7285E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiCheck.Test", "test\ApiCheck.Test\ApiCheck.Test.csproj", "{D61A892B-D214-44AB-9652-334C4338377B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCheck.Test", "test\ApiCheck.Test\ApiCheck.Test.csproj", "{D61A892B-D214-44AB-9652-334C4338377B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.BuildTools.ApiCheck", "src\Microsoft.AspNetCore.BuildTools.ApiCheck\Microsoft.AspNetCore.BuildTools.ApiCheck.csproj", "{AEFC7985-27C8-468E-8EF8-E1D589C9053F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.BuildTools.ApiCheck", "src\Microsoft.AspNetCore.BuildTools.ApiCheck\Microsoft.AspNetCore.BuildTools.ApiCheck.csproj", "{AEFC7985-27C8-468E-8EF8-E1D589C9053F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGetPackageVerifier.Task", "src\NuGetPackageVerifier.Task\NuGetPackageVerifier.Task.csproj", "{EF38C1CA-8A2E-4C8E-B478-7072C0140514}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetPackageVerifier.Task", "src\NuGetPackageVerifier.Task\NuGetPackageVerifier.Task.csproj", "{EF38C1CA-8A2E-4C8E-B478-7072C0140514}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internal.AspNetCore.Sdk", "src\Internal.AspNetCore.Sdk\Internal.AspNetCore.Sdk.csproj", "{F0E4CF2B-29B9-432B-BF27-195996CA24FD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Internal.AspNetCore.Sdk", "src\Internal.AspNetCore.Sdk\Internal.AspNetCore.Sdk.csproj", "{F0E4CF2B-29B9-432B-BF27-195996CA24FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internal.AspNetCore.BuildTools.Tasks", "src\Internal.AspNetCore.BuildTools.Tasks\Internal.AspNetCore.BuildTools.Tasks.csproj", "{6A631446-BBDD-4743-B576-7F9793B6BE45}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Internal.AspNetCore.BuildTools.Tasks", "src\Internal.AspNetCore.BuildTools.Tasks\Internal.AspNetCore.BuildTools.Tasks.csproj", "{6A631446-BBDD-4743-B576-7F9793B6BE45}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildTools.Tasks.Tests", "test\BuildTools.Tasks.Tests\BuildTools.Tasks.Tests.csproj", "{211858CA-6E82-4EFD-9960-8D023EEB789F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildTools.Tasks.Tests", "test\BuildTools.Tasks.Tests\BuildTools.Tasks.Tests.csproj", "{211858CA-6E82-4EFD-9960-8D023EEB789F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NugetReferenceResolver", "src\NugetReferenceResolver\NugetReferenceResolver.csproj", "{7034433C-4D1B-44A9-B696-55F1C43DB8CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackagePublisher", "src\PackagePublisher\PackagePublisher.csproj", "{E072CD5C-C8D9-4724-9896-A31973775C09}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackagePublisher", "src\PackagePublisher\PackagePublisher.csproj", "{E072CD5C-C8D9-4724-9896-A31973775C09}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.BuildTools.ApiCheck.Task", "src\Microsoft.AspNetCore.BuildTools.ApiCheck.Task\Microsoft.AspNetCore.BuildTools.ApiCheck.Task.csproj", "{9BE633D2-025A-4B29-A8A9-FC8F79C331AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -113,6 +113,10 @@ Global
{E072CD5C-C8D9-4724-9896-A31973775C09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E072CD5C-C8D9-4724-9896-A31973775C09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E072CD5C-C8D9-4724-9896-A31973775C09}.Release|Any CPU.Build.0 = Release|Any CPU
{9BE633D2-025A-4B29-A8A9-FC8F79C331AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BE633D2-025A-4B29-A8A9-FC8F79C331AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BE633D2-025A-4B29-A8A9-FC8F79C331AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BE633D2-025A-4B29-A8A9-FC8F79C331AB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -133,5 +137,6 @@ Global
{211858CA-6E82-4EFD-9960-8D023EEB789F} = {60A938B2-D95A-403C-AA7A-3683AD64DFA0}
{7034433C-4D1B-44A9-B696-55F1C43DB8CB} = {A4F4353B-C3D2-40B0-909A-5B48A748EA76}
{E072CD5C-C8D9-4724-9896-A31973775C09} = {A4F4353B-C3D2-40B0-909A-5B48A748EA76}
{9BE633D2-025A-4B29-A8A9-FC8F79C331AB} = {A4F4353B-C3D2-40B0-909A-5B48A748EA76}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ build_script:
clone_depth: 1
test: off
deploy: off
os: Visual Studio 2017 RC
os: Visual Studio 2017
3 changes: 2 additions & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

<PropertyGroup>
<!-- these imports substitute for a package reference to Internal.AspNetCore.Sdk -->
<_AspNetToolsSdkPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MsBuildThisFileDirectory), NuGet.config))\src\Internal.AspNetCore.Sdk</_AspNetToolsSdkPath>
<_AspNetToolsSdkPath>$([MSBuild]::GetDirectoryNameOfFileAbove($(MsBuildThisFileDirectory), NuGet.Config))\src\Internal.AspNetCore.Sdk</_AspNetToolsSdkPath>
<CustomAfterMicrosoftCommonTargets>$(_AspNetToolsSdkPath)\build\Internal.AspNetCore.Sdk.targets</CustomAfterMicrosoftCommonTargets>
<CustomAfterMicrosoftCommonCrossTargetingTargets>$(_AspNetToolsSdkPath)\buildMultiTargeting\Internal.AspNetCore.Sdk.targets</CustomAfterMicrosoftCommonCrossTargetingTargets>
<GenerateCommitHashAttribute Condition="'$(CommitHash)'==''">false</GenerateCommitHashAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<EnableApiCheck>false</EnableApiCheck>
</PropertyGroup>

<Import Project="$(_AspNetToolsSdkPath)\build\Internal.AspNetCore.Sdk.props" />
Expand Down
3 changes: 3 additions & 0 deletions build/dependencies.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<Project>
<PropertyGroup>
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reference the versions on NuGet.org? It's kinda weird to reference ci-dev packages from this repo since it runs independent of Universe and needs to exist beyond the lifetime of these packages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see how much this is used now. If it's just for the CommandLineUtils, I'll leave it as-is. Due to patch releases, might have to use too many versions for NuGet use to be interesting and controllable from this file.

BTW I didn't change this property or add a source to the NuGet.config file 😺

<CoreFxVersion>4.3.0</CoreFxVersion>
<DotNetCliUtilsVersion>1.0.1</DotNetCliUtilsVersion>
<DotNetProjectModelVersion>1.0.0-rc3-1-003177</DotNetProjectModelVersion>
<JsonNetVersion>9.0.1</JsonNetVersion>
<MsBuildPackageVersions>15.1.548</MsBuildPackageVersions>
<NetStandardPackageVersion>1.6.1</NetStandardPackageVersion>
<NuGetPackagesVersion>4.0.0</NuGetPackagesVersion>
<TestSdkVersion>15.0.0</TestSdkVersion>
<XunitVersion>2.2.0</XunitVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/DependenciesPackager/DependenciesPackager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.0" />
<PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
Expand Down
9 changes: 6 additions & 3 deletions src/Internal.AspNetCore.Sdk/Internal.AspNetCore.Sdk.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\build\common.props" />

Expand All @@ -17,14 +17,17 @@
</ItemGroup>

<ItemGroup>
<!-- Setting PrivateAssets to 'None' ensures the generated nuspec will include the build targets from this project -->
<ProjectReference Include="..\Internal.AspNetCore.BuildTools.Tasks\Internal.AspNetCore.BuildTools.Tasks.csproj">
<!-- Setting to 'None' ensures the generated nuspec will include the build targets from this project -->
<PrivateAssets>None</PrivateAssets>
</ProjectReference>
<ProjectReference Include="..\Microsoft.AspNetCore.BuildTools.ApiCheck\Microsoft.AspNetCore.BuildTools.ApiCheck.csproj">
<PrivateAssets>None</PrivateAssets>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.1" PrivateAssets="All" />
<PackageReference Include="NETStandard.Library" Version="$(NetStandardPackageVersion)" PrivateAssets="All" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions src/Internal.AspNetCore.Sdk/build/ApiCheck.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
WARNING: These targets are intended for building Microsoft's ASP.NET Core repos and are not intended
for use outside of Microsoft.
-->
<Project>
<Target Name="ApiCheck" Condition=" '$(EnableApiCheck)' == 'true' ">
<PropertyGroup>
<_ApiListingFileSuffix Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">net45.json</_ApiListingFileSuffix>
<_ApiListingFileSuffix Condition=" '$(_ApiListingFileSuffix)' == '' ">netcore.json</_ApiListingFileSuffix>
<_ApiListingFilePath>$(MSBuildProjectDirectory)\baseline.$(_ApiListingFileSuffix)</_ApiListingFilePath>
<_ApiExclusionsFilePath>$(MSBuildProjectDirectory)\exceptions.$(_ApiListingFileSuffix)</_ApiExclusionsFilePath>
<_ApiListingFile Condition=" Exists('$(_ApiListingFilePath)') ">$(_ApiListingFilePath)</_ApiListingFile>
<_ApiExclusionsFile Condition=" Exists('$(_ApiExclusionsFilePath)') ">$(_ApiExclusionsFilePath)</_ApiExclusionsFile>
</PropertyGroup>

<Message Condition=" '$(_ApiListingFile)' != '' "
Importance="normal"
Text="Checking for breaking changes in $(MSBuildProjectName), $(TargetFramework)" />
<ApiCheckTask Condition=" '$(_ApiListingFile)' != '' "
ApiListingPath="$(_ApiListingFile)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the same indentation as C#? Maintaining these indentations over time is just a pain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how VS indents XML by default. But, I agree it won't be easy to maintain this in Notepad and VS Code.

I am not changing existing indentation to match. There's a random mix in this repo.

AssemblyPath="$(TargetPath)"
Framework="$(TargetFramework)"
ExcludePublicInternalTypes="$(ExcludePublicInternalTypes_InApiCheck)"
ExclusionsPath="$(_ApiExclusionsFile)"
ProjetAssetsPath="$(ProjectAssetsFile)" />

<Warning Condition=" '$(_ApiListingFile)' == '' "
Text="No baseline file for $(TargetFramework) found in $(MSBuildProjectName)." />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ for use outside of Microsoft.
-->
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Common.targets" />
<Import Project="$(MSBuildThisFileDirectory)ApiCheck.targets" />
<Import Project="$(MSBuildThisFileDirectory)GenerateAssemblyInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)Git.targets" />

Expand Down
17 changes: 17 additions & 0 deletions src/Internal.AspNetCore.Sdk/buildMultiTargeting/ApiCheck.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
WARNING: These targets are intended for building Microsoft's ASP.NET Core repos and are not intended
for use outside of Microsoft.
-->
<Project>
<Target Name="ApiCheck" Condition=" '$(EnableApiCheck)' == 'true' ">
<ItemGroup>
<_TargetFrameworks Remove="@(_TargetFrameworks)" />
<_TargetFrameworks Include="$(TargetFrameworks)" />
</ItemGroup>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="ApiCheck"
Properties="TargetFramework=%(_TargetFrameworks.Identity)"
RemoveProperties="TargetFrameworks" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ for use outside of Microsoft.
-->
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\targets\Common.targets" />
<Import Project="$(MSBuildThisFileDirectory)ApiCheck.targets" />

<Target Name="_ResolveEmbeddedResources">
<ItemGroup>
Expand Down
23 changes: 23 additions & 0 deletions src/Internal.AspNetCore.Sdk/targets/ApiCheck.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
WARNING: These targets are intended for building Microsoft's ASP.NET Core repos and are not intended
for use outside of Microsoft.
-->
<Project>
<PropertyGroup>
<!-- Temporarily disable API checks in all x-plat runs. Universe builds fail at FileSystem repo. -->
<EnableApiCheck Condition=" '$(OS)' != 'Windows_NT' ">false</EnableApiCheck>

<!-- Unconditionally disable API checks if running in .NET Framework MSBuild. Task cannot run there. -->
<EnableApiCheck Condition=" '$(MSBuildRuntimeType)' != 'Core' ">false</EnableApiCheck>

<!-- Unconditionally disable API checks if task would use .NET Framework tool x-plat. -->
<EnableApiCheck Condition=" '$(OS)' != 'Windows_NT' AND $(TargetFramework.StartsWith('net4')) ">false</EnableApiCheck>

<!-- Unless overridden in the project or in one of the above situations, always do API checks. -->
<EnableApiCheck Condition=" '$(EnableApiCheck)' == '' ">true</EnableApiCheck>
<ExcludePublicInternalTypes_InApiCheck Condition=" '$(ExcludePublicInternalTypes_InApiCheck)' == '' ">true</ExcludePublicInternalTypes_InApiCheck>

<!-- Hook API checks into Pack run, prior to creating the .nupkg but after build (if any). -->
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);ApiCheck</GenerateNuspecDependsOn>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/Internal.AspNetCore.Sdk/targets/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Usage: this should be imported once via NuGet at the top of the file.

-->
<Project>
<Import Project="$(MSBuildThisFileDirectory)ApiCheck.props" />

<!-- common package options -->
<PropertyGroup>
Expand Down