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 1 commit
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
17 changes: 14 additions & 3 deletions src/Cli/dotnet/CommonOptions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// 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;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools;
Expand Down Expand Up @@ -30,7 +34,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 +43,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 +52,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 host runtime to build the target.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<value>Use host runtime to build the target.</value>
<value>Use current runtime as the target runtime.</value>

@KathleenDollard Any further suggestions for this text?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in all resx/xlf files. More feedback from @KathleenDollard is welcome. :)

</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 @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Runtime.InteropServices;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools;
using LocalizableStrings = Microsoft.DotNet.Tools.Restore.LocalizableStrings;
Expand Down Expand Up @@ -83,6 +84,11 @@ 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)}")),
Create.Option(
am11 marked this conversation as resolved.
Show resolved Hide resolved
"--use-current-runtime",
LocalizableStrings.CmdCurrentRuntimeOptionDescription,
Accept.NoArguments()
.ForwardAs("-property:UseCurrentRuntimeIdentifier=True")),
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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</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 host runtime to build the target.</source>
<target state="new">Use host runtime to build the target.</target>
<note />
</trans-unit>
<trans-unit id="CmdSourceOption">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
Expand Down
Loading