Skip to content

Commit

Permalink
Ensure reference isolation (#4132)
Browse files Browse the repository at this point in the history
* Use TestOnly.props only for test projects
* Move analyzer references from BuildOnly.props to General.props
* Remove BuildOnly.props as it contains unused references
  • Loading branch information
RussKie authored Jun 29, 2023
1 parent 030317c commit f415a2a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ packages
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
!src/Packages
!eng/Packages
!src/[Pp]ackages
!eng/[Pp]ackages

# Microsoft Azure Build Output
csx/
Expand Down
4 changes: 1 addition & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\eng\Packages\BuildOnly.props" />
<Import Project="$(MSBuildThisFileDirectory)\eng\Packages\General.props" />
<Import Project="$(MSBuildThisFileDirectory)\eng\Packages\TestOnly.props" />
<Import Project="$(MSBuildThisFileDirectory)\eng\packages\General.props" />
</Project>
2 changes: 2 additions & 0 deletions bench/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)\..\eng\packages\TestOnly.props" />

<PropertyGroup>
<GenerateDocumentationFile Condition="'$(GenerateDocumentationFile)' == ''">false</GenerateDocumentationFile>
</PropertyGroup>
Expand Down
16 changes: 0 additions & 16 deletions eng/Packages/BuildOnly.props

This file was deleted.

16 changes: 8 additions & 8 deletions eng/build.proj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<!-- We recursively add all of the projects inside the src directory, except for the exclusions above -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\**\*.csproj" Exclude="@(_ProjectsToExclude)" />
<!-- We recursively add all of the test projects -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\test\**\*.csproj" />
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\bench\**\*.csproj" />
<!-- Add all the projects we want to build as project references, so the traversal SDK can build them -->
<ProjectReference Include="@(_ProjectsToBuild)" />
<!-- We recursively add all of the projects inside the src directory, except for the exclusions above -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\**\*.csproj" Exclude="@(_ProjectsToExclude)" />
<!-- We recursively add all of the test projects -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\test\**\*.csproj" />
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\bench\**\*.csproj" />

<!-- Add all the projects we want to build as project references, so the traversal SDK can build them -->
<ProjectReference Include="@(_ProjectsToBuild)" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions eng/Packages/General.props → eng/packages/General.props
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<PackageVersion Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.5.22" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="8.52.0.60960" />
<PackageVersion Include="StyleCop.Analyzers.Unstable" Version="1.2.0.435" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageVersion Include="Microsoft.AspNetCore.Http.Features" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)\..\eng\packages\TestOnly.props" />

<PropertyGroup>
<GenerateDocumentationFile Condition="'$(GenerateDocumentationFile)' == ''">false</GenerateDocumentationFile>
</PropertyGroup>
Expand Down

0 comments on commit f415a2a

Please sign in to comment.