aspnetcore/build/PackageArchive.targets

56 lines
2.6 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" />
<!-- Create the archive -->
<Exec Command="$(ArchiverPath) -a $(FallbackOutputPath) $(FallbackStagingDir)" />
</Target>
</Project>