Exclude intermediate and rid specific packages from artifacts tarball (#14224)
This commit is contained in:
parent
7f8373be12
commit
0595aeb403
3 changed files with 64 additions and 7 deletions
|
@ -0,0 +1,62 @@
|
|||
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
|
||||
<Project>
|
||||
|
||||
<Import Project="SourceBuildArcade.targets" />
|
||||
|
||||
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SourceBuild.AddSourceToNuGetConfig" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
|
||||
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SourceBuild.ReadSourceBuildIntermediateNupkgDependencies" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DotNet.SourceBuild.Tasks" Version="$(MicrosoftDotNetSourceBuildTasksVersion)" IsImplicitlyDefined="true" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CollectSourceBuildIntermediateNupkgDependencies"
|
||||
Condition="
|
||||
'$(DotNetBuildFromSourceFlavor)' != 'Product' and
|
||||
(('$(ArcadeBuildFromSource)' == 'true' and '$(ArcadeInnerBuildFromSource)' == 'true') or
|
||||
'$(SetUpSourceBuildIntermediateNupkgCache)' == 'true')"
|
||||
DependsOnTargets="GetSourceBuildIntermediateNupkgNameConvention"
|
||||
BeforeTargets="CollectPackageReferences">
|
||||
<ReadSourceBuildIntermediateNupkgDependencies
|
||||
VersionDetailsXmlFile="$([MSBuild]::NormalizePath('$(RepositoryEngineeringDir)', 'Version.Details.xml'))"
|
||||
SourceBuildIntermediateNupkgPrefix="$(SourceBuildIntermediateNupkgPrefix)"
|
||||
SourceBuildIntermediateNupkgRid="$(SourceBuildIntermediateNupkgRid)">
|
||||
<Output TaskParameter="Dependencies" ItemName="SourceBuildIntermediateNupkgReference" />
|
||||
</ReadSourceBuildIntermediateNupkgDependencies>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="@(SourceBuildIntermediateNupkgReference)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="SetUpSourceBuildIntermediateNupkgCache"
|
||||
Condition="
|
||||
'$(DotNetBuildFromSourceFlavor)' != 'Product' and
|
||||
(('$(ArcadeBuildFromSource)' == 'true' and '$(ArcadeInnerBuildFromSource)' == 'true' and '@(SourceBuildIntermediateNupkgReference)' != '') or
|
||||
'$(SetUpSourceBuildIntermediateNupkgCache)' == 'true')"
|
||||
AfterTargets="Restore">
|
||||
<PropertyGroup>
|
||||
<SourceBuiltNupkgCacheDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'source-built-upstream-cache'))</SourceBuiltNupkgCacheDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<IntermediateNupkgSourceDir Include="$([MSBuild]::NormalizeDirectory(
|
||||
'$(NuGetPackageRoot)',
|
||||
'$([System.String]::new(`%(SourceBuildIntermediateNupkgReference.Identity)`).ToLowerInvariant())',
|
||||
'$([System.String]::new(`%(SourceBuildIntermediateNupkgReference.ExactVersion)`).ToLowerInvariant())',
|
||||
'artifacts'))" />
|
||||
|
||||
<SourceBuiltNupkgFile Include="%(IntermediateNupkgSourceDir.Identity)**\*.nupkg" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(SourceBuiltNupkgFile)"
|
||||
DestinationFiles="@(SourceBuiltNupkgFile -> '$(SourceBuiltNupkgCacheDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<AddSourceToNuGetConfig
|
||||
NuGetConfigFile="$(RestoreConfigFile)"
|
||||
SourceName="source-build-int-nupkg-cache"
|
||||
SourcePath="$(SourceBuiltNupkgCacheDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -621,12 +621,6 @@
|
|||
Condition=" '%(_ToolPackage.Id)' == 'Microsoft.DotNet.Arcade.Sdk' "
|
||||
WorkingDirectory="$(ToolPackageExtractDir)%(_ToolPackage.Id)/tools/SourceBuild/" />
|
||||
|
||||
<ReplaceTextInFile
|
||||
Condition=" '%(_ToolPackage.Id)' == 'Microsoft.DotNet.Arcade.Sdk' "
|
||||
InputFile="$(ToolPackageExtractDir)%(_ToolPackage.Id)/tools/SourceBuild/SourceBuildArcadeTools.targets"
|
||||
OldText="%3CReadSourceBuildIntermediateNupkgDependencies"
|
||||
NewText="%3CReadSourceBuildIntermediateNupkgDependencies Condition="'%24%28DotNetBuildOffline%29' != 'true'"" />
|
||||
|
||||
<!-- Allow overriding of Arcade targets for SourceBuild to enable quicker
|
||||
dev turnaround for Preview 6 -->
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
<SourceBuiltTarballName>$(OutputPath)$(SourceBuiltArtifactsTarballName).$(installerOutputPackageVersion).tar.gz</SourceBuiltTarballName>
|
||||
</PropertyGroup>
|
||||
|
||||
<Exec Command="tar --numeric-owner --exclude='$(SBRPIntermediateWildcard)' -czf $(SourceBuiltTarballName) *.nupkg *.props SourceBuildReferencePackages/" WorkingDirectory="$(SourceBuiltPackagesPath)" />
|
||||
<Exec Command="tar --numeric-owner --exclude='Microsoft.SourceBuild.Intermediate.*.nupkg' --exclude='runtime.$(TargetRid).*.nupkg' -czf $(SourceBuiltTarballName) *.nupkg *.props SourceBuildReferencePackages/"
|
||||
WorkingDirectory="$(SourceBuiltPackagesPath)" />
|
||||
|
||||
<Message Importance="High" Text="Packaged source-built artifacts to $(SourceBuiltTarballName)" />
|
||||
</Target>
|
||||
|
|
Loading…
Reference in a new issue