Finish converting 'Prepare' to MSBuild.
Implement DownloadHostAndSharedFxArtifacts Implement ZipTemplates Switch the Prepare target to use all the MSBuild targets.
This commit is contained in:
parent
2ed5363187
commit
15642cfd2a
12 changed files with 157 additions and 94 deletions
35
build_projects/dotnet-cli-build/ExtractArchive.cs
Normal file
35
build_projects/dotnet-cli-build/ExtractArchive.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.IO.Compression;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class ExtractArchive : Task
|
||||
{
|
||||
[Required]
|
||||
public string InputFile { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DestinationDirectory { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
FS.Mkdirp(DestinationDirectory);
|
||||
|
||||
Log.LogMessage($"Extracting Archive '{InputFile}' to '{DestinationDirectory}'");
|
||||
|
||||
if (CurrentPlatform.IsWindows)
|
||||
{
|
||||
ZipFile.ExtractToDirectory(InputFile, DestinationDirectory);
|
||||
}
|
||||
else
|
||||
{
|
||||
Exec("tar", "xf", InputFile, "-C", DestinationDirectory);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue