Don't run old sdk validation, restore test project in init-build.proj

This commit is contained in:
Jackson Schuster 2024-03-19 10:46:12 -07:00
parent 46cc050d54
commit 949a3049bc
4 changed files with 7 additions and 74 deletions

View file

@ -1,64 +0,0 @@
<Project>
<UsingTask AssemblyFile="$(SdkArchiveDiffTasksAssembly)" TaskName="GetValidArchiveItems" />
<UsingTask AssemblyFile="$(SdkArchiveDiffTasksAssembly)" TaskName="GetClosestOfficialSdk" />
<UsingTask AssemblyFile="$(SdkArchiveDiffTasksAssembly)" TaskName="FindArchiveDiffs" />
<Target Name="ReportSdkArchiveDiffs"
AfterTargets="Build"
DependsOnTargets="DetermineSourceBuiltSdkVersion">
<Message Text="Comparing built SDK against closest official build"
Importance="High"/>
<GetValidArchiveItems ArchiveItems="@(SdkTarballItem)"
ArchiveName="dotnet-sdk">
<Output TaskParameter="ValidArchiveItems"
ItemName="_BuiltSdkArchivePath"/>
</GetValidArchiveItems>
<!-- There should only be 1 SDK archive -->
<Error Text="Multiple valid dotnet-sdk archives found."
Condition="'@(_BuiltSdkArchivePath->Count())' != '1'" />
<GetClosestOfficialSdk BuiltArchivePath="@(_BuiltSdkArchivePath)">
<Output TaskParameter="ClosestOfficialArchivePath"
PropertyName="_ClosestOfficialSdkPath" />
</GetClosestOfficialSdk>
<FindArchiveDiffs BaselineArchive="@(_BuiltSdkArchivePath)"
TestArchive="$(_ClosestOfficialSdkPath)">
<Output TaskParameter="ContentDifferences"
ItemName="_ContentDifferences" />
</FindArchiveDiffs>
<ItemGroup>
<_changedFiles Include="@(_ContentDifferences)" Condition="'%(_contentDifferences.Kind)' != 'Unchanged'" />
<_sdkFilesDiff Include="@(_ContentDifferences)" Condition="'%(_contentDifferences.Kind)' == 'Added'" >
<DiffIndicator>+</DiffIndicator>
</_sdkFilesDiff>
<_sdkFilesDiff Include="@(_ContentDifferences)" Condition="'%(_contentDifferences.Kind)' == 'Removed'" >
<DiffIndicator>-</DiffIndicator>
</_sdkFilesDiff>
<_sdkFilesDiff Include="@(_ContentDifferences)" Condition="'%(_contentDifferences.Kind)' == 'Unchanged'" >
<DiffIndicator> </DiffIndicator>
</_sdkFilesDiff>
</ItemGroup>
<PropertyGroup>
<SdkArchiveDiffsReport>$(ArtifactsLogDir)SdkArchiveContent.diff</SdkArchiveDiffsReport>
</PropertyGroup>
<WriteLinesToFile File="$(SdkArchiveDiffsReport)" Lines="@(_sdkFilesDiff->'%(DiffIndicator) %(Identity)')" Overwrite="true" WriteOnlyWhenDifferent="true" />
<Message Text="Difference in sdk archive: %(_changedFiles.Kind): %(_changedFiles.Identity)"
Importance="High"
Condition="'@(_changedFiles->Count())' != '0'"/>
<Message Text="No differences in sdk archive file contents"
Importance="High"
Condition="'@(_changedFiles->Count())' == '0'" />
<Delete Files="$(_ClosestOfficialSdkPath)" />
</Target>
</Project>

View file

@ -15,7 +15,7 @@
UnpackTarballs;
BuildXPlatTasks;
BuildMSBuildSdkResolver;
BuildSdkArchiveDiff;
BuildUnifiedBuildValidationTests;
BuildLeakDetection;
ExtractToolPackage;
GenerateRootFs;
@ -117,12 +117,12 @@
</Touch>
</Target>
<Target Name="BuildSdkArchiveDiff"
<Target Name="BuildUnifiedBuildValidationTests"
Condition="'$(ShortStack)' != 'true' and '$(PortableBuild)' == 'true' and '$(PgoInstrument)' != 'true'" >
<MSBuild Projects="tasks\Microsoft.DotNet.SourceBuild.Tasks.SdkArchiveDiff\Microsoft.DotNet.SourceBuild.Tasks.SdkArchiveDiff.csproj"
<MSBuild Projects="$(UnifiedBuildValidationTestsProject)"
Targets="Restore"
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
<MSBuild Projects="tasks\Microsoft.DotNet.SourceBuild.Tasks.SdkArchiveDiff\Microsoft.DotNet.SourceBuild.Tasks.SdkArchiveDiff.csproj"
<MSBuild Projects="$(UnifiedBuildValidationTestsProject)"
Targets="Build" />
</Target>

View file

@ -2,14 +2,12 @@
<PropertyGroup>
<UnifiedBuildValidationTestsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'test', 'Microsoft.DotNet.UnifiedBuild.Tests'))</UnifiedBuildValidationTestsDir>
<UnifiedBuildValidationTestsProject>$([MSBuild]::NormalizeDirectory('$(UnifiedBuildValidationTestsDir)', 'Microsoft.DotNet.UnifiedBuild.Tests'))</UnifiedBuildValidationTestsProject>
</PropertyGroup>
<Target Name="RunUnifiedBuildValidation"
AfterTargets="Build">
<ItemGroup>
<SdkTarballItem Include="$(ArtifactsAssetsDir)dotnet-sdk*$(ArchiveExtension)" />
<SourceBuiltArtifactsItem Include="$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).*$(ArchiveExtension)" />
</ItemGroup>
AfterTargets="Build"
DependsOnTargets="DetermineSourceBuiltSdkVersion">
<PropertyGroup>
<SdkTarballPath>%(SdkTarballItem.Identity)</SdkTarballPath>

View file

@ -148,7 +148,6 @@
UseHardlinksIfPossible="true" />
</Target>
<Import Project="$(RepositoryEngineeringDir)sdkArchiveDiff.targets" Condition="'$(PortableBuild)' == 'true' and '$(PgoInstrument)' != 'true' and '$(DotNetBuildSourceOnly)' != 'true'" />
<Import Project="$(RepositoryEngineeringDir)unifiedBuildValidation.targets" Condition="'$(ShortStack)' != 'true' and '$(PortableBuild)' == 'true' and '$(PgoInstrument)' != 'true'" />
</Project>