Merge pull request #6463 from livarcocc/lzma_from_aspnet

Removing the code to generate the lzma archive
This commit is contained in:
Livar 2017-05-02 14:26:11 -07:00 committed by GitHub
commit 0560b1e546
6 changed files with 9 additions and 249 deletions

View file

@ -30,6 +30,10 @@
<CombinedSharedHostAndFrameworkArchive>$(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive</CombinedSharedHostAndFrameworkArchive>
</PropertyGroup>
<PropertyGroup>
<AspNetCoreRuntimeInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion)</AspNetCoreRuntimeInstallerBlobRootUrl>
</PropertyGroup>
<ItemGroup>
<_DownloadAndExtractItem Include="CombinedSharedHostAndFrameworkArchive"
Condition="!Exists('$(CombinedSharedHostAndFrameworkArchive)')">

View file

@ -17,6 +17,7 @@
<PlatformAbstractionsVersion>2.0.0-preview1-002101</PlatformAbstractionsVersion>
<DependencyModelVersion>2.0.0-preview1-002101</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.0-alpha-142</CliCommandLineParserVersion>
<AspNetCoreRuntimeVersion>2.0.0-preview1-56</AspNetCoreRuntimeVersion>
</PropertyGroup>

View file

@ -2,127 +2,20 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UploadNuGetPackagesArchiveToAzure>false</UploadNuGetPackagesArchiveToAzure>
<NuGetConfigContent>
&lt;configuration&gt;
&lt;packageSources&gt;
&lt;add key="configurable.source" value="%CLI_LZMA_PACKAGE_SOURCE%" /&gt;
&lt;/packageSources&gt;
&lt;/configuration&gt;
</NuGetConfigContent>
<NuGetPackagesArchiveProject>$(IntermediateDirectory)/NuGetPackagesArchiveProject</NuGetPackagesArchiveProject>
<NuGetPackagesArchiveFolder>$(IntermediateDirectory)/NuGetPackagesArchiveFolder</NuGetPackagesArchiveFolder>
<LZMANuGetConfigFilePath Condition=" '$(CLI_LZMA_PACKAGE_SOURCE)' != '' ">$(NuGetPackagesArchiveProject)/Nuget.config</LZMANuGetConfigFilePath>
<LZMANuGetConfigFilePath Condition=" '$(LZMANuGetConfigFilePath)' == '' ">$(RepoRoot)/NuGet.Config</LZMANuGetConfigFilePath>
<ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory>
<ArchiverDll>$(ToolsOutputDirectory)/Archiver.dll</ArchiverDll>
<FinalArchive>$(SdkOutputDirectory)/nuGetPackagesArchive.lzma</FinalArchive>
<NugetPackagesArchiveName>nuGetPackagesArchive.notimestamp.lzma</NugetPackagesArchiveName>
<IntermediateArchive>$(IntermediateDirectory)/$(NugetPackagesArchiveName)</IntermediateArchive>
<NugetPackagesArchiveBlobUrl>$(AspNetCoreRuntimeInstallerBlobRootUrl)/$(NugetPackagesArchiveName)</NugetPackagesArchiveBlobUrl>
</PropertyGroup>
<Target Name="GetNuGetPackagesArchive"
DependsOnTargets="SetupNuGetPackagesArchiveInputsOutputs;
DownloadNuGetPackagesArchive;
GenerateNuGetPackagesArchive;
UploadNuGetPackagesArchiveToAzure"
Inputs="$(IntermediateArchive)"
Outputs="$(FinalArchive)"
Condition=" '$(IncludeNuGetPackageArchive)' == 'true' ">
<Copy SourceFiles="$(IntermediateArchive)" DestinationFiles="$(FinalArchive)" />
</Target>
<Target Name="UploadNuGetPackagesArchiveToAzure"
DependsOnTargets="SetupNuGetPackagesArchiveInputsOutputs;
GenerateNuGetPackagesArchive"
Condition=" '$(UploadNuGetPackagesArchiveToAzure)' == 'true' And '$(PUBLISH_LZMA_TO_AZURE_BLOB)' != '' ">
<ItemGroup>
<NuGetPackagesArchiveToUpload Include="$(IntermediateArchive)" />
</ItemGroup>
<ItemGroup>
<NuGetPackagesArchiveToUpload>
<RelativeBlobPath>$(NugetPackagesArchiveRelativeBlobUrl)/$([System.String]::Copy('%(Filename)%(Extension)').Replace('\' ,'/'))</RelativeBlobPath>
</NuGetPackagesArchiveToUpload>
</ItemGroup>
<UploadToAzure
AccountKey="$(ArtifactCloudDropAccessToken)"
AccountName="$(ArtifactCloudDropAccountName)"
ContainerName="$(ArtifactContainerName)"
Items="@(NuGetPackagesArchiveToUpload)"
Overwrite="false"
ContinueOnError="WarnAndContinue" />
</Target>
<Target Name="DownloadNuGetPackagesArchive"
DependsOnTargets="SetupNuGetPackagesArchiveInputsOutputs"
Inputs="$(IntermediateArchive)"
Outputs="$(IntermediateArchive)">
<DownloadFile Uri="$(NugetPackagesArchiveBlobUrl)"
DestinationPath="$(IntermediateArchive)"
ContinueOnError="WarnAndContinue" />
</Target>
<Target Name="GenerateNuGetPackagesArchive"
DependsOnTargets="SetupNuGetPackagesArchiveInputsOutputs"
Inputs="$(IntermediateArchive)"
Outputs="$(IntermediateArchive)">
<!-- I need to use the CreateProperty task in conjunction with the ValueSetByTask TaskParameter -->
<!-- to ensure that the property only gets set when the parent target is run. -->
<CreateProperty Value="true">
<Output TaskParameter="ValueSetByTask" PropertyName="UploadNuGetPackagesArchiveToAzure" />
</CreateProperty>
<ItemGroup>
<FilesToClean Include="$(NuGetPackagesArchiveProject)/**/*" />
<FilesToClean Include="$(NuGetPackagesArchiveFolder)/**/*" />
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveProject)/MvcIndividual" />
<NuGetPackagesArchiveDirectory Include="$(NuGetPackagesArchiveFolder)" />
</ItemGroup>
<Delete Files="@(FilesToClean)" />
<RemoveDir Directories="@(NuGetPackagesArchiveDirectory)" />
<MakeDir Directories="@(NuGetPackagesArchiveDirectory)"/>
<WriteLinesToFile Condition=" '$(CLI_LZMA_PACKAGE_SOURCE)' != '' "
File="$(LZMANuGetConfigFilePath)"
Lines="$(NuGetConfigContent)" />
<DotNetNew ToolPath="$(OutputDirectory)"
TemplateType="mvc"
TemplateArgs="-au Individual --debug:ephemeral-hive --no-restore"
WorkingDirectory="$(NuGetPackagesArchiveProject)/MvcIndividual" />
<DotNetRestore ToolPath="$(OutputDirectory)"
Packages="$(NuGetPackagesArchiveFolder)"
ConfigFile="$(LZMANuGetConfigFilePath)"
SkipInvalidConfigurations="True"
WorkingDirectory="$(NuGetPackagesArchiveProject)/MvcIndividual" />
<Delete Files="$(IntermediateArchive);$(IntermediateArchive).zip;$(NuGetPackagesArchiveFolder)/**/*.nupkg" />
<Message Text="Publishing Archiver" />
<DotNetPublish ToolPath="$(OutputDirectory)"
WorkingDirectory="$(RepoRoot)/tools/Archiver"
Output="$(ToolsOutputDirectory)"
Configuration="$(Configuration)" />
<Exec Command="$(DotnetInOutputDirectory) $(ArchiverDll) -a $(IntermediateArchive) $(NuGetPackagesArchiveFolder)" />
</Target>
<Target Name="SetupNuGetPackagesArchiveInputsOutputs">
<GenerateNuGetPackagesArchiveVersion ToolPath="$(OutputDirectory)" SDKVersion="$(CLI_NETSDK_Version)">
<Output TaskParameter="Version" PropertyName="NuGetPackagesArchiveVersion" />
</GenerateNuGetPackagesArchiveVersion>
<PropertyGroup>
<NugetPackagesArchiveName>nuGetPackagesArchive.$(NuGetPackagesArchiveVersion).lzma</NugetPackagesArchiveName>
<IntermediateArchive>$(IntermediateDirectory)/$(NugetPackagesArchiveName)</IntermediateArchive>
<NugetPackagesArchiveRelativeBlobUrl>$(Product)/NuGetPackagesArchives</NugetPackagesArchiveRelativeBlobUrl>
<NugetPackagesArchiveBlobUrl>$(DotnetBlobRootUrl)/$(NugetPackagesArchiveRelativeBlobUrl)/$(NugetPackagesArchiveName)</NugetPackagesArchiveBlobUrl>
</PropertyGroup>
<Copy SourceFiles="$(IntermediateArchive)" DestinationFiles="$(FinalArchive)" />
</Target>
</Project>

View file

@ -1,96 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Cli.CommandLine;
//using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Archive;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
namespace Microsoft.DotNet.Tools.Archive
{
public partial class ArchiveCommand
{
public static int Main(string[] args)
{
//DebugHelper.HandleDebugSwitch(ref args);
var app = new CommandLineApplication();
app.Name = "archive";
app.FullName = ".NET archiver";
app.Description = "Archives and expands sets of files";
app.HelpOption("-h|--help");
var extract = app.Option("-x|--extract <outputDirectory>", "Directory to extract to", CommandOptionType.SingleValue);
var archiveFile = app.Option("-a|--archive <file>", "Archive to operate on", CommandOptionType.SingleValue);
var externals = app.Option("--external <external>...", "External files and directories to consider for extraction", CommandOptionType.MultipleValue);
var sources = app.Argument("<sources>...", "Files & directory to include in the archive", multipleValues:true);
app.OnExecute(() => {
if (extract.HasValue() && sources.Values.Any())
{
Console.WriteLine("Extract '-x' can only be specified when no '<sources>' are specified to add to the archive.");
return 1;
}
else if (!extract.HasValue() && !sources.Values.Any())
{
Console.WriteLine("Either extract '-x' or '<sources>' must be specified.");
return 1;
}
if (!archiveFile.HasValue())
{
Console.WriteLine("Archive '-a' must be specified.");
return 1;
}
var progress = new ConsoleProgressReport();
var archive = new IndexedArchive();
foreach (var external in externals.Values)
{
if (Directory.Exists(external))
{
archive.AddExternalDirectory(external);
}
else
{
archive.AddExternalFile(external);
}
}
if (sources.Values.Any())
{
foreach(var source in sources.Values)
{
if (Directory.Exists(source))
{
archive.AddDirectory(source, progress);
}
else
{
archive.AddFile(source, Path.GetFileName(source));
}
}
archive.Save(archiveFile.Value(), progress);
}
else // sources not specified, extract must have been specified
{
archive.Extract(archiveFile.Value(), extract.Value(), progress);
}
return 0;
});
return app.Execute(args);
}
}
}

View file

@ -1,20 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\dotnet\CommandLine\*.cs;..\dotnet\CommonLocalizableStrings.cs;" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="$(CLI_SharedFrameworkVersion)" />
</ItemGroup>
</Project>

View file

@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\dotnet-archive\*.cs;..\..\src\dotnet\CommandLine\*.cs;..\..\src\dotnet\CommonLocalizableStrings.cs;" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.DotNet.Archive\Microsoft.DotNet.Archive.csproj" />
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="$(CLI_SharedFrameworkVersion)" />
</ItemGroup>
</Project>