Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --use-current-runtime option #14093

Merged
merged 4 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/Cli/dotnet/CommonOptions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// 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 System;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -30,7 +33,7 @@ public static Option VerbosityOption(Func<AppliedOption, string> format) =>
"diag", "diagnostic")
.With(name: CommonLocalizableStrings.LevelArgumentName)
.ForwardAsSingle(format));

public static Option FrameworkOption(string description) =>
Create.Option(
"-f|--framework",
Expand All @@ -39,7 +42,7 @@ public static Option FrameworkOption(string description) =>
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
.With(name: CommonLocalizableStrings.FrameworkArgumentName)
.ForwardAsSingle(o => $"-property:TargetFramework={o.Arguments.Single()}"));

public static Option RuntimeOption(string description, bool withShortOption = true) =>
Create.Option(
withShortOption ? "-r|--runtime" : "--runtime",
Expand All @@ -48,7 +51,14 @@ public static Option RuntimeOption(string description, bool withShortOption = tr
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: CommonLocalizableStrings.RuntimeIdentifierArgumentName)
.ForwardAsSingle(o => $"-property:RuntimeIdentifier={o.Arguments.Single()}"));


public static Option CurrentRuntimeOption(string description, bool withShortOption = true) =>
Create.Option(
"--use-current-runtime",
description,
Accept.NoArguments()
.ForwardAs("-property:UseCurrentRuntimeIdentifier=True"));

public static Option ConfigurationOption(string description) =>
Create.Option(
"-c|--configuration",
Expand Down
57 changes: 30 additions & 27 deletions src/Cli/dotnet/commands/dotnet-restore/LocalizableStrings.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema

Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple

There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -141,6 +141,9 @@
<data name="CmdRuntimeOptionDescription" xml:space="preserve">
<value>The target runtime to restore packages for.</value>
</data>
<data name="CmdCurrentRuntimeOptionDescription" xml:space="preserve">
<value>Use current runtime as the target runtime.</value>
</data>
<data name="CmdPackagesOption" xml:space="preserve">
<value>PACKAGES_DIR</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private static Option[] ImplicitRestoreOptions(bool showHelp = false, bool useSh
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: LocalizableStrings.CmdRuntimeOption)
.ForwardAsSingle(o => $"-property:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
CommonOptions.CurrentRuntimeOption(LocalizableStrings.CmdCurrentRuntimeOptionDescription),
Create.Option(
"--packages",
showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Volitelná cesta k souboru projektu nebo k argumentům MSBuildu</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Optionaler Pfad zu einer Projektdatei oder MSBuild-Argumente.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Ruta de acceso opcional a un archivo de proyecto o argumentos de MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">ORIGEN</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Chemin facultatif vers un fichier projet ou des arguments MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Percorso facoltativo di un file di progetto o di argomenti di MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">ORIGINE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">プロジェクト ファイルまたは MSBuild 引数へのオプションのパス。</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">프로젝트 파일의 선택적 경로 또는 MSBuild 인수입니다.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Opcjonalna ścieżka do pliku projektu lub argumentów programu MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">ŹRÓDŁO</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Caminho opcional para um arquivo de projeto ou argumentos do MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">ORIGEM</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Дополнительный путь к файлу проекта или аргументам MSBuild.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">Proje dosyasının veya MSBuild bağımsız değişkenlerinin isteğe bağlı yolu.</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">项目文件或 MSBuild 参数的可选路径。</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<target state="translated">專案檔或 MSBuild 引數的選擇性路徑。</target>
<note />
</trans-unit>
<trans-unit id="CmdCurrentRuntimeOptionDescription">
<source>Use current runtime as the target runtime.</source>
<target state="new">Use current runtime as the target runtime.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
59 changes: 31 additions & 28 deletions src/Cli/dotnet/commands/dotnet-store/LocalizableStrings.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema

Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple

There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -162,4 +162,7 @@
<data name="RuntimeOptionDescription" xml:space="preserve">
<value>The target runtime to store packages for.</value>
</data>
</root>
<data name="CurrentRuntimeOptionDescription" xml:space="preserve">
<value>Use current runtime as the target runtime.</value>
</data>
</root>
1 change: 1 addition & 0 deletions src/Cli/dotnet/commands/dotnet-store/StoreCommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static Command Store() =>
.With(name: LocalizableStrings.FrameworkVersionOption)
.ForwardAsSingle(o => $"-property:RuntimeFrameworkVersion={o.Arguments.Single()}")),
CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
CommonOptions.CurrentRuntimeOption(LocalizableStrings.CurrentRuntimeOptionDescription),
Create.Option(
"-o|--output",
LocalizableStrings.OutputOptionDescription,
Expand Down
Loading