2017-03-06 11:57:19 -08:00
|
|
|
// 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.
|
|
|
|
|
2017-03-09 09:14:55 -08:00
|
|
|
using System.Linq;
|
2017-03-06 11:57:19 -08:00
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
{
|
|
|
|
internal static class BuildCommandParser
|
|
|
|
{
|
|
|
|
public static Command Build() =>
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Command(
|
|
|
|
"build",
|
|
|
|
".NET Builder",
|
2017-03-09 14:47:02 -08:00
|
|
|
Accept.ZeroOrMoreArguments,
|
2017-03-07 11:28:35 -08:00
|
|
|
CommonOptions.HelpOption(),
|
|
|
|
Create.Option(
|
|
|
|
"-o|--output",
|
|
|
|
"Output directory in which to place built artifacts.",
|
|
|
|
Accept.ExactlyOneArgument
|
|
|
|
.With(name: "OUTPUT_DIR")
|
2017-03-09 09:14:55 -08:00
|
|
|
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")),
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Option(
|
|
|
|
"-f|--framework",
|
|
|
|
"Target framework to build for. The target framework has to be specified in the project file.",
|
|
|
|
Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)
|
2017-03-09 09:14:55 -08:00
|
|
|
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")),
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Option(
|
|
|
|
"-r|--runtime",
|
|
|
|
"Target runtime to build for. The default is to build a portable application.",
|
|
|
|
Accept.AnyOneOf(Suggest.RunTimesFromProjectFile)
|
2017-03-09 09:14:55 -08:00
|
|
|
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")),
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Option(
|
|
|
|
"-c|--configuration",
|
|
|
|
"Configuration to use for building the project. Default for most projects is \"Debug\".",
|
|
|
|
Accept.ExactlyOneArgument
|
|
|
|
.With(name: "CONFIGURATION")
|
|
|
|
.WithSuggestionsFrom("DEBUG", "RELEASE")
|
2017-03-09 09:14:55 -08:00
|
|
|
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Option(
|
|
|
|
"--version-suffix",
|
|
|
|
"Defines the value for the $(VersionSuffix) property in the project",
|
|
|
|
Accept.ExactlyOneArgument
|
|
|
|
.With(name: "VERSION_SUFFIX")
|
2017-03-09 09:14:55 -08:00
|
|
|
.ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")),
|
2017-03-07 11:28:35 -08:00
|
|
|
Create.Option(
|
|
|
|
"--no-incremental",
|
|
|
|
"Disables incremental build."),
|
|
|
|
Create.Option(
|
|
|
|
"--no-dependencies",
|
|
|
|
"Set this flag to ignore project-to-project references and only build the root project",
|
|
|
|
Accept.NoArguments
|
|
|
|
.ForwardAs("/p:BuildProjectReferences=false")),
|
|
|
|
CommonOptions.VerbosityOption());
|
2017-03-06 11:57:19 -08:00
|
|
|
}
|
|
|
|
}
|