76 lines
3.9 KiB
XML
76 lines
3.9 KiB
XML
<Project>
|
|
<PropertyGroup>
|
|
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
|
|
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
|
|
<MetapackageRestoreSource>$(RepositoryRoot).deps\Signed\Packages\</MetapackageRestoreSource>
|
|
<LzmaOutputPackageName>nuGetPackagesArchive-$(PackageVersion)</LzmaOutputPackageName>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
|
|
<Error Text="ArchiverPath must be specified" Condition=" '$(ArchiverPath)' == '' " />
|
|
<Error Text="Archiver not found at $(ArchiverPath)" Condition="!Exists('$(ArchiverPath)')" />
|
|
|
|
<!-- Clear the directories -->
|
|
<RemoveDir Directories="$(_WorkRoot)" />
|
|
|
|
<!-- Copy the archive template -->
|
|
<Copy SourceFiles="$(_TemplatesDirectory)Archive\Archive.csproj" DestinationFiles="$(_WorkRoot)Archive.csproj" />
|
|
|
|
<!-- Copy the archive template -->
|
|
<RepoTasks.AddArchiveReferences
|
|
ReferencePackagePath="$(_WorkRoot)Archive.csproj"
|
|
BuildArtifacts="@(ArtifactInfo)"
|
|
PackageArtifacts="@(PackageArtifact)"
|
|
ExternalDependencies="@(ExternalDependency)"
|
|
MetapackageVersion="$(PackageVersion)" />
|
|
|
|
<PropertyGroup>
|
|
<FallbackStagingDir>$(_WorkRoot)obj\$(LzmaOutputPackageName)</FallbackStagingDir>
|
|
<FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
|
|
<FallbackOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName).lzma</FallbackOutputPath>
|
|
<GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(LzmaOutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<_FallbackArchiveRestoreSources Include="$(MetapackageRestoreSource)" Condition="Exists($(MetapackageRestoreSource))" />
|
|
<_FallbackArchiveRestoreSources Include="$(DependencyMirrorPackageDir)" Condition="Exists($(DependencyMirrorPackageDir))" />
|
|
</ItemGroup>
|
|
|
|
<RepoTasks.GenerateRestoreSourcesPropsFile
|
|
Sources="@(_FallbackArchiveRestoreSources)"
|
|
OutputPath="$(GeneratedFallbackRestoreSourcesPropsPath)" />
|
|
|
|
<!-- Create the Staging Dir -->
|
|
<MakeDir Directories="$(FallbackStagingDir);$(FallbackOutputDir)" />
|
|
|
|
<!-- Restore the target project -->
|
|
<MSBuild
|
|
Projects="$(_WorkRoot)Archive.csproj"
|
|
Targets="Restore"
|
|
Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(MicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);AspNetUniverseBuildOffline=true" />
|
|
|
|
<!-- Add global CLI tools to the LZMA -->
|
|
|
|
<!-- Join categories (defined in artifacts.props) with package version info (defined in repos) -->
|
|
<RepoTasks.JoinItems
|
|
Left="@(ArtifactInfo)" LeftKey="PackageId" LeftMetadata="*" LeftItemSpec="PackageId"
|
|
Right="@(PackageArtifact->WithMetadataValue('LZMA', 'true')->WithMetadataValue('PackageType', 'DotnetTool'))">
|
|
<Output TaskParameter="JoinResult" ItemName="_DotnetToolPackages" />
|
|
</RepoTasks.JoinItems>
|
|
|
|
<ItemGroup>
|
|
<_DotnetToolPackages Update="@(_DotnetToolPackages)">
|
|
<DestFileName>$([System.String]::new('%(PackageId).%(Version)').ToLowerInvariant())</DestFileName>
|
|
<DestDirName>$([System.String]::new('%(PackageId)/%(Version)').ToLowerInvariant())</DestDirName>
|
|
</_DotnetToolPackages>
|
|
</ItemGroup>
|
|
|
|
<!-- No need to extract global CLI tool packages. They are extracted from the CliFallbackFolder into $HOME/.dotnet/tools by dotnet-install-tool. -->
|
|
<MakeDir Directories="$(FallbackStagingDir)\%(_DotnetToolPackages.DestDirName)\" Condition="'%(Identity)'!= ''" />
|
|
<Copy SourceFiles="$(MetapackageRestoreSource)%(_DotnetToolPackages.Identity).%(Version).nupkg" DestinationFiles="$(FallbackStagingDir)\%(DestDirName)\%(DestFileName).nupkg" Condition="'%(Identity)'!= ''" />
|
|
|
|
<!-- Create the archive -->
|
|
<Exec Command="$(ArchiverPath) -a $(FallbackOutputPath) $(FallbackStagingDir)" />
|
|
</Target>
|
|
</Project>
|