Only msbuild code formatting (#18801)

This commit is contained in:
Viktor Hofer 2024-03-13 13:22:03 +01:00 committed by GitHub
parent aa15647b3c
commit a64fc0bd58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,39 @@
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageVersionsProps" /> <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageVersionsProps" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageUsageData" /> <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WritePackageUsageData" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageReports" /> <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="WriteUsageReports" />
<!-- Returns the repository references of this project and all the projects this project references, recursively -->
<Target Name="GetTransitiveRepositoryReferences" Outputs="@(TransitiveRepositoryReference)">
<ItemGroup>
<_TransitiveRepositoryReference Include="@(RepositoryReference)" />
</ItemGroup>
<MSBuild Projects="@(RepositoryReference->'%(Identity).proj')"
Targets="GetTransitiveRepositoryReferences"
BuildInParallel="true">
<Output TaskParameter="TargetOutputs" ItemName="_DependencyTransitiveRepositoryReference" />
</MSBuild>
<!-- When items are transferred between projects, they get metadata indicating their source (e.g. MSBuildSourceProjectFile).
This is problematic because it causes introduces distinctness on the items. For example, an arcade RepositoryReference
that comes from both msbuild and source-build-externals will be treated as two separate items. But we only want one arcade
reference. To prevent this from happening, we need to remove the extra metadata so the two references can be seen as duplicates. -->
<ItemGroup>
<_TransitiveRepositoryReference Include="@(_DependencyTransitiveRepositoryReference)"
RemoveMetadata="MSBuildSourceProjectFile;MSBuildSourceTargetName;OriginalItemSpec" />
<TransitiveRepositoryReference Include="@(_TransitiveRepositoryReference)" KeepDuplicates="false" />
</ItemGroup>
<!-- Exclude repositories that currently don't build when not building source-only. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<TransitiveRepositoryReference Remove="roslyn" />
<TransitiveRepositoryReference Remove="aspnetcore" />
<TransitiveRepositoryReference Remove="nuget-client" />
<TransitiveRepositoryReference Remove="fsharp" />
<TransitiveRepositoryReference Remove="vstest" />
</ItemGroup>
</Target>
<!-- Wraps the transitive repo references with additional metadata --> <!-- Wraps the transitive repo references with additional metadata -->
<Target Name="GetRepositoryReferenceInfo" <Target Name="GetRepositoryReferenceInfo"
DependsOnTargets="GetTransitiveRepositoryReferences"> DependsOnTargets="GetTransitiveRepositoryReferences">
@ -596,7 +628,6 @@
CleanupRepo" /> CleanupRepo" />
<Target Name="WritePrebuiltUsageData" <Target Name="WritePrebuiltUsageData"
DependsOnTargets="GetAllProjectDirectories"
Inputs="$(MSBuildProjectFullPath)" Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete"> Outputs="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete">
<!-- Save the PVP snapshot of each build step to be evaluated while building the report. --> <!-- Save the PVP snapshot of each build step to be evaluated while building the report. -->
@ -606,59 +637,63 @@
<Copy SourceFiles="@(PackageVersionPropsSnapshotFiles)" DestinationFolder="$(PackageReportDir)snapshots/" /> <Copy SourceFiles="@(PackageVersionPropsSnapshotFiles)" DestinationFolder="$(PackageReportDir)snapshots/" />
<ItemGroup> <ItemGroup>
<AllRestoredPackageFiles Include="$(NuGetPackageRoot)**/*.nupkg" /> <RestoredPackageFile Include="$(NuGetPackageRoot)**/*.nupkg" />
<!-- Only contains packages when building. --> <!-- Only contains packages when building. -->
<TarballPrebuiltPackageFiles Include="$(PrebuiltPackagesPath)*.nupkg" /> <TarballPrebuiltPackageFile Include="$(PrebuiltPackagesPath)*.nupkg" />
<SourceBuiltPackageFiles Include="$(ArtifactsPackagesDir)**/*.nupkg" /> <SourceBuiltPackageFile Include="$(ArtifactsPackagesDir)**/*.nupkg" />
<SourceBuiltPackageFiles Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" /> <SourceBuiltPackageFile Include="$(PrebuiltSourceBuiltPackagesPath)*.nupkg" />
<ReferencePackageFiles Include="$(ReferencePackagesDir)**/*.nupkg" /> <ReferencePackageFile Include="$(ReferencePackagesDir)**/*.nupkg" />
<!-- Check all RIDs from all restored Microsoft.NETCore.Platforms packages. --> <!-- Check all RIDs from all restored Microsoft.NETCore.Platforms packages. -->
<PlatformsRuntimeJsonFiles Include="$(NuGetPackageRoot)microsoft.netcore.platforms/*/PortableRuntimeIdentifierGraph.json" /> <PlatformsRuntimeJsonFile Include="$(NuGetPackageRoot)microsoft.netcore.platforms/*/PortableRuntimeIdentifierGraph.json" />
</ItemGroup>
<ItemGroup>
<RepoProject Include="$(RepoProjectsDir)*.proj" />
<RepoProjectDirectory Include="@(RepoProject->'$(SrcDir)%(Filename)')" />
<!-- Add some other potential top-level project directories for a more specific report. --> <!-- Add some other potential top-level project directories for a more specific report. -->
<ProjectDirectories Include="$(SourceBuiltSdksDir);$(TasksDir);$(ArtifactsObjDir)" /> <RepoProjectDirectory Include="$(SourceBuiltSdksDir);$(TasksDir);$(ArtifactsObjDir)" />
<!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. --> <!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. -->
<ProjectDirectories Include="$(RepoRoot)" /> <RepoProjectDirectory Include="$(RepoRoot)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<!-- This file is a resource tracked by Git, not generated by restore. Ignore false positive. --> <!-- This file is a resource tracked by Git, not generated by restore. Ignore false positive. -->
<IgnoredProjectAssetsJsonFiles Include="$(SrcDir)*nuget-client*/**/test/NuGet.Core.Tests/NuGet.Build.Tasks.Pack.Test/compiler/resources/project.assets.json"/> <IgnoredProjectAssetsJsonFile Include="$(SrcDir)*nuget-client*/**/test/NuGet.Core.Tests/NuGet.Build.Tasks.Pack.Test/compiler/resources/project.assets.json"/>
</ItemGroup> </ItemGroup>
<WritePackageUsageData <WritePackageUsageData
RestoredPackageFiles="@(AllRestoredPackageFiles)" RestoredPackageFiles="@(RestoredPackageFile)"
TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFiles)" TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFile)"
SourceBuiltPackageFiles="@(SourceBuiltPackageFiles)" SourceBuiltPackageFiles="@(SourceBuiltPackageFile)"
ReferencePackageFiles="@(ReferencePackageFiles)" ReferencePackageFiles="@(ReferencePackageFile)"
PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFiles)" PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFile)"
TargetRid="$(TargetRid)" TargetRid="$(TargetRid)"
ProjectDirectories="@(ProjectDirectories)" ProjectDirectories="@(RepoProjectDirectory)"
RootDir="$(RepoRoot)" RootDir="$(RepoRoot)"
IgnoredProjectAssetsJsonFiles="@(IgnoredProjectAssetsJsonFiles)" IgnoredProjectAssetsJsonFiles="@(IgnoredProjectAssetsJsonFile)"
DataFile="$(PackageReportDataFile)" DataFile="$(PackageReportDataFile)"
ProjectAssetsJsonArchiveFile="$(ProjectAssetsJsonArchiveFile)" /> ProjectAssetsJsonArchiveFile="$(ProjectAssetsJsonArchiveFile)" />
<!-- Copy packages detected as prebuilts to the artifacts prebuilt folder --> <!-- Copy packages detected as prebuilts to the artifacts prebuilt folder -->
<ItemGroup> <ItemGroup>
<AllowedPackageFiles Include="@(TarballPrebuiltPackageFile)" /> <AllowedPackageFile Include="@(TarballPrebuiltPackageFile)" />
<AllowedPackageFiles Include="@(SourceBuiltPackageFiles)" /> <AllowedPackageFile Include="@(SourceBuiltPackageFile)" />
<AllowedPackageFiles Include="@(ReferencePackageFiles)" /> <AllowedPackageFile Include="@(ReferencePackageFile)" />
<AllowedPackageFiles> <AllowedPackageFile>
<LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename> <LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename>
</AllowedPackageFiles> </AllowedPackageFile>
<PrebuiltPackageFiles Include="@(AllRestoredPackageFiles)" > <PrebuiltPackageFile Include="@(RestoredPackageFile)" >
<LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename> <LCFilename>$([System.String]::Copy(%(Filename)).ToLowerInvariant())</LCFilename>
</PrebuiltPackageFiles> </PrebuiltPackageFile>
<PrebuiltPackageFiles Remove="@(AllowedPackageFiles)" MatchOnMetadata="LCFilename" /> <PrebuiltPackageFile Remove="@(AllowedPackageFile)" MatchOnMetadata="LCFilename" />
</ItemGroup> </ItemGroup>
<Copy
SourceFiles="@(PrebuiltPackageFiles)" <Copy SourceFiles="@(PrebuiltPackageFile)" DestinationFolder="$(ResultingPrebuiltPackagesDir)" />
DestinationFolder="$(ResultingPrebuiltPackagesDir)" />
<MakeDir Directories="$(BaseIntermediateOutputPath)" /> <MakeDir Directories="$(BaseIntermediateOutputPath)" />
<Touch Files="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete" AlwaysCreate="true"> <Touch Files="$(BaseIntermediateOutputPath)WritePrebuiltUsageData.complete" AlwaysCreate="true">
@ -666,19 +701,6 @@
</Touch> </Touch>
</Target> </Target>
<Target Name="GetAllProjectDirectories">
<ItemGroup>
<AllRepoProjects Include="$(RepoProjectsDir)*.proj" />
</ItemGroup>
<Message Importance="High" Text="Finding project directories..." />
<MSBuild Projects="@(AllRepoProjects)"
Targets="GetProjectDirectory">
<Output TaskParameter="TargetOutputs" ItemName="ProjectDirectories" />
</MSBuild>
</Target>
<Target Name="ReportPrebuiltUsage" <Target Name="ReportPrebuiltUsage"
Inputs="$(MSBuildProjectFullPath)" Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ReportPrebuiltUsage.complete"> Outputs="$(BaseIntermediateOutputPath)ReportPrebuiltUsage.complete">
@ -687,11 +709,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageVersionPropsSavedSnapshotFiles Include="$(PackageReportDir)snapshots/PackageVersions.*.Snapshot.props" /> <PackageVersionPropsSavedSnapshotFile Include="$(PackageReportDir)snapshots/PackageVersions.*.Snapshot.props" />
</ItemGroup> </ItemGroup>
<WriteUsageReports DataFile="$(PackageReportDataFile)" <WriteUsageReports DataFile="$(PackageReportDataFile)"
PackageVersionPropsSnapshots="@(PackageVersionPropsSavedSnapshotFiles)" PackageVersionPropsSnapshots="@(PackageVersionPropsSavedSnapshotFile)"
ProdConBuildManifestFile="$(ProdConManifestFile)" ProdConBuildManifestFile="$(ProdConManifestFile)"
PoisonedReportFile="$(PoisonedReportFile)" PoisonedReportFile="$(PoisonedReportFile)"
OutputDirectory="$(PackageReportDir)" /> OutputDirectory="$(PackageReportDir)" />
@ -715,41 +737,6 @@
</Touch> </Touch>
</Target> </Target>
<Target Name="GetProjectDirectory" Outputs="$(ProjectDirectory)" />
<Target Name="GetRepositoryReferences" Outputs="@(RepositoryReference)" />
<!-- Returns the repository references of this project and all the projects this project references, recursively -->
<Target Name="GetTransitiveRepositoryReferences" Outputs="@(TransitiveRepositoryReference)">
<ItemGroup>
<_TransitiveRepositoryReference Include="@(RepositoryReference)" />
</ItemGroup>
<MSBuild Projects="@(RepositoryReference->'%(Identity).proj')"
Targets="GetTransitiveRepositoryReferences"
BuildInParallel="true">
<Output TaskParameter="TargetOutputs" ItemName="_DependencyTransitiveRepositoryReference" />
</MSBuild>
<!-- When items are transferred between projects, they get metadata indicating their source (e.g. MSBuildSourceProjectFile).
This is problematic because it causes introduces distinctness on the items. For example, an arcade RepositoryReference
that comes from both msbuild and source-build-externals will be treated as two separate items. But we only want one arcade
reference. To prevent this from happening, we need to remove the extra metadata so the two references can be seen as duplicates. -->
<ItemGroup>
<_TransitiveRepositoryReference Include="@(_DependencyTransitiveRepositoryReference)"
RemoveMetadata="MSBuildSourceProjectFile;MSBuildSourceTargetName;OriginalItemSpec" />
<TransitiveRepositoryReference Include="@(_TransitiveRepositoryReference)" KeepDuplicates="false" />
</ItemGroup>
<!-- Exclude repositories that currently don't build when not building source-only. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'">
<TransitiveRepositoryReference Remove="roslyn" />
<TransitiveRepositoryReference Remove="aspnetcore" />
<TransitiveRepositoryReference Remove="nuget-client" />
<TransitiveRepositoryReference Remove="fsharp" />
<TransitiveRepositoryReference Remove="vstest" />
</ItemGroup>
</Target>
<!-- Outputs a dependency graph of the repos, in YAML form, to the console. --> <!-- Outputs a dependency graph of the repos, in YAML form, to the console. -->
<Target Name="ShowDependencyGraph"> <Target Name="ShowDependencyGraph">
<MSBuild Projects="$(MSBuildProjectFullPath)" <MSBuild Projects="$(MSBuildProjectFullPath)"
@ -771,7 +758,7 @@
Use '_' as a placeholder for the space ' ' character since trailing spaces aren't handled well as property values. --> Use '_' as a placeholder for the space ' ' character since trailing spaces aren't handled well as property values. -->
<_NextIndent>$(DependencyGraphIndent)__</_NextIndent> <_NextIndent>$(DependencyGraphIndent)__</_NextIndent>
</PropertyGroup> </PropertyGroup>
<!-- For each of the current project's direct repo dependencies, recursively call the target to get each of there dependency graphs --> <!-- For each of the current project's direct repo dependencies, recursively call the target to get each of there dependency graphs -->
<MSBuild Projects="@(RepositoryReference->'%(Identity).proj')" <MSBuild Projects="@(RepositoryReference->'%(Identity).proj')"
Targets="GetDependencyGraphString" Targets="GetDependencyGraphString"