105 lines
6.5 KiB
XML
105 lines
6.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project Sdk="Microsoft.NET.Sdk">
|
|
|
|
<Import Project="$(MSBuildProjectDirectory)/PackageVersions.props" />
|
|
|
|
<PropertyGroup>
|
|
<TargetFramework>net7.0</TargetFramework>
|
|
<BaseOutputPath>$(MSBuildProjectDirectory)/artifacts/</BaseOutputPath>
|
|
<RestorePackagesPath>$(MSBuildProjectDirectory)/artifacts/restoredPkgs/</RestorePackagesPath>
|
|
<UnpackedTarPath>$(MSBuildProjectDirectory)/artifacts/unpacked/</UnpackedTarPath>
|
|
<NewTarballName>$(ArchiveDir)Private.SourceBuilt.Artifacts.Bootstrap.tar.gz</NewTarballName>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<!-- These packages will be replaced with ms-built packages downloaded from official package feeds-->
|
|
<PackageReference Include="Microsoft.NET.HostModel" Version="$(MicrosoftNETHostModelVersion)" />
|
|
<PackageReference Include="Microsoft.ILVerification" Version="$(MicrosoftILVerificationVersion)" />
|
|
<PackageReference Include="Microsoft.NET.Sdk.IL" Version="$(MicrosoftNETSdkILVersion)" />
|
|
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(MicrosoftNETCoreILAsmVersion)" />
|
|
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(MicrosoftNETCoreILDAsmVersion)" />
|
|
<PackageReference Include="Microsoft.NETCore.TestHost" Version="$(MicrosoftNETCoreTestHostVersion)" />
|
|
<PackageReference Include="runtime.linux-arm64.Microsoft.NETCore.ILAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-arm64.Microsoft.NETCore.ILDAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILDAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-arm64.Microsoft.NETCore.TestHost" Version="$(RuntimeLinuxX64MicrosoftNETCoreTestHostVersion)" />
|
|
<PackageReference Include="runtime.linux-arm64.runtime.native.System.IO.Ports" Version="$(RuntimeLinuxX64RuntimeNativeSystemIOPortsVersion)" />
|
|
<PackageReference Include="runtime.linux-x64.Microsoft.NETCore.ILAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-x64.Microsoft.NETCore.ILDAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILDAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-x64.Microsoft.NETCore.TestHost" Version="$(RuntimeLinuxX64MicrosoftNETCoreTestHostVersion)" />
|
|
<PackageReference Include="runtime.linux-x64.runtime.native.System.IO.Ports" Version="$(RuntimeLinuxX64RuntimeNativeSystemIOPortsVersion)" />
|
|
<PackageReference Include="runtime.linux-musl-x64.Microsoft.NETCore.ILAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-musl-x64.Microsoft.NETCore.ILDAsm" Version="$(RuntimeLinuxX64MicrosoftNETCoreILDAsmVersion)" />
|
|
<PackageReference Include="runtime.linux-musl-x64.Microsoft.NETCore.TestHost" Version="$(RuntimeLinuxX64MicrosoftNETCoreTestHostVersion)" />
|
|
<!-- There's no nuget package for runtime.linux-musl-x64.runtime.native.System.IO.Ports
|
|
<PackageReference Include="runtime.linux-musl-x64.runtime.native.System.IO.Ports" Version="$(RuntimeLinuxX64RuntimeNativeSystemIOPortsVersion)" />
|
|
-->
|
|
</ItemGroup>
|
|
|
|
<Target Name="BuildBoostrapPreviouslySourceBuilt" AfterTargets="Restore">
|
|
<ItemGroup>
|
|
<RestoredNupkgs Include="$(RestorePackagesPath)**/*.nupkg" />
|
|
<PrevSBArchive Include="$(ArchiveDir)Private.SourceBuilt.Artifacts.*.tar.gz" />
|
|
</ItemGroup>
|
|
|
|
<!-- Copy restored nupkg files to root of restored packages dir so they're all in one place-->
|
|
<Copy SourceFiles="@(RestoredNupkgs)" DestinationFolder="$(RestorePackagesPath)" />
|
|
|
|
<!-- Check to ensure there is only one previously source-built archive -->
|
|
<Error Text="Multiple Private.SourceBuilt.Artifacts.*.tar.gz tarballs exists at $(ArchiveDir). Expecting only one."
|
|
Condition="'@(PrevSBArchive->Count())' != '1'" />
|
|
|
|
<!-- Unpack existing archive -->
|
|
<Message Text=" Unpacking existing tarball from %(PrevSBArchive.Identity)" Importance="High" />
|
|
<MakeDir Directories="$(UnpackedTarPath)" />
|
|
<Exec Command="tar -xzf %(PrevSBArchive.Identity) -C $(UnpackedTarPath)" />
|
|
|
|
<!-- Delete existing archive -->
|
|
<Message Text=" Deleting existing tarball: %(PrevSBArchive.Identity)" Importance="High" />
|
|
<Delete Files="%(PrevSBArchive.Identity)" />
|
|
|
|
<!-- Copy files specified in package references above from restored package dir to unpacked archive dir -->
|
|
<Message Text=" Replacing restored files in $(UnpackedTarPath)" Importance="High" />
|
|
<MSBuild Projects="$(MSBuildProjectFile)"
|
|
Targets="CopyDownloadedPackage"
|
|
Properties="SourcePath=$(RestorePackagesPath);DestinationPath=$(UnpackedTarPath);PackageName=%(PackageReference.Identity);PackageVersion=%(PackageReference.Version)" />
|
|
|
|
<!-- Repack tarball with new bootstrap name -->
|
|
<Message Text=" Repacking tarball to $(NewTarballName)" Importance="High" />
|
|
<Exec Command="tar --numeric-owner -czf $(NewTarballName) *.nupkg *.props SourceBuildReferencePackages/" WorkingDirectory="$(UnpackedTarPath)" />
|
|
|
|
</Target>
|
|
|
|
<Target Name="CopyDownloadedPackage">
|
|
<!--
|
|
Copy downloaded package to the output path.
|
|
Note: The package version may be different than the version specified
|
|
since the source-build build number can be different than the official
|
|
package build number.
|
|
-->
|
|
<ItemGroup>
|
|
<SourceFileName Include="$(SourcePath)$(PackageName.ToLower()).*.nupkg" />
|
|
</ItemGroup>
|
|
<PropertyGroup>
|
|
<DestinationFileName>@(SourceFileName->'%(Filename)')</DestinationFileName>
|
|
<NewVersion>$(DestinationFileName.Replace('$(PackageName.ToLower()).',''))</NewVersion>
|
|
</PropertyGroup>
|
|
<Copy
|
|
SourceFiles="@(SourceFileName)"
|
|
DestinationFiles="$(DestinationPath)$(PackageName).$(NewVersion).nupkg" />
|
|
|
|
<!--
|
|
Update the PackageVersions.props if restored version is
|
|
different than the specified version.
|
|
-->
|
|
<PropertyGroup>
|
|
<VersionTag>$([System.String]::concat('%3C','$(PackageName)','Version','%3E').Replace('.',''))</VersionTag>
|
|
<PackageVersionTag>$([System.String]::concat('%3C','$(PackageName)','PackageVersion','%3E').Replace('.',''))</PackageVersionTag>
|
|
<FilePath>$(DestinationPath)PackageVersions.props</FilePath>
|
|
</PropertyGroup>
|
|
<WriteLinesToFile
|
|
File="$(FilePath)"
|
|
Lines="$([System.IO.File]::ReadAllText($(FilePath)).Replace('$(VersionTag)$(PackageVersion)','$(VersionTag)$(NewVersion)').Replace('$(PackageVersionTag)$(PackageVersion)','$(PackageVersionTag)$(NewVersion)'))"
|
|
Overwrite="true"
|
|
Condition=" '$(PackageVersion)' != '$(NewVersion)' " />
|
|
</Target>
|
|
</Project>
|