Skip to content

[release/3.1] Minor cleanup #33419

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

Merged
merged 4 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*proj;
$(RepoRoot)src\Components\WebAssembly\Build\testassets\**\*.csproj;
$(RepoRoot)src\ProjectTemplates\ComponentsWebAssembly.ProjectTemplates\content\**\*.csproj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.csproj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.fsproj;
$(RepoRoot)src\ProjectTemplates\Web.Spa.ProjectTemplates\content\**\*.csproj;
Expand Down
4 changes: 2 additions & 2 deletions eng/CodeGen.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
Targets="GetReferencesProvided"
BuildInParallel="true"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true" >
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
SkipNonexistentProjects="true">
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider" />
</MSBuild>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions eng/scripts/CodeCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ try {
# Ignore duplicates in submodules. These should be isolated from the rest of the build.
# Ignore duplicates in the .ref folder. This is expected.
Get-ChildItem -Recurse "$repoRoot/src/*.*proj" `
| ? { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } `
| ? { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } `
| % {
| Where-Object { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } `
| Where-Object { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } `
| ForEach-Object {
$fileName = [io.path]::GetFileNameWithoutExtension($_)
if (-not ($projectFileNames.Add($fileName))) {
LogError -code 'BUILD003' -filepath $_ `
Expand Down Expand Up @@ -136,17 +136,17 @@ try {
Write-Host "Checking that solutions are up to date"

Get-ChildItem "$repoRoot/*.sln" -Recurse `
| ? {
| Where-Object {
# These .sln files are used by the templating engine.
(($_.Name -ne "BlazorServerWeb_CSharp.sln") -and ($_.Name -ne 'ComponentsWebAssembly-CSharp.sln'))
} `
| % {
| ForEach-Object {
Write-Host " Checking $(Split-Path -Leaf $_)"
$slnDir = Split-Path -Parent $_
$sln = $_
& dotnet sln $_ list `
| ? { $_ -like '*proj' } `
| % {
| Where-Object { $_ -like '*proj' } `
| ForEach-Object {
$proj = Join-Path $slnDir $_
if (-not (Test-Path $proj)) {
LogError "Missing project. Solution references a project which does not exist: $proj. [$sln] "
Expand Down
47 changes: 24 additions & 23 deletions eng/targets/ResolveReferences.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<Project>

<PropertyGroup>
<EnableCustomReferenceResolution Condition="'$(EnableCustomReferenceResolution)' == '' AND ('$(DotNetBuildFromSource)' != 'true' OR '$(ExcludeFromSourceBuild)' != 'true')">true</EnableCustomReferenceResolution>
<EnableCustomReferenceResolution
Condition="'$(EnableCustomReferenceResolution)' == '' AND ('$(DotNetBuildFromSource)' != 'true' OR '$(ExcludeFromSourceBuild)' != 'true')">true</EnableCustomReferenceResolution>

<ResolveReferencesDependsOn>
ResolveCustomReferences;
Expand All @@ -35,10 +36,11 @@
* when a project is a test or sample project
* when a package is releasing a new patch (we like to update external dependencies in patches when possible)
That is, use latest package references unless this is a servicing build, the project is normally packable, and
the package is not included in this release.
the package is not included in this release. The "unless" cases are extremely unlikely because both
$(IsPackableInNonServicingBuild) and $(IsPackageInThisPatch) are either undefined or true.
-->
<UseLatestPackageReferences
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
<UseLatestPackageReferences
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsPackableInNonServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
<UseLatestPackageReferences
Expand Down Expand Up @@ -99,8 +101,8 @@
<_OriginalReferences Include="@(Reference)" />

<!--
Turn Reference items into a ProjectReference when UseProjectReferences is true.
Order matters. This comes before package resolution because projects should be used when possible instead of packages.
Turn Reference items into a ProjectReference when UseProjectReferences is true. Order matters; this
comes before package resolution because projects should be used when possible instead of packages.
-->
<_ProjectReferenceByAssemblyName Condition="'$(UseProjectReferences)' == 'true'"
Include="@(ProjectReferenceProvider)"
Expand All @@ -121,16 +123,13 @@
</ItemGroup>

<!--
This target helps ensure projects within the shared framework do not unintentionally add new references,
and that assemblies outside the shared framework reference the framework as a whole instead of using
individual assemblies.
This target helps ensure projects within the shared framework do not unintentionally add new references, and that
assemblies outside the shared framework reference the framework as a whole instead of using individual assemblies.
In addition, enforce use of Reference items for projects reference providers.
-->
<Target Name="_CheckForReferenceBoundaries" BeforeTargets="CollectPackageReferences;ResolveReferences">
<Error Condition="@(_InvalidReferenceToSharedFxOnlyAssembly->Count()) != 0"
Text="Cannot reference &quot;%(_InvalidReferenceToSharedFxOnlyAssembly.Identity)&quot; directly because it is part of the shared framework and this project is not. Use &lt;FrameworkReference Include=&quot;Microsoft.AspNetCore.App&quot; /&gt; instead." />

<Error Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0"
Text="Cannot reference &quot;%(_InvalidReferenceToNonSharedFxAssembly.Identity)&quot;. This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." />
Text="Cannot reference &quot;%(Identity)&quot;. This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." />
</Target>

<Target Name="_WarnAboutRedundantRef" AfterTargets="ResolveFrameworkReferences;ProcessFrameworkReferences">
Expand All @@ -140,14 +139,15 @@
</Target>

<!--
This target resolves remaining Reference items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve.
This executes on NuGet restore and during DesignTimeBuild. It should not run in the outer, cross-targeting build.
This target resolves remaining Reference items to Packages, if possible. If not, they are left as Reference
items for the SDK to resolve. This executes on NuGet restore and during DesignTimeBuild. It should not run in
outer, cross-targeting build.
-->
<Target Name="ResolveCustomReferences"
BeforeTargets="CheckForImplicitPackageReferenceOverrides;CollectPackageReferences;ResolvePackageAssets"
Condition=" '$(TargetFramework)' != '' AND '$(EnableCustomReferenceResolution)' == 'true' ">
<ItemGroup>
<!-- Ensure only content asset are consumed from .Sources packages -->
<!-- Ensure only content assets are consumed from .Sources packages. -->
<Reference>
<IncludeAssets Condition="'%(IsSharedSource)' == 'true'">ContentFiles;Build</IncludeAssets>
<PrivateAssets Condition="'%(IsSharedSource)' == 'true'">All</PrivateAssets>
Expand Down Expand Up @@ -176,9 +176,9 @@
<_LatestPackageReferenceWithVersion Remove="@(_LatestPackageReferenceWithVersion)"
Condition="'%(Id)' != '%(Identity)' " />

<PackageReference Include="@(_LatestPackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
<Reference Remove="@(_LatestPackageReferenceWithVersion)" />
<PackageReference Include="@(_LatestPackageReferenceWithVersion)" IsImplicitlyDefined="true" />

<!-- Resolve references from BaselinePackageReference for servicing builds in corner cases. May be unused. -->
<_BaselinePackageReferenceWithVersion Include="@(Reference)"
Expand All @@ -189,8 +189,8 @@
<_BaselinePackageReferenceWithVersion Remove="@(_BaselinePackageReferenceWithVersion)"
Condition="'%(Id)' != '%(Identity)' " />

<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
<PackageReference Include="@(_BaselinePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
<Reference Remove="@(_BaselinePackageReferenceWithVersion)" />

<!-- For PrivateAssets=All references, like .Sources packages, fallback to LatestPackageReferences. -->
Expand All @@ -201,8 +201,8 @@
<_PrivatePackageReferenceWithVersion Remove="@(_PrivatePackageReferenceWithVersion)"
Condition="'%(Id)' != '%(Identity)' " />

<!-- Remove reference items that have been resolved to an item with PrivateAssets="All". -->
<PackageReference Include="@(_PrivatePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
<!-- Remove reference items that have been resolved to an item with PrivateAssets="All". -->
<Reference Remove="@(_PrivatePackageReferenceWithVersion)" />

<!-- Free up memory for unnecessary items -->
Expand All @@ -228,7 +228,7 @@
<Error
Condition="'$(IsReferenceAssemblyProject)' != 'true' AND '$(IsServicingBuild)' == 'true' AND @(UnusedBaselinePackageReference->Count()) != 0"
Code="BUILD002"
Text="Package references changed since the last release. This could be a breaking change and is not allowed in a servicing update. References removed:%0A - @(UnusedBaselinePackageReference, '%0A -')" />
Text="Package references changed since the last release. This could be a breaking change and is not allowed in a servicing update. References removed:%0A - @(UnusedBaselinePackageReference, '%0A - ')" />

<Error
Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' AND '%(Reference.Identity)' != '' AND ! Exists('%(Reference.Identity)') AND '$(DisablePackageReferenceRestrictions)' != 'true'"
Expand Down Expand Up @@ -339,11 +339,12 @@
Condition="'$(SkipRefDirectoryCheck)' != 'true' AND '$(IsImplementationProject)' == 'true' AND !$(HasReferenceAssembly) AND Exists($(ReferenceAssemblyDirectory))"
Text="Project shouldn't have reference assembly but folder exists $(ReferenceAssemblyDirectory)" />
<Error
Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' == 'true' AND !$(HasReferenceAssembly) "
Text="All assemblies which have set IsAspNetCoreApp=true should produce a reference assembly." />
<Warning Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' != 'true' "
Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' == 'true' AND
!$(HasReferenceAssembly) AND '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' "
Text="All assemblies which have set IsAspNetCoreApp=true should produce a reference assembly for default TFM." />
<Error Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' != 'true' "
Text="Only implementation projects should set IsAspNetCoreApp=true." />
<Warning Condition=" '$(IsAspNetCoreApp)' != 'true' AND $(HasReferenceAssembly) "
<Error Condition=" '$(IsAspNetCoreApp)' != 'true' AND $(HasReferenceAssembly) "
Text="Only projects in the shared framework i.e. IsAspNetCoreApp==true should produce a reference assembly." />

<ItemGroup Condition=" '$(IsProjectReferenceProvider)' == 'true' ">
Expand Down
3 changes: 1 addition & 2 deletions src/Components/Ignitor/src/Ignitor.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Intentionally targeting netcoreapp3.0 because we do not want to update the Benchmark client to use 3.1 -->
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>true</IsPackable>
<IsShippingPackage>false</IsShippingPackage>
<HasReferenceAssembly>false</HasReferenceAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />

<PropertyGroup>
<!-- We know netcoreapp2.0 is EOL but can't take a breaking change in shipped package. -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>
</Project>