Finish converting 'Prepare' to MSBuild.

Implement DownloadHostAndSharedFxArtifacts
Implement ZipTemplates
Switch the Prepare target to use all the MSBuild targets.
This commit is contained in:
Eric Erhardt 2016-06-29 02:41:38 -05:00
parent 2ed5363187
commit 15642cfd2a
12 changed files with 157 additions and 94 deletions

View file

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.25402.0 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
EndProject EndProject
@ -126,9 +126,20 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-build3.Tests", "test
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4-BC0F-443B-8ADF-691321F10108}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{89905EC4-BC0F-443B-8ADF-691321F10108}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
build\Microsoft.DotNet.Cli.Package.targets = build\Microsoft.DotNet.Cli.Package.targets
build\Microsoft.DotNet.Cli.Prepare.targets = build\Microsoft.DotNet.Cli.Prepare.targets build\Microsoft.DotNet.Cli.Prepare.targets = build\Microsoft.DotNet.Cli.Prepare.targets
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "package", "package", "{31A6D092-F50C-4D70-BA4D-97098189A953}"
ProjectSection(SolutionItems) = preProject
build\package\Microsoft.DotNet.Cli.Archive.targets = build\package\Microsoft.DotNet.Cli.Archive.targets
build\package\Microsoft.DotNet.Cli.Installer.DEB.targets = build\package\Microsoft.DotNet.Cli.Installer.DEB.targets
build\package\Microsoft.DotNet.Cli.Installer.MSI.targets = build\package\Microsoft.DotNet.Cli.Installer.MSI.targets
build\package\Microsoft.DotNet.Cli.Installer.PKG.targets = build\package\Microsoft.DotNet.Cli.Installer.PKG.targets
build\package\Microsoft.DotNet.Cli.Layout.targets = build\package\Microsoft.DotNet.Cli.Layout.targets
build\package\Microsoft.DotNet.Cli.Nupkg.targets = build\package\Microsoft.DotNet.Cli.Nupkg.targets
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -967,5 +978,6 @@ Global
{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{49D7318E-D198-4E2B-BBEA-3A24D805F88D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {49D7318E-D198-4E2B-BBEA-3A24D805F88D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{31A6D092-F50C-4D70-BA4D-97098189A953} = {89905EC4-BC0F-443B-8ADF-691321F10108}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -20,6 +20,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot> <RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<CoreSetupChannel>preview</CoreSetupChannel>
<SharedFrameworkVersion>1.0.0</SharedFrameworkVersion> <SharedFrameworkVersion>1.0.0</SharedFrameworkVersion>
<SharedHostVersion>1.0.1</SharedHostVersion> <SharedHostVersion>1.0.1</SharedHostVersion>
<HostFxrVersion>1.0.1</HostFxrVersion> <HostFxrVersion>1.0.1</HostFxrVersion>

View file

@ -1,17 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="PrepareTargets" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="GetCurrentRuntimeInformation" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="GetCurrentRuntimeInformation" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="GenerateBuildVersionInfo" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="CheckPrereqs" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="CheckPrereqs" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="SetEnvVar" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="SetEnvVar" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DotNetRestore" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ExtractArchive" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="ArchiveDirectory" AssemblyFile="$(CLIBuildDll)" />
<Target DependsOnTargets="BuildDotnetCliBuildFramework" Name="Prepare"> <Target Name="Prepare"
<PrepareTargets /> DependsOnTargets="Init;DownloadHostAndSharedFxArtifacts;RestorePackages;ZipTemplates" />
</Target>
<Target Name="Init"> <Target Name="Init"
DependsOnTargets="BuildDotnetCliBuildFramework">
<!-- Current Runtime Information --> <!-- Current Runtime Information -->
<GetCurrentRuntimeInformation> <GetCurrentRuntimeInformation>
<Output TaskParameter="Rid" PropertyName="Rid" /> <Output TaskParameter="Rid" PropertyName="Rid" />
@ -32,6 +34,7 @@
<IntermediateDirectory>$(BaseOutputDirectory)/intermediate</IntermediateDirectory> <IntermediateDirectory>$(BaseOutputDirectory)/intermediate</IntermediateDirectory>
<PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory> <PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory>
<SymbolsOutputDirectory>$(BaseOutputDirectory)/stage2symbols</SymbolsOutputDirectory> <SymbolsOutputDirectory>$(BaseOutputDirectory)/stage2symbols</SymbolsOutputDirectory>
<SharedFrameworkPublishDirectory>$(IntermediateDirectory)/sharedFrameworkPublish</SharedFrameworkPublishDirectory>
</PropertyGroup> </PropertyGroup>
<GenerateBuildVersionInfo RepoRoot="$(RepoRoot)"> <GenerateBuildVersionInfo RepoRoot="$(RepoRoot)">
@ -83,17 +86,16 @@
<ArtifactNameWithVersionCombinedFrameworkSdk>$(ArtifactNameCombinedFrameworkSdk)-$(ProductMonikerRid).$(SdkVersion)</ArtifactNameWithVersionCombinedFrameworkSdk> <ArtifactNameWithVersionCombinedFrameworkSdk>$(ArtifactNameCombinedFrameworkSdk)-$(ProductMonikerRid).$(SdkVersion)</ArtifactNameWithVersionCombinedFrameworkSdk>
<!-- Downloaded Installers + Archives --> <!-- Downloaded Installers + Archives -->
<SharedHostCompressedFile>$(PackagesDirectory)/dotnet-host-$(ProductMonikerRid).$(SharedHostVersion)$(ArchiveExtension)</SharedHostCompressedFile> <SharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host-$(ProductMonikerRid).$(SharedHostVersion)$(InstallerExtension)</SharedHostInstallerFileName>
<SharedHostInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/dotnet-host-$(ProductMonikerRid).$(SharedHostVersion)$(InstallerExtension)</SharedHostInstallerFile> <SharedHostInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(SharedHostInstallerFileName)</SharedHostInstallerFile>
<HostFxrCompressedFile>$(PackagesDirectory)/dotnet-hostfxr-$(ProductMonikerRid).$(HostFxrVersion)$(ArchiveExtension)</HostFxrCompressedFile> <HostFxrInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-hostfxr-$(ProductMonikerRid).$(HostFxrVersion)$(InstallerExtension)</HostFxrInstallerFileName>
<HostFxrInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/dotnet-hostfxr-$(ProductMonikerRid).$(HostFxrVersion)$(InstallerExtension)</HostFxrInstallerFile> <HostFxrInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(HostFxrInstallerFileName)</HostFxrInstallerFile>
<SharedFrameworkCompressedFile>$(PackagesDirectory)/dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(ArchiveExtension)</SharedFrameworkCompressedFile> <SharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerExtension)</SharedFrameworkInstallerFileName>
<SharedFrameworkInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/dotnet-sharedframework-$(ProductMonikerRid).$(SharedFrameworkVersion)$(InstallerExtension)</SharedFrameworkInstallerFile> <SharedFrameworkInstallerFile Condition=" '$(InstallerExtension)' != '' ">$(PackagesDirectory)/$(SharedFrameworkInstallerFileName)</SharedFrameworkInstallerFile>
<CombinedFrameworkHostCompressedFile>$(PackagesDirectory)/dotnet-$(ProductMonikerRid).$(SharedFrameworkVersion)$(ArchiveExtension)</CombinedFrameworkHostCompressedFile> <CombinedFrameworkHostCompressedFileName>dotnet-$(ProductMonikerRid).$(SharedFrameworkVersion)$(ArchiveExtension)</CombinedFrameworkHostCompressedFileName>
<CombinedFrameworkHostInstallerFile Condition=" '$(BundleExtension)' != '' ">$(PackagesDirectory)/dotnet-$(ProductMonikerRid).$(SharedFrameworkVersion)$(BundleExtension)</CombinedFrameworkHostInstallerFile>
<SdkBrandName>Microsoft .NET Core 1.0.0 - SDK Preview 2</SdkBrandName> <SdkBrandName>Microsoft .NET Core 1.0.0 - SDK Preview 2</SdkBrandName>
</PropertyGroup> </PropertyGroup>
@ -104,11 +106,80 @@
<SetEnvVar Name="DOTNET_CLI_TELEMETRY_PROFILE" Value="https://github.com/dotnet/cli;$(CommitHash)" /> <SetEnvVar Name="DOTNET_CLI_TELEMETRY_PROFILE" Value="https://github.com/dotnet/cli;$(CommitHash)" />
</Target> </Target>
<Target DependsOnTargets="Init" Name="RestorePackages"> <Target Name="SetupDownloadHostAndSharedFxInputsOutputs" DependsOnTargets="Init">
<PropertyGroup>
<CoreSetupBlobRootUrl>https://dotnetcli.blob.core.windows.net/dotnet/$(CoreSetupChannel)</CoreSetupBlobRootUrl>
<SharedFrameworkArchiveBlobRootUrl>$(CoreSetupBlobRootUrl)/Binaries/$(SharedFrameworkVersion)</SharedFrameworkArchiveBlobRootUrl>
<CoreSetupInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)/Installers</CoreSetupInstallerBlobRootUrl>
<CoreSetupDownloadDirectory>$(IntermediateDirectory)/coreSetupDownload/$(SharedFrameworkVersion)</CoreSetupDownloadDirectory>
<CombinedSharedHostAndFrameworkArchive>$(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive</CombinedSharedHostAndFrameworkArchive>
</PropertyGroup>
<ItemGroup>
<_DownloadAndExtractItem Include="CombinedSharedHostAndFrameworkArchive"
Condition="!Exists('$(CombinedSharedHostAndFrameworkArchive)')">
<Url>$(SharedFrameworkArchiveBlobRootUrl)/$(CombinedFrameworkHostCompressedFileName)</Url>
<DownloadFileName>$(CombinedSharedHostAndFrameworkArchive)</DownloadFileName>
<ExtractDestintation>$(SharedFrameworkPublishDirectory)</ExtractDestintation>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="SharedFrameworkInstallerFile"
Condition="!Exists('$(SharedFrameworkInstallerFile)')">
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedFrameworkVersion)/$(SharedFrameworkInstallerFileName)</Url>
<DownloadFileName>$(SharedFrameworkInstallerFile)</DownloadFileName>
<ExtractDestintation></ExtractDestintation>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="SharedHostInstallerFile"
Condition="!Exists('$(SharedHostInstallerFile)')">
<Url>$(CoreSetupInstallerBlobRootUrl)/$(SharedHostVersion)/$(SharedHostInstallerFileName)</Url>
<DownloadFileName>$(SharedHostInstallerFile)</DownloadFileName>
<ExtractDestintation></ExtractDestintation>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="HostFxrInstallerFile"
Condition="!Exists('$(HostFxrInstallerFile)')">
<Url>$(CoreSetupInstallerBlobRootUrl)/$(HostFxrVersion)/$(HostFxrInstallerFileName)</Url>
<DownloadFileName>$(HostFxrInstallerFile)</DownloadFileName>
<ExtractDestintation></ExtractDestintation>
</_DownloadAndExtractItem>
</ItemGroup>
</Target>
<Target Name="DownloadHostAndSharedFxArtifacts"
DependsOnTargets="SetupDownloadHostAndSharedFxInputsOutputs">
<DownloadFile Condition=" '@(_DownloadAndExtractItem)' != '' "
Uri="%(_DownloadAndExtractItem.Url)"
DestinationPath="%(_DownloadAndExtractItem.DownloadFileName)" />
<ExtractArchive Condition=" '%(_DownloadAndExtractItem.ExtractDestintation)' != '' "
InputFile="%(_DownloadAndExtractItem.DownloadFileName)"
DestinationDirectory="%(_DownloadAndExtractItem.ExtractDestintation)" />
</Target>
<Target Name="RestorePackages"
DependsOnTargets="Init">
<DotNetRestore WorkingDirectory="$(RepoRoot)/src" ToolPath="$(DotNetPath)" /> <DotNetRestore WorkingDirectory="$(RepoRoot)/src" ToolPath="$(DotNetPath)" />
<DotNetRestore WorkingDirectory="$(RepoRoot)/tools" ToolPath="$(DotNetPath)" /> <DotNetRestore WorkingDirectory="$(RepoRoot)/tools" ToolPath="$(DotNetPath)" />
</Target>
<Target Name="ZipTemplates">
<PropertyGroup>
<_DotNetNewFolder>$(RepoRoot)/src/dotnet/commands/dotnet-new</_DotNetNewFolder>
</PropertyGroup>
<ItemGroup>
<DotNetNewArchive Include="$([System.IO.Directory]::GetDirectories($(_DotNetNewFolder)))" />
</ItemGroup>
<ArchiveDirectory InputDirectory="%(DotNetNewArchive.FullPath)"
FileName="$([System.IO.Path]::GetFileName(%(DotNetNewArchive.FullPath)))"
OutputDirectory="%(DotNetNewArchive.RelativeDir)"
ForceZipArchive="true" />
</Target> </Target>
</Project> </Project>

View file

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="DownloadFile" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="DecompressZip" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="ExtractArchive" AssemblyFile="$(CLIBuildDll)" />
<UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(CLIBuildDll)" /> <UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(CLIBuildDll)" />
<Target Name="MsiTargetsSetupInputOutputs" DependsOnTargets="Init"> <Target Name="MsiTargetsSetupInputOutputs" DependsOnTargets="Init">
@ -73,8 +73,8 @@
DestinationPath="$(WixDestinationPath)" DestinationPath="$(WixDestinationPath)"
Overwrite="false" /> Overwrite="false" />
<DecompressZip <ExtractArchive
InputZip="$(WixDestinationPath)" InputFile="$(WixDestinationPath)"
DestinationDirectory="$(WixRoot)" /> DestinationDirectory="$(WixRoot)" />
</Target> </Target>

View file

@ -1,14 +1,8 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Runtime.InteropServices;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using Microsoft.Build.Utilities; using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Build.Framework;
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers; using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
@ -24,6 +18,8 @@ namespace Microsoft.DotNet.Cli.Build
[Required] [Required]
public string InputDirectory { get; set; } public string InputDirectory { get; set; }
public bool ForceZipArchive { get; set; }
[Output] [Output]
public string OutputArchive { get; set; } public string OutputArchive { get; set; }
@ -34,15 +30,17 @@ namespace Microsoft.DotNet.Cli.Build
return true; return true;
} }
if (CurrentPlatform.IsPlatform(BuildPlatform.Windows)) if (CurrentPlatform.IsPlatform(BuildPlatform.Windows) || ForceZipArchive)
{ {
OutputArchive = GenerateZip(); OutputArchive = GenerateZip();
} }
else else
{ {
OutputArchive = GenerateTarGz(); OutputArchive = GenerateTarGz();
} }
Log.LogMessage($"Created Archive '{OutputArchive}'");
return true; return true;
} }

