Migrate src and tools to csproj (#4538)

Thanks for getting this in!
This commit is contained in:
Justin Goshi 2016-10-28 22:04:20 -10:00 committed by Piotr Puszkiewicz
parent 3ec5279491
commit a4776a2b2c
24 changed files with 1036 additions and 35 deletions

View file

@ -0,0 +1,56 @@
// 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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetBuildMsbuildLegacy : DotNetTool
{
protected override string Command
{
get { return "build3"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()}"; }
}
public string BuildBasePath { get; set; }
public string Configuration { get; set; }
public string Framework { get; set; }
public string ProjectPath { get; set; }
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetFramework()
{
if (!string.IsNullOrEmpty(Framework))
{
return $"--framework {Framework}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
}
}

View file

@ -0,0 +1,78 @@
// 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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetPackMsbuildLegacy : DotNetTool
{
protected override string Command
{
get { return "pack3"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()}"; }
}
public string Configuration { get; set; }
public bool NoBuild { get; set; }
public string Output { get; set; }
public string ProjectPath { get; set; }
public string VersionSuffix { get; set; }
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetNoBuild()
{
if (NoBuild)
{
return $"--no-build";
}
return null;
}
private string GetOutput()
{
if (!string.IsNullOrEmpty(Output))
{
return $"--output {Output}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
private string GetVersionSuffix()
{
if (!string.IsNullOrEmpty(VersionSuffix))
{
return $"--version-suffix {VersionSuffix}";
}
return null;
}
}
}

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; }
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {GetMSBuildArgs()}"; }
}
public string BuildBasePath { get; set; }
@ -23,10 +23,14 @@ namespace Microsoft.DotNet.Cli.Build
public bool NativeSubDirectory { get; set; }
public string MSBuildArgs { get; set; }
public string Output { get; set; }
public string ProjectPath { get; set; }
public string Runtime { get; set; }
public string VersionSuffix { get; set; }
private string GetBuildBasePath()
@ -69,6 +73,16 @@ namespace Microsoft.DotNet.Cli.Build
return null;
}
private string GetMSBuildArgs()
{
if (!string.IsNullOrEmpty(MSBuildArgs))
{
return $"-- {MSBuildArgs}";
}
return null;
}
private string GetOutput()
{
if (!string.IsNullOrEmpty(Output))
@ -89,6 +103,16 @@ namespace Microsoft.DotNet.Cli.Build
return null;
}
private string GetRuntime()
{
if (!string.IsNullOrEmpty(Runtime))
{
return $"--runtime {Runtime}";
}
return null;
}
private string GetVersionSuffix()
{
if (!string.IsNullOrEmpty(VersionSuffix))

View file

@ -0,0 +1,126 @@
// 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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetPublishMsbuildLegacy : DotNetTool
{
protected override string Command
{
get { return "publish3"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {GetMSBuildArgs()}"; }
}
public string BuildBasePath { get; set; }
public string Configuration { get; set; }
public string Framework { get; set; }
public bool NativeSubDirectory { get; set; }
public string MSBuildArgs { get; set; }
public string Output { get; set; }
public string ProjectPath { get; set; }
public string Runtime { get; set; }
public string VersionSuffix { get; set; }
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetFramework()
{
if (!string.IsNullOrEmpty(Framework))
{
return $"--framework {Framework}";
}
return null;
}
private string GetNativeSubdirectory()
{
if (NativeSubDirectory)
{
return $"--native-subdirectory";
}
return null;
}
private string GetMSBuildArgs()
{
if (!string.IsNullOrEmpty(MSBuildArgs))
{
return $"-- {MSBuildArgs}";
}
return null;
}
private string GetOutput()
{
if (!string.IsNullOrEmpty(Output))
{
return $"--output {Output}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
private string GetRuntime()
{
if (!string.IsNullOrEmpty(Runtime))
{
return $"--runtime {Runtime}";
}
return null;
}
private string GetVersionSuffix()
{
if (!string.IsNullOrEmpty(VersionSuffix))
{
return $"--version-suffix {VersionSuffix}";
}
return null;
}
}
}

View file

@ -0,0 +1,56 @@
// 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.
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetRestoreMsbuildLegacy : DotNetTool
{
protected override string Command
{
get { return "restore3"; }
}
protected override string Args
{
get { return $"{Root} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()}"; }
}
public string Root { get; set; }
public string Source { get; set; }
public string Packages { get; set; }
public bool SkipInvalidConfigurations { get; set; }
private string GetSource()
{
if (!string.IsNullOrEmpty(Source))
{
return $"--source {Source}";
}
return null;
}
private string GetPackages()
{
if (!string.IsNullOrEmpty(Packages))
{
return $"--packages {Packages}";
}
return null;
}
private string GetSkipInvalidConfigurations()
{
if (SkipInvalidConfigurations)
{
return "/p:SkipInvalidConfigurations=true";
}
return null;
}
}
}