BuildTools/files/KoreBuild/KoreBuild.Verify.targets

82 строки
3.0 KiB
Plaintext
Исходник Обычный вид История

<!--
This file should be the last thing imported in KoreBuild to ensure target order is correct.
-->
<Project>
<PropertyGroup>
<IgnoredArtifactItems>$(IgnoredArtifactItems);$(LogOutputDir)**\*;</IgnoredArtifactItems>
</PropertyGroup>
<PropertyGroup Condition="'$(DisableDefaultTargets)' == 'true'">
<SkipArtifactVerification>true</SkipArtifactVerification>
</PropertyGroup>
<PropertyGroup Condition="'$(SkipArtifactVerification)' != 'true'">
<RestoreDependsOn>$(RestoreDependsOn);CheckForUnknownArtifacts</RestoreDependsOn>
</PropertyGroup>
<!--
###################################################################
Target: CheckForUnknownArtifacts
Verifies everything in artifacts/* is accounted for before build.
###################################################################
-->
<Target Name="CheckForUnknownArtifacts" DependsOnTargets="GetArtifactInfo">
<ItemGroup>
<_UnexpectedArtifact Remove="@(_UnexpectedArtifact)" />
<_UnexpectedArtifact Include="$(ArtifactsDir)**\*" Exclude="@(ArtifactInfo->'%(FullPath)');$(IgnoredArtifactItems)" />
</ItemGroup>
<PropertyGroup>
<ArtifactErrorMessage />
<ArtifactErrorMessage Condition=" @(_UnexpectedArtifact->Count()) != 0 ">
Undeclared artifacts exist in $(ArtifactsDir).
Run /t:Clean or update repo.props to list known build output as an ArtifactInfo item.
Unexpected files:
- @(_UnexpectedArtifact, '%0A - ')
</ArtifactErrorMessage>
</PropertyGroup>
<Warning Text="$(ArtifactErrorMessage.Trim())"
Code="KRB5002"
Condition=" '$(ArtifactErrorMessage.Trim())' != '' AND '$(CI)' != 'true' " />
<Error Text="$(ArtifactErrorMessage.Trim())"
Code="KRB5002"
Condition=" '$(ArtifactErrorMessage.Trim())' != '' AND '$(CI)' == 'true' " />
</Target>
<!--
###################################################################
Target: VerifyArtifacts
Verifies everything in artifacts/* is accounted for after build.
###################################################################
-->
<Target Name="VerifyArtifacts" Condition="'$(SkipArtifactVerification)' != 'true'" DependsOnTargets="GetArtifactInfo;CheckForUnknownArtifacts" AfterTargets="Package">
<ItemGroup>
<_ExpectedArtifact Remove="@(_ExpectedArtifact)" />
<_ExpectedArtifact Include="%(ArtifactInfo.Identity)" Condition=" ! Exists(%(ArtifactInfo.Identity))" />
</ItemGroup>
<PropertyGroup>
<ArtifactErrorMessage />
<ArtifactErrorMessage Condition=" @(_ExpectedArtifact->Count()) != 0 ">
$(ArtifactErrorMessage.Trim())
Expected items that do not exist:
- @(_ExpectedArtifact, '%0A - ')
</ArtifactErrorMessage>
</PropertyGroup>
<Warning Text="$(ArtifactErrorMessage.Trim())"
Code="KRB5002"
Condition=" '$(ArtifactErrorMessage.Trim())' != '' AND '$(CI)' != 'true' " />
<Error Text="$(ArtifactErrorMessage.Trim())"
Code="KRB5002"
Condition=" '$(ArtifactErrorMessage.Trim())' != '' AND '$(CI)' == 'true' " />
</Target>
</Project>