View file

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Net.Http;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
namespace Microsoft.DotNet.Cli.Build
{
public class DecompressZip : Task
{
[Required]
public string InputZip { get; set; }
[Required]
public string DestinationDirectory { get; set; }
public override bool Execute()
{
FS.Mkdirp(DestinationDirectory);
ZipFile.ExtractToDirectory(InputZip, DestinationDirectory);
return true;
}
}
}

View file

@ -5,8 +5,6 @@ namespace Microsoft.DotNet.Cli.Build
{ {
public abstract class DotNetTool : ToolTask public abstract class DotNetTool : ToolTask
{ {
private const string ExeName = "dotnet.exe";
public DotNetTool() public DotNetTool()
{ {
} }
@ -19,7 +17,7 @@ namespace Microsoft.DotNet.Cli.Build
protected override string ToolName protected override string ToolName
{ {
get { return ExeName; } get { return HostArtifactNames.DotnetHostBaseName; }
} }
protected override MessageImportance StandardOutputLoggingImportance protected override MessageImportance StandardOutputLoggingImportance
@ -34,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Build
// if ToolPath was not provided by the MSBuild script // if ToolPath was not provided by the MSBuild script
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
Log.LogError($"Could not find the Path to {ExeName}"); Log.LogError($"Could not find the Path to {ToolName}");
return string.Empty; return string.Empty;
} }

View file

@ -1,17 +1,8 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Net.Http; using System.Net.Http;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using Microsoft.Build.Utilities; using Microsoft.Build.Utilities;
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {
public class DownloadFile : Task public class DownloadFile : Task
@ -33,6 +24,8 @@ namespace Microsoft.DotNet.Cli.Build
return true; return true;
} }
Log.LogMessage($"Downloading '{Uri}' to '{DestinationPath}'");
using (var httpClient = new HttpClient()) using (var httpClient = new HttpClient())
{ {
var getTask = httpClient.GetStreamAsync(Uri); var getTask = httpClient.GetStreamAsync(Uri);

View 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;
}
}
}

