Refactor LZMA generation to support Docker and Antares usage
List explicitly as .csproj files the scenarios for which the offline package cache is important Produces new artifacts designed for various scenarios, such as: * Docker (where xml doc files are not needed) * Azure web apps (where 1.x SDKs must still be supported, but xml docs are not needed)
This commit is contained in:
parent
b68b1851c7
commit
bf03fee4be
|
|
@ -3,4 +3,8 @@
|
|||
<Import Project="build\common.props" />
|
||||
<Import Project="build\external-dependencies.props" />
|
||||
<Import Project="build\sources.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,131 +1,31 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<_TemplatesDirectory>$(MSBuildThisFileDirectory)tools\templates\</_TemplatesDirectory>
|
||||
<_WorkRoot>$(RepositoryRoot).w\</_WorkRoot>
|
||||
<PreviousArchivePropsFile>$(MSBuildThisFileDirectory)PreviousArchiveManifest.props</PreviousArchivePropsFile>
|
||||
<MetapackageRestoreSource>$(RepositoryRoot).deps\Signed\Packages\</MetapackageRestoreSource>
|
||||
<LzmaOutputPackageName>nuGetPackagesArchive-$(PackageVersion)</LzmaOutputPackageName>
|
||||
<FallbackStagingDir>$(_WorkRoot)obj\$(LzmaOutputPackageName)\</FallbackStagingDir>
|
||||
<FallbackOutputDir>$(ArtifactsDir)lzma\</FallbackOutputDir>
|
||||
<FallbackOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName).lzma</FallbackOutputPath>
|
||||
<FallbackAntaresZipOutputPath>$(FallbackOutputDir)$(LzmaOutputPackageName)-antares.zip</FallbackAntaresZipOutputPath>
|
||||
<GeneratedFallbackRestoreSourcesPropsPath>$(_WorkRoot)restoresources.$(LzmaOutputPackageName).props</GeneratedFallbackRestoreSourcesPropsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(PreviousArchivePropsFile)" Condition="Exists($(PreviousArchivePropsFile))" />
|
||||
|
||||
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo">
|
||||
<!-- 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="$(LZMAMicrosoftAspNetCoreAppAll21PackageVersion)" />
|
||||
<Target Name="BuildFallbackArchive" DependsOnTargets="ResolveRepoInfo;GeneratePropsFiles">
|
||||
|
||||
<ItemGroup>
|
||||
<_FallbackArchiveRestoreSources Include="$(RestoreSources)" />
|
||||
<_FallbackArchiveRestoreSources Include="$(BuildDir)" Condition="Exists($(BuildDir))" />
|
||||
<_FallbackArchiveRestoreSources Include="$(MetapackageRestoreSource)" Condition="Exists($(MetapackageRestoreSource))" />
|
||||
<ArchiveProjects Include="$(RepositoryRoot)src\PackageArchive\Archive.*\*.*proj" />
|
||||
</ItemGroup>
|
||||
|
||||
<RepoTasks.GenerateRestoreSourcesPropsFile
|
||||
Sources="@(_FallbackArchiveRestoreSources)"
|
||||
OutputPath="$(GeneratedFallbackRestoreSourcesPropsPath)" />
|
||||
<PropertyGroup>
|
||||
<ArchiveBuildProps>
|
||||
DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);
|
||||
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
|
||||
OutputPath=$(ArtifactsDir)lzma\;
|
||||
_BuildToolsAssembly=$(_BuildToolsAssembly)
|
||||
</ArchiveBuildProps>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Create the Staging Dir -->
|
||||
<MakeDir Directories="$(FallbackStagingDir);$(FallbackOutputDir)" />
|
||||
<Error Text="Could not find any package archive projects to build"
|
||||
Condition=" @(ArchiveProjects->Count()) == 0 " />
|
||||
|
||||
<!-- Restore the target project -->
|
||||
<MSBuild
|
||||
Projects="$(_WorkRoot)Archive.csproj"
|
||||
<MSBuild Projects="@(ArchiveProjects)"
|
||||
Targets="Restore"
|
||||
Properties="RestorePackagesPath=$(FallbackStagingDir);RuntimeFrameworkVersion=$(LZMAMicrosoftNETCoreApp21PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />
|
||||
BuildInParallel="true"
|
||||
Properties="$(ArchiveBuildProps);_Dummy=restore" />
|
||||
|
||||
<!-- Restore the netstandard2.0 project -->
|
||||
<MSBuild
|
||||
Projects="$(MSBuildThisFileDirectory)tools\templates\Archive\Archive.Library.csproj"
|
||||
Targets="Restore"
|
||||
Properties="RestorePackagesPath=$(FallbackStagingDir);NETStandardLibraryPackageVersion=$(NETStandardLibrary20PackageVersion);DotNetRestoreSourcePropsPath=$(GeneratedFallbackRestoreSourcesPropsPath);DotNetBuildOffline=true;AspNetUniverseBuildOffline=true" />
|
||||
|
||||
<!-- Create the archive -->
|
||||
<RepoTasks.CreateLzma OutputPath="$(FallbackOutputPath)" Sources="$(FallbackStagingDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="UpdatePreviousArchiveManifest">
|
||||
<Error Text="Please only specify one of PreviousLzmaUrl or PreviousLzmaFile but not both" Condition="'$(PreviousLzmaUrl)' != '' AND '$(PreviousLzmaFile)' != ''" />
|
||||
|
||||
<PropertyGroup>
|
||||
<PreviousLzmaLayout>$(_WorkRoot)previous\</PreviousLzmaLayout>
|
||||
<PreviousLzmaFile Condition="'$(PreviousLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.previous.lzma</PreviousLzmaFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Clear the directories -->
|
||||
<RemoveDir Directories="$(PreviousLzmaLayout)" />
|
||||
|
||||
<!-- Download and extract the previous LZMA if specified -->
|
||||
<KoreBuild.Tasks.DownloadFile
|
||||
Uri="$(PreviousLzmaUrl)"
|
||||
DestinationPath="$(PreviousLzmaFile)"
|
||||
Condition="'$(PreviousLzmaUrl)' != ''" />
|
||||
<RepoTasks.ExtractLzma
|
||||
InputArchive="$(PreviousLzmaFile)"
|
||||
OutputPath="$(PreviousLzmaLayout)"
|
||||
Condition="Exists($(PreviousLzmaFile))" />
|
||||
|
||||
<ItemGroup>
|
||||
<PreviousLzmaContents Remove="@(PreviousLzmaContents)" />
|
||||
<PreviousLzmaContents Include="$(PreviousLzmaLayout)**\*.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Create the archive -->
|
||||
<RepoTasks.UpdatePreviousArchiveManifest OutputPath="$(PreviousArchivePropsFile)" Contents="@(PreviousLzmaContents)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildAntaresFallbackZip">
|
||||
<Error Text="Please only specify one of InputLzmaUrl or InputLzmaFile but not both" Condition="'$(InputLzmaUrl)' != '' AND '$(InputLzmaFile)' != ''" />
|
||||
|
||||
<PropertyGroup>
|
||||
<InputLzmaLayout>$(_WorkRoot)input\</InputLzmaLayout>
|
||||
<InputLzmaFile Condition="'$(InputLzmaFile)' == ''">$(RepositoryRoot).deps\nuGetPackagesArchive.input.lzma</InputLzmaFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Clear the directories -->
|
||||
<RemoveDir Directories="$(InputLzmaLayout)" />
|
||||
|
||||
<!-- Download and extract the input LZMA if specified -->
|
||||
<KoreBuild.Tasks.DownloadFile
|
||||
Uri="$(InputLzmaUrl)"
|
||||
DestinationPath="$(InputLzmaFile)"
|
||||
Condition="'$(InputLzmaUrl)' != ''" />
|
||||
<RepoTasks.ExtractLzma
|
||||
InputArchive="$(InputLzmaFile)"
|
||||
OutputPath="$(InputLzmaLayout)"
|
||||
Condition="Exists($(InputLzmaFile))" />
|
||||
|
||||
<ItemGroup>
|
||||
<InputLzmaContents Include="$(InputLzmaLayout)**\*.*" Exclude="$(InputLzmaLayout)**\*.nupkg" />
|
||||
</ItemGroup>
|
||||
|
||||
<Error Text="No lzma content found. Please specify a lzma via InputLzmaUrl or InputLzmaFile or run the BuildFallbackArchive target." Condition="'@(InputLzmaContents)' == ''" />
|
||||
|
||||
<!-- Filter lzma content to remove existing content and .xml files -->
|
||||
<RepoTasks.FilterLzmaContent PreviousLzmaContent="@(PreviousLzmaContents)" InputLzmaContent="@(InputLzmaContents)">
|
||||
<Output TaskParameter="FilteredLzmaContent" ItemName="AntaresLzmaContents" />
|
||||
</RepoTasks.FilterLzmaContent>
|
||||
|
||||
<!-- Create antares zip -->
|
||||
<ZipArchive
|
||||
File="$(FallbackAntaresZipOutputPath)"
|
||||
SourceFiles="@(AntaresLzmaContents)"
|
||||
WorkingDirectory="$(InputLzmaLayout)"
|
||||
Overwrite="true"
|
||||
Condition="'@(AntaresLzmaContents)' != ''"/>
|
||||
<MSBuild Projects="@(ArchiveProjects)"
|
||||
Targets="Build"
|
||||
BuildInParallel="false"
|
||||
StopOnFirstFailure="true"
|
||||
Properties="$(ArchiveBuildProps)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -61,7 +61,6 @@
|
|||
<BlobBasePath>aspnetcore/Runtime/$(PackageVersion)/</BlobBasePath>
|
||||
<NpmBlobBasePath>aspnetcore/npm/</NpmBlobBasePath>
|
||||
<AliasBlobBasePath>aspnetcore/Runtime/$(SharedFxCliBlobChannel)/</AliasBlobBasePath>
|
||||
<PackageArchiveFileName>nuGetPackagesArchive-$(PackageVersion).lzma</PackageArchiveFileName>
|
||||
<InstallerBaseFileName>aspnetcore-runtime-$(PackageVersion)</InstallerBaseFileName>
|
||||
<InstallerAliasBaseFileName>aspnetcore-runtime-latest</InstallerAliasBaseFileName>
|
||||
<IntermediateInstallerBaseFileName>aspnetcore-runtime-internal-$(PackageVersion)</IntermediateInstallerBaseFileName>
|
||||
|
|
@ -75,9 +74,25 @@
|
|||
<ManifestArtifactData>ShipInstaller=dotnetcli</ManifestArtifactData>
|
||||
</FilesToPublish>
|
||||
|
||||
<!-- Package archives -->
|
||||
<FilesToPublish Include="$(DependencyAssetsDir)nuGetPackagesArchive-ci-server-$(PackageVersion).zip" >
|
||||
<RelativeBlobPath>$(BlobBasePath)nuGetPackagesArchive-ci-server-$(PackageVersion).zip</RelativeBlobPath>
|
||||
<ManifestArtifactData>ShipInstaller=dotnetcli</ManifestArtifactData>
|
||||
</FilesToPublish>
|
||||
|
||||
<FilesToPublish Include="$(DependencyAssetsDir)nuGetPackagesArchive-ci-server-$(PackageVersion).patch.zip" >
|
||||
<RelativeBlobPath>$(BlobBasePath)nuGetPackagesArchive-ci-server-$(PackageVersion).patch.zip</RelativeBlobPath>
|
||||
<ManifestArtifactData>ShipInstaller=dotnetcli</ManifestArtifactData>
|
||||
</FilesToPublish>
|
||||
|
||||
<FilesToPublish Include="$(DependencyAssetsDir)nuGetPackagesArchive-ci-server-compat-$(PackageVersion).patch.zip" >
|
||||
<RelativeBlobPath>$(BlobBasePath)nuGetPackagesArchive-ci-server-compat-$(PackageVersion).patch.zip</RelativeBlobPath>
|
||||
<ManifestArtifactData>ShipInstaller=dotnetcli</ManifestArtifactData>
|
||||
</FilesToPublish>
|
||||
|
||||
<!-- Intermediate files passed on to the dotnet-CLI. -->
|
||||
<FilesToPublish Include="$(DependencyAssetsDir)$(PackageArchiveFileName)" >
|
||||
<RelativeBlobPath>$(BlobBasePath)$(PackageArchiveFileName)</RelativeBlobPath>
|
||||
<FilesToPublish Include="$(DependencyAssetsDir)nuGetPackagesArchive-$(PackageVersion).lzma" >
|
||||
<RelativeBlobPath>$(BlobBasePath)nuGetPackagesArchive-$(PackageVersion).lzma</RelativeBlobPath>
|
||||
<ManifestArtifactData>ShipInstaller=dotnetcli</ManifestArtifactData>
|
||||
</FilesToPublish>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
<AllMetapackage>false</AllMetapackage>
|
||||
<!-- When true, this dependency will be included in the Microsoft.AspNetCore.Analyzers metapackage. -->
|
||||
<Analyzer>false</Analyzer>
|
||||
<!-- When true, this dependency will be included in the LZMA. -->
|
||||
<LZMA>false</LZMA>
|
||||
<!--
|
||||
Other known package types:
|
||||
Dependency = for packages that are installed via PackageReference
|
||||
|
|
@ -28,16 +26,16 @@
|
|||
<PackageArtifact Include="dotnet-watch" Category="ship" />
|
||||
<PackageArtifact Include="Internal.AspNetCore.Universe.Lineup" Category="noship" PackageType="Lineup" />
|
||||
<PackageArtifact Include="Microsoft.AspNet.Identity.AspNetCoreCompat" Category="noship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.All" Category="ship" LZMA="true" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.All" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Analyzers" Category="shipoob" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Antiforgery" AllMetapackage="true" AppMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.App" Category="ship" LZMA="true" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.App" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.ApplicationInsights.HostingStartup" AllMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.AspNetCoreModule" Category="noship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.AspNetCoreModuleV1" Category="noship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.Abstractions" AllMetapackage="true" AppMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.Cookies" AllMetapackage="true" AppMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.Core" AllMetapackage="true" AppMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.AspNetCore.Authentication.Facebook" AllMetapackage="true" AppMetapackage="true" Category="ship" />
|
||||
|
|
@ -268,14 +266,14 @@
|
|||
<PackageArtifact Include="Microsoft.VisualStudio.LanguageServices.Razor" Category="shipoob" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Mac.LanguageServices.Razor" Category="shipoob" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.BrowserLink" AllMetapackage="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Contracts" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Core" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Templating" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" LZMA="true" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Contracts" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Core" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Templating" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGeneration" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Category="ship" />
|
||||
<PackageArtifact Include="Microsoft.Web.Xdt.Extensions" Category="shipoob" />
|
||||
<PackageArtifact Include="RazorPageGenerator" Category="noship" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<SubmoduleRoot>$(RepositoryRoot)modules\</SubmoduleRoot>
|
||||
|
||||
<DependencyPackageDir>$(RepositoryRoot).deps\build\</DependencyPackageDir>
|
||||
<SignedDependencyPackageDir>$(RepositoryRoot).deps\Signed\Packages\</SignedDependencyPackageDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@
|
|||
<_LineupPackages Include="%(ArtifactInfo.PackageId)" Version="%(ArtifactInfo.Version)" Condition=" '%(ArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
|
||||
|
||||
<_RestoreSources Include="$(DependencyPackageDir)" Condition="'$(DependencyPackageDir)' != '' AND Exists('$(DependencyPackageDir)')" />
|
||||
<_RestoreSources Include="$(SignedDependencyPackageDir)" Condition="'$(SignedDependencyPackageDir)' != '' AND Exists('$(SignedDependencyPackageDir)')" />
|
||||
<_RestoreSources Include="$(BuildDir)" />
|
||||
<_RestoreSources Include="$(RestoreSources)" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,151 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using NuGet.Versioning;
|
||||
using RepoTasks.Utilities;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class AddArchiveReferences : Task
|
||||
{
|
||||
[Required]
|
||||
public string ReferencePackagePath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string MetaPackageVersion { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] BuildArtifacts { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] PackageArtifacts { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] ExternalDependencies { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
// Parse input
|
||||
var externalArchiveArtifacts = ExternalDependencies.Where(p => p.GetMetadata("LZMA") == "true" && p.GetMetadata("PackageType") == "Dependency");
|
||||
var externalArchiveTools = ExternalDependencies.Where(p => p.GetMetadata("LZMA") == "true" && p.GetMetadata("PackageType") == "DotnetCliTool");
|
||||
var archiveArtifacts = PackageArtifacts.Where(p => p.GetMetadata("LZMA") == "true" && p.GetMetadata("PackageType") == "Dependency");
|
||||
var archiveTools = PackageArtifacts.Where(p => p.GetMetadata("LZMA") == "true" && p.GetMetadata("PackageType") == "DotnetCliTool");
|
||||
var buildArtifacts = BuildArtifacts.Select(ArtifactInfo.Parse)
|
||||
.OfType<ArtifactInfo.Package>()
|
||||
.Where(p => !p.IsSymbolsArtifact);
|
||||
|
||||
var xmlDoc = new XmlDocument();
|
||||
xmlDoc.Load(ReferencePackagePath);
|
||||
|
||||
// Project
|
||||
var projectElement = xmlDoc.FirstChild;
|
||||
|
||||
// Items
|
||||
var itemGroupElement = xmlDoc.CreateElement("ItemGroup");
|
||||
Log.LogMessage(MessageImportance.High, $"Archive will include the following packages");
|
||||
|
||||
foreach (var package in archiveArtifacts)
|
||||
{
|
||||
var packageName = package.ItemSpec;
|
||||
|
||||
string packageVersion;
|
||||
|
||||
if (string.Equals(packageName, "Microsoft.AspNetCore.All", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(packageName, "Microsoft.AspNetCore.App", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
packageVersion = MetaPackageVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
var packageVersionCandidates = buildArtifacts.Where(p => string.Equals(p.PackageInfo.Id, packageName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!packageVersionCandidates.Any())
|
||||
{
|
||||
Log.LogError($"Missing Package: {packageName} from artifacts archive.");
|
||||
return false;
|
||||
}
|
||||
else if (packageVersionCandidates.Count() > 1)
|
||||
{
|
||||
Log.LogError($"Duplicate Packages: {packageName} from artifacts archive.");
|
||||
return false;
|
||||
}
|
||||
|
||||
packageVersion = packageVersionCandidates.Single().PackageInfo.Version.ToString();
|
||||
}
|
||||
Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersion}");
|
||||
|
||||
var packageReferenceElement = xmlDoc.CreateElement("PackageReference");
|
||||
packageReferenceElement.SetAttribute("Include", packageName);
|
||||
packageReferenceElement.SetAttribute("Version", packageVersion);
|
||||
|
||||
itemGroupElement.AppendChild(packageReferenceElement);
|
||||
}
|
||||
|
||||
foreach (var package in externalArchiveArtifacts)
|
||||
{
|
||||
var packageName = package.ItemSpec;
|
||||
var packageVersion = package.GetMetadata("Version");
|
||||
Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersion}");
|
||||
|
||||
var packageReferenceElement = xmlDoc.CreateElement("PackageReference");
|
||||
packageReferenceElement.SetAttribute("Include", packageName);
|
||||
packageReferenceElement.SetAttribute("Version", packageVersion);
|
||||
|
||||
itemGroupElement.AppendChild(packageReferenceElement);
|
||||
}
|
||||
|
||||
foreach (var package in archiveTools)
|
||||
{
|
||||
var packageName = package.ItemSpec;
|
||||
|
||||
var packageVersionCandidates = buildArtifacts.Where(p => string.Equals(p.PackageInfo.Id, packageName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!packageVersionCandidates.Any())
|
||||
{
|
||||
Log.LogError($"Missing Package: {packageName} from tools archive.");
|
||||
return false;
|
||||
}
|
||||
else if (packageVersionCandidates.Count() > 1)
|
||||
{
|
||||
Log.LogError($"Duplicate Packages: {packageName} from tools archive.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var packageVersion = packageVersionCandidates.Single().PackageInfo.Version.ToString();
|
||||
|
||||
Log.LogMessage(MessageImportance.High, $" - Tool: {packageName} Version: {packageVersion}");
|
||||
|
||||
var packageReferenceElement = xmlDoc.CreateElement("DotNetCliToolReference");
|
||||
packageReferenceElement.SetAttribute("Include", packageName);
|
||||
packageReferenceElement.SetAttribute("Version", packageVersion);
|
||||
|
||||
itemGroupElement.AppendChild(packageReferenceElement);
|
||||
}
|
||||
|
||||
foreach (var package in externalArchiveTools)
|
||||
{
|
||||
var packageName = package.ItemSpec;
|
||||
var packageVersion = package.GetMetadata("Version");
|
||||
Log.LogMessage(MessageImportance.High, $" - Tool: {packageName} Version: {packageVersion}");
|
||||
|
||||
var packageReferenceElement = xmlDoc.CreateElement("DotNetCliToolReference");
|
||||
packageReferenceElement.SetAttribute("Include", packageName);
|
||||
packageReferenceElement.SetAttribute("Version", packageVersion);
|
||||
|
||||
itemGroupElement.AppendChild(packageReferenceElement);
|
||||
}
|
||||
projectElement.AppendChild(itemGroupElement);
|
||||
|
||||
// Save updated file
|
||||
xmlDoc.AppendChild(projectElement);
|
||||
xmlDoc.Save(ReferencePackagePath);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,30 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Archive;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class CreateLzma : Task
|
||||
public class CreateLzma : Task, ICancelableTask
|
||||
{
|
||||
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
|
||||
|
||||
[Required]
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string[] Sources { get; set; }
|
||||
|
||||
public void Cancel() => _cts.Cancel();
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var progress = new ConsoleProgressReport();
|
||||
var progress = new MSBuildProgressReport(Log, _cts.Token);
|
||||
using (var archive = new IndexedArchive())
|
||||
{
|
||||
foreach (var source in Sources)
|
||||
|
|
@ -39,7 +45,26 @@ namespace RepoTasks
|
|||
archive.Save(OutputPath, progress);
|
||||
}
|
||||
|
||||
return true;
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
|
||||
private class MSBuildProgressReport : IProgress<ProgressReport>
|
||||
{
|
||||
private TaskLoggingHelper _log;
|
||||
private readonly CancellationToken _cancellationToken;
|
||||
|
||||
public MSBuildProgressReport(TaskLoggingHelper log, CancellationToken cancellationToken)
|
||||
{
|
||||
_log = log;
|
||||
_cancellationToken = cancellationToken;
|
||||
}
|
||||
|
||||
public void Report(ProgressReport value)
|
||||
{
|
||||
var complete = (double)value.Ticks / value.Total;
|
||||
_log.LogMessage(MessageImportance.Low, $"Progress: {value.Phase} - {complete:P}");
|
||||
_cancellationToken.ThrowIfCancellationRequested(); // because LZMA apis don't take a cancellation token, throw from the logger (yes, its ugly, but it works.)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Archive;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class ExtractLzma : Task
|
||||
{
|
||||
[Required]
|
||||
public string InputArchive { get; set; }
|
||||
|
||||
[Required]
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
Log.LogMessage(MessageImportance.High, $"Extracting LZMA: {InputArchive}");
|
||||
new IndexedArchive().Extract(InputArchive, OutputPath, new ConsoleProgressReport());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using RepoTasks.Utilities;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class FilterLzmaContent : Task
|
||||
{
|
||||
public ITaskItem[] PreviousLzmaContent { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] InputLzmaContent { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] FilteredLzmaContent { get; set; }
|
||||
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var previousContent = new HashSet<ITaskItem>(new ITaskItemComparer());
|
||||
var inputContent = new HashSet<ITaskItem>(new ITaskItemComparer());
|
||||
// Keeping dlls separate for use to trim xml
|
||||
var inputDlls = new HashSet<ITaskItem>(new ITaskItemComparer());
|
||||
var newContent = new List<ITaskItem>();
|
||||
|
||||
if (PreviousLzmaContent != null)
|
||||
{
|
||||
foreach (var item in PreviousLzmaContent)
|
||||
{
|
||||
// To round trip correctly, overwrite RecursiveDir with RelativeDir
|
||||
item.SetMetadata("RecursiveDir", item.GetMetadata("RelativeDir"));
|
||||
previousContent.Add(item);
|
||||
}
|
||||
}
|
||||
foreach (var item in InputLzmaContent)
|
||||
{
|
||||
var extension = item.GetExtension();
|
||||
|
||||
inputContent.Add(item);
|
||||
if (string.Equals(".dll", extension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
inputDlls.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in inputContent)
|
||||
{
|
||||
// skip if contained in the previous LZMA
|
||||
if (previousContent.Contains(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip if the file is an .xml that is matched with a .dll file
|
||||
if (string.Equals(".xml", item.GetExtension(), StringComparison.OrdinalIgnoreCase)
|
||||
&& inputDlls.Any(dll =>
|
||||
// Match by filename
|
||||
string.Equals(item.GetFileName(), dll.GetFileName(), StringComparison.OrdinalIgnoreCase)
|
||||
// Match by folder structure (.xml must be under .dll's folder)
|
||||
&& item.GetRecursiveDir().StartsWith(dll.GetRecursiveDir())))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
newContent.Add(item);
|
||||
}
|
||||
|
||||
FilteredLzmaContent = newContent.ToArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class ITaskItemComparer : IEqualityComparer<ITaskItem>
|
||||
{
|
||||
public bool Equals(ITaskItem x, ITaskItem y)
|
||||
=> string.Equals(x.GetRecursiveDir(), y.GetRecursiveDir(), StringComparison.OrdinalIgnoreCase)
|
||||
&& string.Equals(x.GetFileName(), y.GetFileName(), StringComparison.OrdinalIgnoreCase)
|
||||
&& string.Equals(x.GetExtension(), y.GetExtension(), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
public int GetHashCode(ITaskItem obj)
|
||||
=> $"{obj.GetRecursiveDir()}{obj.GetFileName()}{obj.GetExtension()}".GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Filters a list of .xml files to only those that are .NET Xml docs files
|
||||
/// </summary>
|
||||
public class GetDocXmlFiles : Microsoft.Build.Utilities.Task
|
||||
{
|
||||
[Required]
|
||||
public ITaskItem[] Files { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] XmlDocFiles { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var xmlDocs = new ConcurrentBag<ITaskItem>();
|
||||
Parallel.ForEach(Files, f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var file = File.OpenRead(f.ItemSpec))
|
||||
using (var reader = new StreamReader(file))
|
||||
{
|
||||
string line;
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
line = reader.ReadLine();
|
||||
if (i == 0 && line.StartsWith("<?xml", StringComparison.Ordinal))
|
||||
{
|
||||
line = line.Substring(line.IndexOf("?>") + 2);
|
||||
}
|
||||
|
||||
if (line.StartsWith("<doc>", StringComparison.OrdinalIgnoreCase) || line.StartsWith("<doc xml:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
xmlDocs.Add(f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Normal, $"Failed to read {f.ItemSpec}: {ex.ToString()}");
|
||||
}
|
||||
|
||||
Log.LogMessage($"Did not detect {f.ItemSpec} as an xml doc file");
|
||||
});
|
||||
|
||||
XmlDocFiles = xmlDocs.ToArray();
|
||||
Log.LogMessage($"Found {XmlDocFiles.Length} xml doc file(s)");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,24 +3,21 @@
|
|||
<_RepoTaskAssembly>$(MSBuildThisFileDirectory)bin\publish\RepoTasks.dll</_RepoTaskAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<UsingTask TaskName="RepoTasks.AddArchiveReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.AddMetapackageReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.AnalyzeBuildGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckExpectedPackagesExist" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckRepoGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckVersionOverrides" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CreateLzma" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.ExtractLzma" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.FilterLzmaContent" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.GenerateRestoreSourcesPropsFile" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.GenerateSubmoduleGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.GetDocXmlFiles" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.JoinItems" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.OrderBy" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.ProcessSharedFrameworkDeps" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.PublishToAzureBlob" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.ResolveSymbolsRecursivePath" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.TrimDeps" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.UpdatePreviousArchiveManifest" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.VerifyCoherentVersions" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
|
||||
<!-- tools from dotnet-buildtools -->
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using NuGet.Versioning;
|
||||
using RepoTasks.Utilities;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class UpdatePreviousArchiveManifest : Task
|
||||
{
|
||||
[Required]
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] Contents { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var xmlDoc = new XmlDocument();
|
||||
|
||||
// Project
|
||||
var projectElement = xmlDoc.CreateElement("Project");
|
||||
|
||||
// Items
|
||||
var itemGroupElement = xmlDoc.CreateElement("ItemGroup");
|
||||
|
||||
foreach (var content in Contents)
|
||||
{
|
||||
var contentElement = xmlDoc.CreateElement("PreviousLzmaContents");
|
||||
contentElement.SetAttribute("Include", $"{content.GetRecursiveDir()}{content.GetFileName()}{content.GetExtension()}");
|
||||
itemGroupElement.AppendChild(contentElement);
|
||||
// Recursive will be lost during round tripping using a props file. To fix this, set the RecursiveDir to RelativeDir.
|
||||
// This can only be done in a task as MSBuild prevents overwritting reserved metadata.
|
||||
}
|
||||
|
||||
projectElement.AppendChild(itemGroupElement);
|
||||
|
||||
// Save updated file
|
||||
xmlDoc.AppendChild(projectElement);
|
||||
xmlDoc.Save(OutputPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
|
||||
namespace RepoTasks.Utilities
|
||||
{
|
||||
public static class ITaskItemExtensions
|
||||
{
|
||||
public static string GetRecursiveDir(this ITaskItem item)
|
||||
=> item.GetMetadata("RecursiveDir");
|
||||
public static string GetFileName(this ITaskItem item)
|
||||
=> item.GetMetadata("Filename");
|
||||
public static string GetExtension(this ITaskItem item)
|
||||
=> item.GetMetadata("Extension");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<EnableApiCheck>false</EnableApiCheck>
|
||||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
|
||||
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
|
||||
<RestoreSources>$(RestoreSources);$(DotNetRestoreSources);</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NETStandard.Library" Version="$(NETStandardLibraryPackageVersion)"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<Project>
|
||||
<Import Project="..\Archive.props" />
|
||||
|
||||
<!-- Same as Archive.CiServer.Patch, but it includes .nupkg files for compatibility with 1.x versions of the .NET Core SDK -->
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFileName>nuGetPackagesArchive-ci-server-compat-$(PackageVersion).patch.zip</TargetFileName>
|
||||
<IsIncremental>true</IsIncremental>
|
||||
<IncludeXmlDocs>false</IncludeXmlDocs>
|
||||
<IncludeNupkgFiles>true</IncludeNupkgFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\Archive.targets" />
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,13 @@
|
|||
<Project>
|
||||
<Import Project="..\Archive.props" />
|
||||
|
||||
<!-- Same as Archive.CiServer, but in only includes files which have not previously been included in a stable release. -->
|
||||
<PropertyGroup>
|
||||
<TargetFileName>nuGetPackagesArchive-ci-server-$(PackageVersion).patch.zip</TargetFileName>
|
||||
<IsIncremental>true</IsIncremental>
|
||||
<IncludeXmlDocs>false</IncludeXmlDocs>
|
||||
<IncludeNupkgFiles>false</IncludeNupkgFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\Archive.targets" />
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,14 @@
|
|||
<Project>
|
||||
<Import Project="..\Archive.props" />
|
||||
|
||||
<!-- This archive is optimized for CI server environments which do not need .nupkg files or xml docs, such as Docker. -->
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFileName>nuGetPackagesArchive-ci-server-$(PackageVersion).zip</TargetFileName>
|
||||
<IsIncremental>false</IsIncremental>
|
||||
<IncludeXmlDocs>false</IncludeXmlDocs>
|
||||
<IncludeNupkgFiles>false</IncludeNupkgFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\Archive.targets" />
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<Project>
|
||||
<Import Project="..\Archive.props" />
|
||||
|
||||
<!-- This archive is passed along to dotnet/cli for use with the .NET Core CLI first run experience. -->
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFileName>nuGetPackagesArchive-$(PackageVersion).lzma</TargetFileName>
|
||||
<IsIncremental>false</IsIncremental>
|
||||
<IncludeXmlDocs>true</IncludeXmlDocs>
|
||||
<IncludeNupkgFiles>true</IncludeNupkgFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\Archive.targets" />
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<Project>
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
|
||||
|
||||
<Import Project="..\..\build\tasks\RepoTasks.tasks" />
|
||||
<UsingTask TaskName="Microsoft.AspNetCore.BuildTools.ZipArchive" AssemblyFile="$(_BuildToolsAssembly)" Condition=" '$(_BuildToolsAssembly)' != '' "/>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Required to make /t:Restore happy, but not really used for anything else. -->
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<Project>
|
||||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
|
||||
|
||||
<!-- Default items -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)Scenario.*\Scenario.*.*proj" ReferenceOutputAssembly="false" />
|
||||
<ArchiveBaseline Include="$(MSBuildProjectDirectory)\ArchiveBaseline.*.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Targets items -->
|
||||
|
||||
<Target Name="PrepareOutputPaths">
|
||||
<MakeDir Directories="$(TargetDir)" />
|
||||
<Delete Files="$(TargetPath)" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<CollectInputsDependsOn Condition=" '$(IncludeNupkgFiles)' == 'false' ">$(CollectInputsDependsOn);CollectNupkgExclusions</CollectInputsDependsOn>
|
||||
<CollectInputsDependsOn Condition=" '$(IncludeXmlDocs)' == 'false' ">$(CollectInputsDependsOn);CollectXmlExclusions</CollectInputsDependsOn>
|
||||
<CollectInputsDependsOn Condition=" '$(IsIncremental)' == 'true' ">$(CollectInputsDependsOn);CollectBaselineExclusions</CollectInputsDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CollectNupkgExclusions">
|
||||
<ItemGroup>
|
||||
<ArchiveExclusions Include="$(RestorePackagesPath)**\*.nupkg" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="CollectXmlExclusions">
|
||||
<ItemGroup>
|
||||
<_ArchiveItemXml Include="$(RestorePackagesPath)**\*.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="Found @(_ArchiveItemXml->Count()) xml files that might be docxml" />
|
||||
|
||||
<RepoTasks.GetDocXmlFiles Files="@(_ArchiveItemXml)">
|
||||
<Output TaskParameter="XmlDocFiles" ItemName="ArchiveExclusions" />
|
||||
</RepoTasks.GetDocXmlFiles>
|
||||
</Target>
|
||||
|
||||
<Target Name="CollectBaselineExclusions">
|
||||
<ReadLinesFromFile File="%(ArchiveBaseline.Identity)" Condition="'%(ArchiveBaseline.Identity)' != ''">
|
||||
<Output TaskParameter="Lines" ItemName="PreviousArchiveItem" />
|
||||
</ReadLinesFromFile>
|
||||
|
||||
<ItemGroup>
|
||||
<ArchiveExclusions Include="$(RestorePackagesPath)%(PreviousArchiveItem.Identity)" Condition=" '%(PreviousArchiveItem.Identity)' != '' " />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="CollectInputs" DependsOnTargets="$(CollectInputsDependsOn)">
|
||||
<ItemGroup>
|
||||
<ArchiveItem Include="$(RestorePackagesPath)**\*" Exclude="@(ArchiveExclusions)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="Found @(ArchiveItem->Count()) files to put in the CI package archive" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateArchive" Outputs="$(TargetPath)">
|
||||
<Warning Text="No files were found to put into $(TargetPath)"
|
||||
Condition="@(ArchiveItem->Count()) == 0 AND '$(IsIncremental)' == 'true' " />
|
||||
|
||||
<Error Text="No files were found to put into $(TargetPath)"
|
||||
Condition="@(ArchiveItem->Count()) == 0 AND '$(IsIncremental)' != 'true' " />
|
||||
|
||||
<ZipArchive
|
||||
File="$(TargetPath)"
|
||||
SourceFiles="@(ArchiveItem)"
|
||||
WorkingDirectory="$(RestorePackagesPath)"
|
||||
Overwrite="true"
|
||||
Condition="@(ArchiveItem->Count()) != 0 AND '$(MSBuildProjectExtension)' == '.zipproj'" />
|
||||
|
||||
<RepoTasks.CreateLzma
|
||||
OutputPath="$(TargetPath)"
|
||||
Sources="$(RestorePackagesPath)"
|
||||
Condition="@(ArchiveItem->Count()) != 0 AND '$(MSBuildProjectExtension)' == '.lzmaproj'" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CheckForInvalidConfig">
|
||||
<Error Text=".lzmaproj currently only supports zipping an entire directory with everything in it."
|
||||
Condition="'$(MSBuildProjectExtension)' == '.lzmaproj' AND ( '$(IsIncremental)' == 'true' OR '$(IncludeNupkgFiles)' == 'false' OR '$(IncludeXmlDocs)' == 'false' ) "/>
|
||||
</Target>
|
||||
|
||||
<Target Name="CheckForPreviousReleaseArchiveBaseline" Condition=" '$(AspNetCorePatchVersion)' != '0' AND '$(IsIncremental)' == 'true' ">
|
||||
<PropertyGroup>
|
||||
<PreviousStableVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$([MSBuild]::Subtract($(AspNetCorePatchVersion), 1))</PreviousStableVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Error Text="The ArchiveBaseline for previous release (v$(PreviousStableVersion)) could not be found. This is required to build the incremental archives. See instructions in $(MSBuildThisFileDirectory)ZipManifestGenerator\README.md"
|
||||
Condition="! Exists('$(MSBuildProjectDirectory)\ArchiveBaseline.$(PreviousStableVersion).txt')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Build"
|
||||
DependsOnTargets="PrepareOutputPaths;CheckForInvalidConfig;CheckForPreviousReleaseArchiveBaseline;CollectInputs;CreateArchive"
|
||||
Outputs="$(TargetPath)" />
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<Project>
|
||||
<Import Project="..\..\Directory.Build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Don't restore from any fallback folder -->
|
||||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
|
||||
<!-- Projects in this folder should be explicit about the packages they reference -->
|
||||
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
|
||||
|
||||
<RestorePackagesPath>$([MSBuild]::NormalizePath('$(RepositoryRoot)obj\pkgs\'))</RestorePackagesPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<Project />
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NETStandard.Library" Version="$(NETStandardLibrary20PackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<MaxImplicitVersion>2.1.0</MaxImplicitVersion>
|
||||
<!-- Use pre-release versions up until 2.1.0, then don't lift higher than "2.1.0" -->
|
||||
<MicrosoftNETCoreAppPackageVersion Condition="$(MicrosoftNETCoreApp21PackageVersion.StartsWith('$(MaxImplicitVersion)-'))">$(MicrosoftNETCoreApp21PackageVersion)</MicrosoftNETCoreAppPackageVersion>
|
||||
<MicrosoftNETCoreAppPackageVersion>$([MSbuild]::ValueOrDefault('$(MicrosoftNETCoreAppPackageVersion)','$(MaxImplicitVersion)'))</MicrosoftNETCoreAppPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.App" Version="$(MicrosoftNETCoreAppPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="$(MicrosoftAspNetCoreAllPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="$(MicrosoftAspNetCoreAuthenticationAzureADUIPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="$(MicrosoftAspNetCoreAuthenticationAzureADB2CUIPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Contracts" Version="$(MicrosoftVisualStudioWebCodeGenerationContractsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Core" Version="$(MicrosoftVisualStudioWebCodeGenerationCorePackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="$(MicrosoftVisualStudioWebCodeGenerationDesignPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" Version="$(MicrosoftVisualStudioWebCodeGenerationEntityFrameworkCorePackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Templating" Version="$(MicrosoftVisualStudioWebCodeGenerationTemplatingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="$(MicrosoftVisualStudioWebCodeGenerationUtilsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="$(MicrosoftVisualStudioWebCodeGenerationPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="$(MicrosoftVisualStudioWebCodeGeneratorsMvcPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZipManifestGenerator
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static void PrintUsage()
|
||||
{
|
||||
Console.WriteLine(@"
|
||||
Usage: <ZIP> <OUTPUT>
|
||||
|
||||
<ZIP> A file path or URL to the ZIP file.
|
||||
<OUTPUT> The output file path for the ZIP manifest file.");
|
||||
}
|
||||
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
Console.Error.WriteLine("Invalid arguments");
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
var zipPath = args[0];
|
||||
var manifestOutputPath = args[1];
|
||||
|
||||
var shouldCleanupZip = false;
|
||||
|
||||
if (zipPath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
shouldCleanupZip = true;
|
||||
var url = zipPath;
|
||||
Console.WriteLine($"log: Downloading {url}");
|
||||
zipPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".zip");
|
||||
var response = await new HttpClient().GetAsync(url);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
using (var outStream = File.Create(zipPath))
|
||||
{
|
||||
var responseStream = await response.Content.ReadAsStreamAsync();
|
||||
await responseStream.CopyToAsync(outStream);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine($"log: Generating manifest in {manifestOutputPath}");
|
||||
|
||||
using (var zipStream = File.OpenRead(zipPath))
|
||||
using (var zip = new ZipArchive(zipStream, ZipArchiveMode.Read))
|
||||
using (var manifest = File.Create(manifestOutputPath))
|
||||
using (var writer = new StreamWriter(manifest))
|
||||
{
|
||||
foreach (var file in zip.Entries.OrderBy(_ => _.FullName))
|
||||
{
|
||||
writer.WriteLine(file.FullName.Replace("/", "\\"));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (shouldCleanupZip)
|
||||
{
|
||||
File.Delete(zipPath);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
ZipManifestGenerator
|
||||
---------
|
||||
|
||||
This console app is used to generate the list of files in a zip archive.
|
||||
|
||||
Usage:
|
||||
```
|
||||
dotnet run ./archive.zip files.txt
|
||||
```
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<PublicSign>false</PublicSign>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26124.0
|
||||
MinimumVisualStudioVersion = 15.0.26124.0
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipManifestGenerator", "ZipManifestGenerator.csproj", "{4706B37C-3B37-4331-84FC-107657BDEC4E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4706B37C-3B37-4331-84FC-107657BDEC4E}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Loading…
Reference in New Issue