Skip to content

Commit

Permalink
Use full version for source-build artifacts (#16161)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosavljevic authored Apr 20, 2023
2 parents 615af23 + 3565cc8 commit 2bbc05e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
13 changes: 13 additions & 0 deletions src/SourceBuild/content/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
</ItemGroup>
</Target>

<Target Name="DetermineMicrosoftSourceBuildIntermediateInstallerVersion">
<!-- Manually load the installer version from the PVP. -->
<XmlPeek XmlInputPath="$(IntermediatePath)PackageVersions.package-source-build.Current.props"
Query="msb:Project/msb:PropertyGroup/msb:MicrosoftSourceBuildIntermediateInstallerVersion/text()"
Namespaces="&lt;Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/&gt;">
<Output TaskParameter="Result" ItemName="MicrosoftSourceBuildIntermediateInstallerVersionItem" />
</XmlPeek>
<PropertyGroup>
<MicrosoftSourceBuildIntermediateInstallerVersion>@(MicrosoftSourceBuildIntermediateInstallerVersionItem)</MicrosoftSourceBuildIntermediateInstallerVersion>
<MicrosoftSourceBuildIntermediateInstallerVersion Condition="'$(MicrosoftSourceBuildIntermediateInstallerVersion)' == ''">$(installerOutputPackageVersion)</MicrosoftSourceBuildIntermediateInstallerVersion>
</PropertyGroup>
</Target>

<Import Condition="'$(SkipArcadeSdkImport)' != 'true'" Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

</Project>
10 changes: 6 additions & 4 deletions src/SourceBuild/content/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
Condition="'$(SkipSmokeTestPrereqsTarballCreation)' != 'true'"
DependsOnTargets="
CheckIfCreateSmokeTestPrereqsExistToPack;
CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"/>
CreateSmokeTestPrereqsTarballIfPrereqsExist"/>

<Target Name="CheckIfCreateSmokeTestPrereqsExistToPack">
<PropertyGroup>
Expand All @@ -130,10 +130,11 @@
<Message Text="Found @(SmokeTestsPrereqs->Count()) prereqs in '$(SmokeTestsPackagesDir)'." Importance="High" />
</Target>

<Target Name="CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"
<Target Name="CreateSmokeTestPrereqsTarballIfPrereqsExist"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion"
Condition="'@(SmokeTestsPrereqs->Count())' != '0'">
<PropertyGroup>
<SmokeTestPrereqsTarballName>$(OutputPath)dotnet-smoke-test-prereqs.$(installerOutputPackageVersion).$(TargetRid).tar.gz</SmokeTestPrereqsTarballName>
<SmokeTestPrereqsTarballName>$(OutputPath)dotnet-smoke-test-prereqs.$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid).tar.gz</SmokeTestPrereqsTarballName>
<SmokeTestsPrereqPackagesDir>$(SmokeTestsArtifactsDir)prereq-packages/</SmokeTestsPrereqPackagesDir>
</PropertyGroup>

Expand Down Expand Up @@ -187,9 +188,10 @@
</Target>

<Target Name="CreatePrebuiltsTarballIfPrebuiltsExist"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion"
Condition="'@(PrebuiltFile->Count())' != '0'">
<PropertyGroup>
<TarballFilePath>$(OutputPath)$(SourceBuiltPrebuiltsTarballName).$(installerOutputPackageVersion).$(TargetRid).tar.gz</TarballFilePath>
<TarballFilePath>$(OutputPath)$(SourceBuiltPrebuiltsTarballName).$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid).tar.gz</TarballFilePath>
<TarballWorkingDir>$(ResultingPrebuiltPackagesDir)</TarballWorkingDir>
</PropertyGroup>

Expand Down
18 changes: 3 additions & 15 deletions src/SourceBuild/content/repo-projects/package-source-build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="RepoBuild">
<Target Name="RepoBuild"
DependsOnTargets="DetermineMicrosoftSourceBuildIntermediateInstallerVersion">
<!-- Copy PVP to packages dir in order to package them together -->
<Copy SourceFiles="$(IncludedPackageVersionPropsFile)" DestinationFiles="$(SourceBuiltPackagesPath)PackageVersions.props" />

Expand Down Expand Up @@ -46,23 +47,10 @@
Directories="$(SourceBuildReferencePackagesDestination)extractArtifacts/" />

<PropertyGroup>
<SourceBuiltTarballName>$(OutputPath)$(SourceBuiltArtifactsTarballName).$(installerOutputPackageVersion).$(TargetRid).tar.gz</SourceBuiltTarballName>
<SourceBuiltTarballName>$(OutputPath)$(SourceBuiltArtifactsTarballName).$(MicrosoftSourceBuildIntermediateInstallerVersion).$(TargetRid).tar.gz</SourceBuiltTarballName>
<SourceBuiltVersionFileName>.version</SourceBuiltVersionFileName>
</PropertyGroup>

<!--
Manually load the installer version from the PVP. This is manually done instead of using an explicit
<Import> because the PVP does not exist at the time this project file is loaded.
-->
<XmlPeek XmlInputPath="$(CurrentSourceBuiltPackageVersionPropsPath)"
Query="msb:Project/msb:PropertyGroup/msb:MicrosoftSourceBuildIntermediateInstallerVersion/text()"
Namespaces="&lt;Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/&gt;">
<Output TaskParameter="Result" ItemName="MicrosoftSourceBuildIntermediateInstallerVersionItem" />
</XmlPeek>
<PropertyGroup>
<MicrosoftSourceBuildIntermediateInstallerVersion>@(MicrosoftSourceBuildIntermediateInstallerVersionItem)</MicrosoftSourceBuildIntermediateInstallerVersion>
</PropertyGroup>

<!-- Content of the .version file to include in the tarball -->
<ItemGroup>
<VersionFileContent Include="$(RepositoryCommit);$(MicrosoftSourceBuildIntermediateInstallerVersion)" />
Expand Down

0 comments on commit 2bbc05e

Please sign in to comment.