View file

@ -1,17 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Security.Cryptography;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Net.Http;
using Microsoft.Build.Utilities;
using Microsoft.DotNet.Cli.Build.Framework;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using Microsoft.Build.Utilities; using Microsoft.Build.Utilities;
using System.Security.Cryptography;
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
namespace Microsoft.DotNet.Cli.Build namespace Microsoft.DotNet.Cli.Build
{ {

View file

@ -71,7 +71,7 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts # Restore the build scripts
Write-Host "Restoring Build Script projects..." Write-Host "Restoring Build Script projects..."
pushd "$PSScriptRoot\.." pushd "$PSScriptRoot"
dotnet restore dotnet restore
if($LASTEXITCODE -ne 0) { throw "Failed to restore" } if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
popd popd

View file

@ -110,7 +110,7 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts # Restore the build scripts
echo "Restoring Build Script projects..." echo "Restoring Build Script projects..."
( (
cd "$DIR/.." cd "$DIR"
dotnet restore dotnet restore
) )
@ -118,13 +118,12 @@ echo "Restoring Build Script projects..."
echo "Compiling Build Scripts..." echo "Compiling Build Scripts..."
dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0 dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0
if [-z "$DOTNET_BUILD_SKIP_RUN" ] if [ -z "$DOTNET_BUILD_SKIP_RUN" ]; then
then
export PATH="$OLDPATH" export PATH="$OLDPATH"
# Run the builder # Run the builder
echo "Invoking Build Scripts..." echo "Invoking Build Scripts..."
echo "Configuration: $CONFIGURATION" echo "Configuration: $CONFIGURATION"
$DIR/bin/dotnet-cli-build ${targets[@]}
fi fi
$DIR/bin/dotnet-cli-build ${targets[@]}
exit $? exit $?