diff --git a/eng/SourceBuild.Version.Details.xml b/eng/SourceBuild.Version.Details.xml index 317f90b8c..3774af5c0 100644 --- a/eng/SourceBuild.Version.Details.xml +++ b/eng/SourceBuild.Version.Details.xml @@ -11,6 +11,11 @@ 1968a003d845d119a9d38ac4daaeea22897f7daf + + https://github.com/dotnet/templating + 3bc0d90f3e450f3e4ebda128081d091fb42968e3 + + https://github.com/dotnet/test-templates 6898c1c70c2d14e9725ddab6e1ebe8084c4d7e27 diff --git a/src/SourceBuild/tarball/content/patches/templating/0001-fixed-TemplateLocalizer-tool.patch b/src/SourceBuild/tarball/content/patches/templating/0001-fixed-TemplateLocalizer-tool.patch new file mode 100644 index 000000000..ffc8a7f51 --- /dev/null +++ b/src/SourceBuild/tarball/content/patches/templating/0001-fixed-TemplateLocalizer-tool.patch @@ -0,0 +1,99 @@ +From 3ac6d94eed6cfbb7c06128fe4caa91e9701bc2f9 Mon Sep 17 00:00:00 2001 +From: Vlada Shubina +Date: Wed, 7 Jul 2021 12:10:50 +0300 +Subject: [PATCH] fixed TemplateLocalizer tool + +See https://github.com/dotnet/templating/issues/3379 for additional details. +--- + NuGet.config | 1 + + .../TemplateLocalizer.cs | 8 +++++++- + .../Commands/Export/ExportCommand.cs | 8 ++------ + .../ExportCommandTests.cs | 5 +++-- + 4 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/NuGet.config b/NuGet.config +index b91f5fa3..30266b54 100644 +--- a/NuGet.config ++++ b/NuGet.config +@@ -9,6 +9,7 @@ + + + ++ + + + +diff --git a/src/Microsoft.TemplateEngine.TemplateLocalizer.Core/TemplateLocalizer.cs b/src/Microsoft.TemplateEngine.TemplateLocalizer.Core/TemplateLocalizer.cs +index f99ab340..ca64813e 100644 +--- a/src/Microsoft.TemplateEngine.TemplateLocalizer.Core/TemplateLocalizer.cs ++++ b/src/Microsoft.TemplateEngine.TemplateLocalizer.Core/TemplateLocalizer.cs +@@ -4,6 +4,7 @@ + using System; + using System.Collections.Generic; + using System.IO; ++using System.Linq; + using System.Text.Json; + using System.Threading; + using System.Threading.Tasks; +@@ -48,11 +49,16 @@ public async Task ExportLocalizationFilesAsync(string templateJson + IReadOnlyList templateJsonStrings = stringExtractor.ExtractStrings(out string templateJsonLanguage); + + string targetDirectory = options.TargetDirectory ?? Path.Combine(Path.GetDirectoryName(templateJsonPath) ?? string.Empty, "localize"); ++ IEnumerable languages = ExportOptions.DefaultLanguages; ++ if (options.Languages?.Any() ?? false) ++ { ++ languages = options.Languages; ++ } + + await TemplateStringUpdater.UpdateStringsAsync( + templateJsonStrings, + templateJsonLanguage, +- options.Languages ?? ExportOptions.DefaultLanguages, ++ languages, + targetDirectory, + options.DryRun, + _logger, +diff --git a/src/Microsoft.TemplateEngine.TemplateLocalizer/Commands/Export/ExportCommand.cs b/src/Microsoft.TemplateEngine.TemplateLocalizer/Commands/Export/ExportCommand.cs +index 5466ddcb..e1d8df4b 100644 +--- a/src/Microsoft.TemplateEngine.TemplateLocalizer/Commands/Export/ExportCommand.cs ++++ b/src/Microsoft.TemplateEngine.TemplateLocalizer/Commands/Export/ExportCommand.cs +@@ -33,15 +33,11 @@ public override Command CreateCommand() + Name = "--recursive", + Description = LocalizableStrings.command_export_help_recursive_description, + }); +- exportCommand.AddOption(new Option("-l") ++ exportCommand.AddOption(new Option("-l") + { + Name = "--language", + Description = LocalizableStrings.command_export_help_language_description, +- Argument = new Argument() +- { +- Arity = ArgumentArity.OneOrMore, +- ArgumentType = typeof(string), +- }, ++ Arity = ArgumentArity.OneOrMore + }); + exportCommand.AddOption(new Option("-d") + { +diff --git a/test/Microsoft.TemplateEngine.TemplateLocalizer.IntegrationTests/ExportCommandTests.cs b/test/Microsoft.TemplateEngine.TemplateLocalizer.IntegrationTests/ExportCommandTests.cs +index 15682740..db81413c 100644 +--- a/test/Microsoft.TemplateEngine.TemplateLocalizer.IntegrationTests/ExportCommandTests.cs ++++ b/test/Microsoft.TemplateEngine.TemplateLocalizer.IntegrationTests/ExportCommandTests.cs +@@ -153,11 +153,12 @@ public async Task LanguagesCanBeOverriden() + string[] exportedFiles = await RunTemplateLocalizer( + GetTestTemplateJsonContent(), + _workingDirectory, +- args: new string[] { "export", _workingDirectory, "--language", "tr" }) ++ args: new string[] { "export", _workingDirectory, "--language", "tr", "de" }) + .ConfigureAwait(false); + +- Assert.Single(exportedFiles); ++ Assert.Equal(2, exportedFiles.Length); + Assert.True(File.Exists(Path.Combine(_workingDirectory, "localize", "templatestrings.tr.json"))); ++ Assert.True(File.Exists(Path.Combine(_workingDirectory, "localize", "templatestrings.de.json"))); + Assert.False(File.Exists(Path.Combine(_workingDirectory, "localize", "templatestrings.es.json"))); + } + +-- +2.29.2 + diff --git a/src/SourceBuild/tarball/content/repos/known-good.proj b/src/SourceBuild/tarball/content/repos/known-good.proj index ffd6b2586..cee6ca6bb 100644 --- a/src/SourceBuild/tarball/content/repos/known-good.proj +++ b/src/SourceBuild/tarball/content/repos/known-good.proj @@ -42,6 +42,7 @@ + diff --git a/src/SourceBuild/tarball/content/repos/templating.proj b/src/SourceBuild/tarball/content/repos/templating.proj index 5cea61baf..92ca491e6 100644 --- a/src/SourceBuild/tarball/content/repos/templating.proj +++ b/src/SourceBuild/tarball/content/repos/templating.proj @@ -2,52 +2,24 @@ - $(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/ - $(ProjectDirectory)artifacts/packages/$(Configuration)/NonShipping/ - false - - --restore --pack --configuration $(Configuration) $(OutputVersionArgs) - $(BuildCommandArgs) $(FlagParameterPrefix)warnasError $(ArcadeFalseBoolBuildArg) - $(BuildCommandArgs) /p:PackSpecific=true - $(BuildCommandArgs) /p:UseAppHost=false - true - $(BuildCommandArgs) -v $(LogVerbosity) - $(BuildCommandArgs) -bl - $(BuildCommandArgs) --ci + $(StandardSourceBuildArgs) -v $(LogVerbosity) $(BuildCommandArgs) $(FlagParameterPrefix)warnAsError $(ArcadeFalseBoolBuildArg) + $(StandardSourceBuildCommand) $(BuildCommandArgs) - - $(BuildCommandArgs) /p:PB_PackageVersionPropsUrl=file:%2F%2F$(PackageVersionPropsPath) - - $(ProjectDirectory)\build$(ShellExtension) $(BuildCommandArgs) - - true - - $(SourceBuiltPackagesPath) - $(EnvironmentRestoreSources)%3B$(ReferencePackagesDir)%3B$(PrebuiltPackagesPath) - $(EnvironmentRestoreSources)%3Bhttps://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public%40Local/nuget/v3/index.json + $(ProjectDirectory)global.json + $(ProjectDirectory)NuGet.config + false - + - - - - - - - - - - -