From 60045fba2649e408989795375def4c1ec4edfcfa Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 24 Jun 2022 13:53:32 +0700 Subject: [PATCH 01/19] Updated LfMerge to .NET6 Includes updating .Core to .NET Standard. I picked this simply to instill more compatibility with other frameworks. Also includes updating various old Framework packages to the minimum versions that supported .NET Standard. Removed icu.net to depend on indirect reference. Upgraded MongoDB, per https://github.com/commandlineparser/commandline/issues/225 and refactored some duplicated code into a base class in .Core. Referencing the "netcore" versions of the SIL packages -- these can go back once the "netcore" branches are in. Upgraded libpalaso references to 9, since most are already .NET Standard. There are lots of warnings for .NET Framework packages, some fixable, like SIL.Lexicon, and some not, like NHunspell. But these changes allow it to dotnet build --- LfMerge.TestApp/LfMerge.TestApp.csproj | 2 +- src/FixFwData/FixFwData.csproj | 2 +- .../LfMerge.Core.Tests.csproj | 4 +-- src/LfMerge.Core/LfMerge.Core.csproj | 22 +++++++------ src/LfMerge.Core/OptionsBase.cs | 31 ++++++++++++++++++ src/LfMerge.Tests/LfMerge.Tests.csproj | 2 +- src/LfMerge/LfMerge.csproj | 3 +- src/LfMerge/Options.cs | 32 +++---------------- src/LfMergeAuxTool/AuxToolOptions.cs | 30 ++++------------- src/LfMergeAuxTool/LfMergeAuxTool.csproj | 3 +- .../LfMergeQueueManager.csproj | 3 +- .../QueueManagerOptions.cs | 28 ++-------------- 12 files changed, 64 insertions(+), 98 deletions(-) create mode 100644 src/LfMerge.Core/OptionsBase.cs diff --git a/LfMerge.TestApp/LfMerge.TestApp.csproj b/LfMerge.TestApp/LfMerge.TestApp.csproj index 56a76aa0..839b4e92 100644 --- a/LfMerge.TestApp/LfMerge.TestApp.csproj +++ b/LfMerge.TestApp/LfMerge.TestApp.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 Exe LfMerge.TestApp Debug;Release diff --git a/src/FixFwData/FixFwData.csproj b/src/FixFwData/FixFwData.csproj index 5c09ca0e..1b31a210 100644 --- a/src/FixFwData/FixFwData.csproj +++ b/src/FixFwData/FixFwData.csproj @@ -35,7 +35,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + diff --git a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj index 92175f69..6751e5db 100644 --- a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj +++ b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj @@ -31,10 +31,10 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + - + diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index f96be951..0d971434 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -1,7 +1,7 @@ - net462 + netstandard2.0 LfMerge.Core Debug;Release LfMerge.Core @@ -32,18 +32,20 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + - - + + + - - - - - + + + + + + + diff --git a/src/LfMerge.Core/OptionsBase.cs b/src/LfMerge.Core/OptionsBase.cs new file mode 100644 index 00000000..d0d3e0dc --- /dev/null +++ b/src/LfMerge.Core/OptionsBase.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2016 SIL International +// This software is licensed under the MIT license (http://opensource.org/licenses/MIT) +using System.Collections.Generic; +using System.Linq; +using CommandLine; + +namespace LfMerge.Core +{ + public abstract class OptionsBase + { + protected static IList _parseErrors = new List(); + + public static T Current; + + public IEnumerable ParseErrors { get { return _parseErrors; } } + + public static T ParseCommandLineArgs(string[] args) + { + T options = default(T); + Parser.Default.ParseArguments(args) + .WithParsed(o => { + Current = o; + options = o; + _parseErrors.Clear(); + }) + .WithNotParsed(e => _parseErrors = e.ToList()); + + return options; + } + } +} \ No newline at end of file diff --git a/src/LfMerge.Tests/LfMerge.Tests.csproj b/src/LfMerge.Tests/LfMerge.Tests.csproj index 14d51bd6..acddeb17 100644 --- a/src/LfMerge.Tests/LfMerge.Tests.csproj +++ b/src/LfMerge.Tests/LfMerge.Tests.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMerge.Tests Debug;Release LfMerge.Tests diff --git a/src/LfMerge/LfMerge.csproj b/src/LfMerge/LfMerge.csproj index e267534e..0abfc958 100644 --- a/src/LfMerge/LfMerge.csproj +++ b/src/LfMerge/LfMerge.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 Exe LfMerge Debug;Release @@ -37,7 +37,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMerge/Options.cs b/src/LfMerge/Options.cs index 37b38ec4..7da38837 100644 --- a/src/LfMerge/Options.cs +++ b/src/LfMerge/Options.cs @@ -1,15 +1,13 @@ // Copyright (c) 2011-2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; using LfMerge.Core.Actions; namespace LfMerge { - public class Options + public class Options : OptionsBase { - public static Options Current; - public Options() { Current = this; @@ -27,34 +25,12 @@ public Options() [Option("migrate", HelpText = "Allow data migration")] public bool AllowDataMigration { get; set; } - [Option("user", HelpText = "LanguageDepot username (for debugging purposes only)", DefaultValue = "x")] + [Option("user", HelpText = "LanguageDepot username (for debugging purposes only)", Default = "x")] public string User { get; set; } - [Option("password", HelpText = "LanguageDepot password (for debugging purposes only)", DefaultValue = "x")] + [Option("password", HelpText = "LanguageDepot password (for debugging purposes only)", Default = "x")] public string Password { get; set; } - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - public static Options ParseCommandLineArgs(string[] args) - { - var options = new Options(); - var parser = ParserInstance ?? Parser.Default; - if (parser.ParseArguments(args, options)) - { - Current = options; - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } - /// /// Gets or sets the parser. /// diff --git a/src/LfMergeAuxTool/AuxToolOptions.cs b/src/LfMergeAuxTool/AuxToolOptions.cs index 69764d76..0c756e55 100644 --- a/src/LfMergeAuxTool/AuxToolOptions.cs +++ b/src/LfMergeAuxTool/AuxToolOptions.cs @@ -1,12 +1,17 @@ // Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; namespace LfMergeAuxTool { - public class AuxToolOptions + public class AuxToolOptions : OptionsBase { + public AuxToolOptions() + { + Current = this; + } + [Option('p', "project", Required = true, HelpText = "Path to fwdata file to process.")] public string Project { get; set; } @@ -18,27 +23,6 @@ public class AuxToolOptions [Option('m', "migrate", HelpText = "Migrate project to current model version")] public bool Migrate { get; set; } - - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, - current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - public static AuxToolOptions ParseCommandLineArgs(string[] args) - { - var options = new AuxToolOptions(); - if (Parser.Default.ParseArguments(args, options)) - { - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } } } diff --git a/src/LfMergeAuxTool/LfMergeAuxTool.csproj b/src/LfMergeAuxTool/LfMergeAuxTool.csproj index a82d893c..c4d59144 100644 --- a/src/LfMergeAuxTool/LfMergeAuxTool.csproj +++ b/src/LfMergeAuxTool/LfMergeAuxTool.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMergeAuxTool Debug;Release LfMergeAuxTool @@ -32,7 +32,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMergeQueueManager/LfMergeQueueManager.csproj b/src/LfMergeQueueManager/LfMergeQueueManager.csproj index feedcc91..85d55155 100644 --- a/src/LfMergeQueueManager/LfMergeQueueManager.csproj +++ b/src/LfMergeQueueManager/LfMergeQueueManager.csproj @@ -1,7 +1,7 @@  - net462 + net6.0 LfMerge.QueueManager Debug;Release LfMergeQueueManager @@ -32,7 +32,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMergeQueueManager/QueueManagerOptions.cs b/src/LfMergeQueueManager/QueueManagerOptions.cs index 3c0f2f03..027726a3 100644 --- a/src/LfMergeQueueManager/QueueManagerOptions.cs +++ b/src/LfMergeQueueManager/QueueManagerOptions.cs @@ -1,14 +1,12 @@ // Copyright (c) 2011-2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using CommandLine; -using CommandLine.Text; +using LfMerge.Core; namespace LfMerge.QueueManager { - public class QueueManagerOptions + public class QueueManagerOptions : OptionsBase { - public static QueueManagerOptions Current; - public QueueManagerOptions() { Current = this; @@ -16,27 +14,5 @@ public QueueManagerOptions() [Option('p', "project", HelpText = "Process the specified project first")] public string PriorityProject { get; set; } - - [HelpOption('h', "help")] - public string GetUsage() - { - return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); - } - - [ParserState] - public IParserState LastParserState { get; set; } - - - public static QueueManagerOptions ParseCommandLineArgs(string[] args) - { - var options = new QueueManagerOptions(); - if (Parser.Default.ParseArguments(args, options)) - { - Current = options; - return options; - } - // CommandLineParser automagically handles displaying help - return null; - } } } From ce9a70b736f8dd250db46ece2e6dd565e7af0a2a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 27 Jun 2022 16:15:26 +0700 Subject: [PATCH 02/19] Replacing usage of mono with dotnet and using its nuget Couple notes: Removed RestoreBuildTasks. It doesn't appear to be necessary -- Nuget and the relevant projects should handle this if it turns out it is. Didn't replace --debug flag in mono with anything. It's unclear if the theoretical dotnet equivalent would perform as desired, but we could maybe use "verbosity" if needed. These changes are experimental, but a commit is required to test, since in docker creation pending changes are cleared. --- build/LfMerge.proj | 12 +-- build/NuGet.targets | 91 +--------------------- build/nuget | 21 ----- docker/compile-lfmerge.sh | 5 +- docker/scripts/compile-lfmerge-combined.sh | 10 +-- docker/scripts/gitversion-combined.sh | 2 +- lfmergeqm | 2 +- src/LfMerge.Core/chorusmerge | 4 +- startlfmerge | 5 +- 9 files changed, 10 insertions(+), 142 deletions(-) delete mode 100755 build/nuget diff --git a/build/LfMerge.proj b/build/LfMerge.proj index 9b682b99..2a10c516 100644 --- a/build/LfMerge.proj +++ b/build/LfMerge.proj @@ -25,7 +25,6 @@ - - - - - - - - - - - + diff --git a/build/NuGet.targets b/build/NuGet.targets index ab3e8dff..91d5a728 100644 --- a/build/NuGet.targets +++ b/build/NuGet.targets @@ -1,94 +1,7 @@ - - $(MSBuildProjectDirectory)/../ - - - true - packages - - - false - - - true - - - - $(MSBuildThisFileDirectory) - - - $(NuGetToolsPath)/nuget.exe - - /opt/mono5-sil/bin/mono $(NuGetExePath) - - - https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - - - - - - - - - - + - - - - - + Command='dotnet restore "$(SolutionPath)" --packages packages'/> - - - - - - - - - - - - - - - - - diff --git a/build/nuget b/build/nuget deleted file mode 100755 index 431794f1..00000000 --- a/build/nuget +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# This file is a workaround for using the current nuget.exe (which works with nuget packages that -# specify dependencies for multiple frameworks, but requires a newer mono version) and having to -# still use mono 3.x for building and running the project. - -if [ -f /opt/mono5-sil/bin/mono ]; then - export MONO_PREFIX=/opt/mono5-sil -elif [ -f /opt/mono4-sil/bin/mono ]; then - export MONO_PREFIX=/opt/mono4-sil -else - echo "Need mono4-sil or mono5-sil installed to be able to restore the packages" - exit 1 -fi - -# We don't want/need the FDO assemblies in the path. But if we try to add them the build might -# fail if `lfmerge-fdo` package isn't installed. Therefore we set RUNMODE to skip that step. -cd $(dirname $0)/.. -RUNMODE="NUGET" . environ -cd - - -mono --debug nuget.exe $@ diff --git a/docker/compile-lfmerge.sh b/docker/compile-lfmerge.sh index 7e648d83..792e3ab7 100755 --- a/docker/compile-lfmerge.sh +++ b/docker/compile-lfmerge.sh @@ -2,12 +2,9 @@ echo "Compiling LfMerge and running unit tests" BUILD=Release . environ -echo "Using $(which mono)" -export FrameworkPathOverride=/opt/mono5-sil/lib/mono/4.5 +echo "Using $(which dotnet)" dotnet build /t:CompileOnly /v:detailed /property:Configuration=Release build/LfMerge.proj # TODO: Determine if this symlink is necessary ln -sf ../Mercurial output/ -cd /build/LfMerge/output/Release/net462 -export PATH="${PATH}:/opt/mono5-sil/bin" # TODO: Test all DLLs # dotnet test -f net462 LfMerge.Core.Tests.dll diff --git a/docker/scripts/compile-lfmerge-combined.sh b/docker/scripts/compile-lfmerge-combined.sh index 16dce0e4..115903b7 100755 --- a/docker/scripts/compile-lfmerge-combined.sh +++ b/docker/scripts/compile-lfmerge-combined.sh @@ -5,17 +5,11 @@ set -e echo "Compiling LfMerge and running unit tests" BUILD=Release . environ -echo "Using $(which mono)" -export FrameworkPathOverride=/opt/mono5-sil/lib/mono/4.5 +echo "Using $(which dotnet)" export DbVersion="${1-7000072}" echo "Building for ${DbVersion}" -if [ "x$1" = "x7000072" ]; then -/opt/mono5-sil/bin/msbuild /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -# dotnet build /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -else -/opt/mono5-sil/bin/msbuild /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj -fi +dotnet build /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj # ln -sf ../Mercurial output/ # xbuild /t:TestOnly /v:detailed /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj diff --git a/docker/scripts/gitversion-combined.sh b/docker/scripts/gitversion-combined.sh index 5693f196..50c67356 100755 --- a/docker/scripts/gitversion-combined.sh +++ b/docker/scripts/gitversion-combined.sh @@ -19,7 +19,7 @@ fi export MONO_PREFIX=/opt/mono5-sil RUNMODE="PACKAGEBUILD" BUILD=Release . environ -msbuild /t:RestoreBuildTasks build/LfMerge.proj +msbuild build/LfMerge.proj mkdir -p output/Release if [ -n "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -a "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -ne 0 ]; then diff --git a/lfmergeqm b/lfmergeqm index 4b363161..7bbc9171 100755 --- a/lfmergeqm +++ b/lfmergeqm @@ -42,4 +42,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec mono --debug "$LIB"/LfMergeQueueManager.exe "$@" +exec dotnet run "$LIB"/LfMergeQueueManager.exe "$@" diff --git a/src/LfMerge.Core/chorusmerge b/src/LfMerge.Core/chorusmerge index 9634b4d6..e4211a1c 100644 --- a/src/LfMerge.Core/chorusmerge +++ b/src/LfMerge.Core/chorusmerge @@ -1,6 +1,4 @@ #!/bin/bash -unset MONO_PREFIX -unset MONO_ENVIRON SCRIPT_DIR=$(dirname $(readlink -f $0)) @@ -32,4 +30,4 @@ cd "$SHARE" . ./environ cd "$LIB" -exec mono --debug "$LIB"/ChorusMerge.exe "$@" +exec dotnet run "$LIB"/ChorusMerge.exe "$@" diff --git a/startlfmerge b/startlfmerge index 139466a8..134cf5eb 100755 --- a/startlfmerge +++ b/startlfmerge @@ -2,9 +2,6 @@ # Start LfMerge # This script will reside in /usr/lib/lfmerge// -unset MONO_PREFIX -unset MONO_ENVIRON - DBVERSION=$(basename $(dirname $(readlink -f $0))) if [[ $DBVERSION != 70* ]]; then @@ -20,4 +17,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec mono --debug "$LIB"/LfMerge.exe "$@" +exec dotnet run "$LIB"/LfMerge.exe "$@" From 91ba0df7e351d05dbcb45445a83ab11250a20098 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 28 Jun 2022 14:49:33 +0700 Subject: [PATCH 03/19] Fix package version conflicts for MongoDB packages Now that we're using signed MongoDB packages, MSBuild cares about exact version numbers. Since we don't care about patch releases, we have to tell MSBuild explicitly to use version 2.4.*. --- src/LfMerge.Core/LfMerge.Core.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index 0d971434..d4129590 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -35,8 +35,8 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + + From 2d95d5637d1a684592e5dc2b3a50fa5d2a21616f Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 28 Jun 2022 15:46:09 +0700 Subject: [PATCH 04/19] Fix LfMerge build - installation targets changed With .NET 6, compiling defaults to producing Linux binaries that don't have a .exe extension, so our installation targets need to change. --- docker/scripts/create-installation-tarball.sh | 3 ++- lfmergeqm | 2 +- startlfmerge | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index 381b6f19..fac0153f 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -8,7 +8,7 @@ set -e export HOME=/tmp export XDG_CONFIG_HOME=/tmp/.config export BUILD=Release -export FRAMEWORK=net462 +export FRAMEWORK=net6.0 export DatabaseVersion=${1:-7000072} @@ -34,6 +34,7 @@ EOF # Install binaries install -d ${DBDESTDIR}/${LIB} install -m 644 output/${BUILD}/${FRAMEWORK}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/*.* ${DBDESTDIR}/${LIB} +install -m 644 output/${BUILD}/${FRAMEWORK}/LfMerge* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/LfMerge* ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/chorusmerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/chorusmerge ${DBDESTDIR}/${LIB} install -d ${DBDESTDIR}/${LIB}/Mercurial install -d ${DBDESTDIR}/${LIB}/Mercurial/hgext diff --git a/lfmergeqm b/lfmergeqm index 7bbc9171..de66874a 100755 --- a/lfmergeqm +++ b/lfmergeqm @@ -42,4 +42,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec dotnet run "$LIB"/LfMergeQueueManager.exe "$@" +exec "$LIB"/LfMergeQueueManager "$@" diff --git a/startlfmerge b/startlfmerge index 134cf5eb..4a56da46 100755 --- a/startlfmerge +++ b/startlfmerge @@ -17,4 +17,4 @@ RUNMODE=INSTALLED . ./environ cd "$LIB" -exec dotnet run "$LIB"/LfMerge.exe "$@" +exec "$LIB"/LfMerge "$@" From 596143a6902bc1f7b3e4f1af151c887f5595a2ad Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 28 Jun 2022 17:00:56 +0700 Subject: [PATCH 05/19] Newly-compiled LfMerge needs exec bit --- docker/scripts/create-installation-tarball.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index fac0153f..17d96e50 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -31,6 +31,9 @@ convert= fixutf8=/${LIB}/MercurialExtensions/fixutf8/fixutf8.py EOF +chmod +x output/${BUILD}/${FRAMEWORK}/LfMerge +chmod +x output/${BUILD}/${FRAMEWORK}/LfMergeQueueManager + # Install binaries install -d ${DBDESTDIR}/${LIB} install -m 644 output/${BUILD}/${FRAMEWORK}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/*.* ${DBDESTDIR}/${LIB} From 38c7d6bc14b0478bdf2fb42c883ee5e27da57576 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 29 Jun 2022 15:18:57 +0700 Subject: [PATCH 06/19] Change SyslogLogger to log to stdout --- src/FixFwData/Program.cs | 15 ++--------- src/LfMerge.Core/LfMerge.Core.csproj | 1 - src/LfMerge.Core/Logging/SyslogLogger.cs | 33 ++---------------------- 3 files changed, 4 insertions(+), 45 deletions(-) diff --git a/src/FixFwData/Program.cs b/src/FixFwData/Program.cs index 88477808..c387489c 100644 --- a/src/FixFwData/Program.cs +++ b/src/FixFwData/Program.cs @@ -12,8 +12,6 @@ using LfMerge.Core.Logging; using SIL.LCModel.FixData; using SIL.LCModel.Utils; -using SyslogLogger = SIL.Linux.Logging.SyslogLogger; -using SIL.PlatformUtilities; namespace FixFwData { @@ -33,16 +31,12 @@ private static int Main(string[] args) return errorsOccurred ? 1 : 0; } - private static SyslogLogger logger = null; private static bool errorsOccurred = false; private static int errorCount = 0; private static void logError(string description, bool errorFixed) { - if (logger == null) - Console.WriteLine(description); - else - logger.Error(description); + Console.WriteLine(description); errorsOccurred = true; if (errorFixed) @@ -57,8 +51,6 @@ private static int getErrorCount() private static void SetUpErrorHandling() { ExceptionLogging.Initialize("17a42e4a67dd2e42d4aa40d8bf2d23ee", Assembly.GetExecutingAssembly().GetName().Name); - if (Platform.IsUnix) - logger = new SyslogLogger("FixFwData"); } private sealed class LoggingProgress : IProgress, IDisposable @@ -81,10 +73,7 @@ public string Message get { return null; } set { - if (logger == null) - Console.Out.WriteLine(value); - else - logger.Info(value); + Console.Out.WriteLine(value); } } diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index d4129590..3bd4ced4 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -42,7 +42,6 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - diff --git a/src/LfMerge.Core/Logging/SyslogLogger.cs b/src/LfMerge.Core/Logging/SyslogLogger.cs index e0820dfc..20731aab 100644 --- a/src/LfMerge.Core/Logging/SyslogLogger.cs +++ b/src/LfMerge.Core/Logging/SyslogLogger.cs @@ -2,52 +2,23 @@ // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; -using SIL.Linux.Logging; -using SIL.PlatformUtilities; namespace LfMerge.Core.Logging { public class SyslogLogger : LoggerBase { - private SIL.Linux.Logging.SyslogLogger _logger; - public SyslogLogger(string programName = null) { - if (Platform.IsLinux) - { - _logger = new SIL.Linux.Logging.SyslogLogger(programName ?? "LfMerge"); - } - } - - private SyslogPriority SeverityToPriority(LogSeverity severity) - { - // If integer values of LogSeverity enum ever change, this function will need to be more complicated - int severityNum = (int)severity; - return (SyslogPriority)severityNum; } public override void LogMany(LogSeverity severity, IEnumerable messages) { - if (_logger == null) - { - Console.WriteLine(string.Join(Environment.NewLine, messages)); - } - else - { - _logger.LogMany(SeverityToPriority(severity), messages); - } + Console.WriteLine(string.Join(Environment.NewLine, messages)); } public override void Log(LogSeverity severity, string message) { - if (_logger == null) - { - Console.WriteLine(message); - } - else - { - _logger.Log(SeverityToPriority(severity), message); - } + Console.WriteLine(message); } } } From 866e8230007888441a41cf2f62e91a6c05f052ae Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 29 Jun 2022 15:22:31 +0700 Subject: [PATCH 07/19] Rename SyslogLogger to ConsoleLogger --- src/LfMerge.Core/Logging/SyslogLogger.cs | 4 ++-- src/LfMerge.Core/MainClass.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LfMerge.Core/Logging/SyslogLogger.cs b/src/LfMerge.Core/Logging/SyslogLogger.cs index 20731aab..7bb19be5 100644 --- a/src/LfMerge.Core/Logging/SyslogLogger.cs +++ b/src/LfMerge.Core/Logging/SyslogLogger.cs @@ -5,9 +5,9 @@ namespace LfMerge.Core.Logging { - public class SyslogLogger : LoggerBase + public class ConsoleLogger : LoggerBase { - public SyslogLogger(string programName = null) + public ConsoleLogger(string programName = null) { } diff --git a/src/LfMerge.Core/MainClass.cs b/src/LfMerge.Core/MainClass.cs index 96c4b05a..3e4851ef 100644 --- a/src/LfMerge.Core/MainClass.cs +++ b/src/LfMerge.Core/MainClass.cs @@ -49,7 +49,7 @@ internal static ContainerBuilder RegisterTypes() } var containerBuilder = new ContainerBuilder(); containerBuilder.RegisterType().SingleInstance().AsSelf(); - containerBuilder.RegisterType().SingleInstance().As() + containerBuilder.RegisterType().SingleInstance().As() .WithParameter(new TypedParameter(typeof(string), programName)); containerBuilder.RegisterType().As(); containerBuilder.RegisterType().As(); From 62c3fd69852e0dfc6ff0908d8d8753549e13664f Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 29 Jun 2022 15:55:30 +0700 Subject: [PATCH 08/19] Install LfMerge binaries with executable bit LfMerge and LfMergeQueueManager are now executable Linux binaries now that they're compiled with .NET 6, so we need mode 755 for them. --- docker/scripts/create-installation-tarball.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index 17d96e50..2ae015fd 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -31,13 +31,11 @@ convert= fixutf8=/${LIB}/MercurialExtensions/fixutf8/fixutf8.py EOF -chmod +x output/${BUILD}/${FRAMEWORK}/LfMerge -chmod +x output/${BUILD}/${FRAMEWORK}/LfMergeQueueManager - # Install binaries install -d ${DBDESTDIR}/${LIB} install -m 644 output/${BUILD}/${FRAMEWORK}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/*.* ${DBDESTDIR}/${LIB} -install -m 644 output/${BUILD}/${FRAMEWORK}/LfMerge* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/LfMerge* ${DBDESTDIR}/${LIB} +install -m 755 output/${BUILD}/${FRAMEWORK}/LfMerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMerge ${DBDESTDIR}/${LIB} +install -m 755 output/${BUILD}/${FRAMEWORK}/LfMergeQueueManager ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMergeQueueManager ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/chorusmerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/chorusmerge ${DBDESTDIR}/${LIB} install -d ${DBDESTDIR}/${LIB}/Mercurial install -d ${DBDESTDIR}/${LIB}/Mercurial/hgext From 81526b772fe5950fe3d356e91d84d1b988ddbcac Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Thu, 30 Jun 2022 09:41:10 +0700 Subject: [PATCH 09/19] Try to copy Mono.Posix.DLL into output folder With the .NET 6 build, the Mono.Posix DLL is ending up in a different location than the other DLLs, along with a native library (in .so format for Linux) that it probably also needs, so we'll add those files to the installation script. Still doesn't work, but it was worth a try. --- build/NuGet.targets | 6 +++++- docker/scripts/compile-lfmerge-combined.sh | 1 + docker/scripts/create-installation-tarball.sh | 6 +++++- docker/scripts/download-dependencies-combined.sh | 3 +++ docker/scripts/gitversion-combined.sh | 2 +- docker/scripts/setup-workspace.sh | 3 ++- pbuild.sh | 2 +- src/FixFwData/FixFwData.csproj | 2 +- src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj | 2 +- src/LfMerge.Core/LfMerge.Core.csproj | 1 + 10 files changed, 21 insertions(+), 7 deletions(-) diff --git a/build/NuGet.targets b/build/NuGet.targets index 91d5a728..ddec48dd 100644 --- a/build/NuGet.targets +++ b/build/NuGet.targets @@ -1,7 +1,11 @@ + + $(MSBuildProjectDirectory)/.. + $(RootDir)/packages + + Command='dotnet restore "$(SolutionPath)" --packages "$(NUGET_PACKAGES)"'/> diff --git a/docker/scripts/compile-lfmerge-combined.sh b/docker/scripts/compile-lfmerge-combined.sh index 115903b7..23cbce95 100755 --- a/docker/scripts/compile-lfmerge-combined.sh +++ b/docker/scripts/compile-lfmerge-combined.sh @@ -9,6 +9,7 @@ echo "Using $(which dotnet)" export DbVersion="${1-7000072}" echo "Building for ${DbVersion}" + dotnet build /t:CompileOnly /v:quiet /property:Configuration=Release /property:DatabaseVersion=${DbVersion} build/LfMerge.proj # ln -sf ../Mercurial output/ diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index 2ae015fd..23a88143 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -9,6 +9,7 @@ export HOME=/tmp export XDG_CONFIG_HOME=/tmp/.config export BUILD=Release export FRAMEWORK=net6.0 +export NETSTANDARD=netstandard2.0 export DatabaseVersion=${1:-7000072} @@ -18,7 +19,8 @@ export DBDESTDIR=tarball/lfmerge-${DatabaseVersion} export COMMONDESTDIR=tarball/lfmerge export LIB=usr/lib/lfmerge/${DatabaseVersion} export SHARE=usr/share/lfmerge/${DatabaseVersion} - +export NATIVERUNTIME=runtimes/linux-x64/native +export LIBRUNTIME=runtimes/linux-x64/lib export DBVERSIONPATH=/usr/lib/lfmerge/${DatabaseVersion} # Apparently the downloaded mercurial.ini doesn't have the right fixutf8 config, and it also @@ -34,6 +36,8 @@ EOF # Install binaries install -d ${DBDESTDIR}/${LIB} install -m 644 output/${BUILD}/${FRAMEWORK}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/*.* ${DBDESTDIR}/${LIB} +install -m 644 output/${BUILD}/${FRAMEWORK}/${NATIVERUNTIME}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/${NATIVERUNTIME}/*.* ${DBDESTDIR}/${LIB} +install -m 644 output/${BUILD}/${FRAMEWORK}/${LIBRUNTIME}/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 644 output/${BUILD}/${LIBRUNTIME}/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/LfMerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMerge ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/LfMergeQueueManager ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/LfMergeQueueManager ${DBDESTDIR}/${LIB} install -m 755 output/${BUILD}/${FRAMEWORK}/chorusmerge ${DBDESTDIR}/${LIB} 2>/dev/null || install -m 755 output/${BUILD}/chorusmerge ${DBDESTDIR}/${LIB} diff --git a/docker/scripts/download-dependencies-combined.sh b/docker/scripts/download-dependencies-combined.sh index bba8a8a9..3c9fd147 100755 --- a/docker/scripts/download-dependencies-combined.sh +++ b/docker/scripts/download-dependencies-combined.sh @@ -5,6 +5,9 @@ set -e echo "Downloading dependencies" export MONO_PREFIX=/opt/mono5-sil . environ + +pwd + if [ "x$1" = "x7000072" ]; then msbuild /t:RestorePackages /p:KeepJobsFile=false build/LfMerge.proj else diff --git a/docker/scripts/gitversion-combined.sh b/docker/scripts/gitversion-combined.sh index 50c67356..7a60259a 100755 --- a/docker/scripts/gitversion-combined.sh +++ b/docker/scripts/gitversion-combined.sh @@ -19,7 +19,7 @@ fi export MONO_PREFIX=/opt/mono5-sil RUNMODE="PACKAGEBUILD" BUILD=Release . environ -msbuild build/LfMerge.proj +# msbuild build/LfMerge.proj mkdir -p output/Release if [ -n "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -a "$UPDATE_ASSEMBLYINFO_BY_SCRIPT" -ne 0 ]; then diff --git a/docker/scripts/setup-workspace.sh b/docker/scripts/setup-workspace.sh index a851c09c..9edc84af 100755 --- a/docker/scripts/setup-workspace.sh +++ b/docker/scripts/setup-workspace.sh @@ -22,7 +22,8 @@ cd "${DEST}" if [ "${BRANCH_TO_BUILD}" ]; then git checkout "${BRANCH_TO_BUILD}" fi -git clean -dxf --exclude=packages/ + +git clean -dxf --exclude=packages/ --exclude=build/packages/ git reset --hard # FLExBridge dependencies from FW 8 builds have vanished from TeamCity, so we stored them in the Docker image under ${REPO_ROOT}/docker diff --git a/pbuild.sh b/pbuild.sh index 0a4da42b..027b2d06 100755 --- a/pbuild.sh +++ b/pbuild.sh @@ -96,7 +96,7 @@ fi # Run the build if [ "${BUILD_FW8}" -eq 0 ]; then - docker run --mount type=bind,source="$(pwd)",target=/home/builder/repo --mount type=tmpfs,dst=/tmp --env "BRANCH_TO_BUILD=${FW9_BUILD_BRANCH}" --env "BUILD_NUMBER=999" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --mount type=bind,src=/storage/nuget,dst=/storage/nuget --name tmp-lfmerge-build-7000072 lfmerge-build-7000072 + docker run -it --mount type=bind,source="$(pwd)",target=/home/builder/repo --mount type=tmpfs,dst=/tmp --env "BRANCH_TO_BUILD=${FW9_BUILD_BRANCH}" --env "BUILD_NUMBER=999" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --mount type=bind,src=/storage/nuget,dst=/storage/nuget --name tmp-lfmerge-build-7000072 lfmerge-build-7000072 else time parallel --no-notice < - net462 + net6.0 WinExe FixFwData Debug;Release diff --git a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj index 6751e5db..269a9188 100644 --- a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj +++ b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj @@ -1,7 +1,7 @@ - net462 + net6.0 LfMerge.Core.Tests Debug;Release LfMerge.Core.Tests diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index 3bd4ced4..a33fd435 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -37,6 +37,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. + From 31fcf66ef2b4e41fac4921d5204c2e6a998b5b0c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 11 Jul 2022 16:01:01 +0700 Subject: [PATCH 10/19] Upgraded SIL.Lexicon to v10 This fixes a warning, since v10 for this assembly targets .NET Standard --- src/LfMerge.Core/LfMerge.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index a33fd435..1af5b57b 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -44,7 +44,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + From 7a8064b46c7f809f326c19d864939f6d9b4d5ada Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 11 Jul 2022 16:04:03 +0700 Subject: [PATCH 11/19] Installing Mono.Posix.NETStandard to runtimes/ folder Installing it alongside the executable, like normal, resulted in a FileNotFoundException. For some reason it is expected to be in this exact place. --- docker/scripts/create-installation-tarball.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker/scripts/create-installation-tarball.sh b/docker/scripts/create-installation-tarball.sh index 23a88143..e8cd04b4 100755 --- a/docker/scripts/create-installation-tarball.sh +++ b/docker/scripts/create-installation-tarball.sh @@ -63,6 +63,13 @@ install -m 644 Mercurial/mercurial/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial install -m 644 Mercurial/mercurial/hgweb/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial/hgweb install -m 644 Mercurial/mercurial/httpclient/*.* ${DBDESTDIR}/${LIB}/Mercurial/mercurial/httpclient install -m 644 MercurialExtensions/fixutf8/*.* ${DBDESTDIR}/${LIB}/MercurialExtensions/fixutf8 +install -d ${DBDESTDIR}/${LIB}/runtimes +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64 +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} +install -d ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native +install -m 644 output/${BUILD}/${FRAMEWORK}/runtimes/linux-x64/lib/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} 2>/dev/null || install -m 644 output/${BUILD}/runtimes/linux-x64/lib/${NETSTANDARD}/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/lib/${NETSTANDARD} +install -m 644 output/${BUILD}/${FRAMEWORK}/runtimes/linux-x64/native/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native 2>/dev/null || install -m 644 output/${BUILD}/runtimes/linux-x64/native/*.* ${DBDESTDIR}/${LIB}/runtimes/linux-x64/native # Remove unit test related files (cd ${DBDESTDIR}/${LIB} && \ rm -f *.Tests.dll* *.Tests.pdb* *.TestApp.exe* SIL.TestUtilities.dll* \ From 46becf6a162acf47f55427a7cb364b0c8c0f343e Mon Sep 17 00:00:00 2001 From: josephmyers Date: Wed, 13 Jul 2022 11:30:28 +0700 Subject: [PATCH 12/19] Added reference to SIL.TestUtilities and updated NUnit This allows "dotnet build" to succeed --- src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj | 3 ++- src/LfMerge.Tests/LfMerge.Tests.csproj | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj index 269a9188..4bbca072 100644 --- a/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj +++ b/src/LfMerge.Core.Tests/LfMerge.Core.Tests.csproj @@ -32,11 +32,12 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + + diff --git a/src/LfMerge.Tests/LfMerge.Tests.csproj b/src/LfMerge.Tests/LfMerge.Tests.csproj index acddeb17..81c6a4a0 100644 --- a/src/LfMerge.Tests/LfMerge.Tests.csproj +++ b/src/LfMerge.Tests/LfMerge.Tests.csproj @@ -32,7 +32,7 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - + From abe050f3a3325a0123f7774ffbec3581e25f72f2 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Mon, 18 Jul 2022 14:14:25 +0700 Subject: [PATCH 13/19] Fix permissions error on lockfile --- Dockerfile.finalresult | 2 ++ src/LfMerge.Core/Settings/LfMergeSettings.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.finalresult b/Dockerfile.finalresult index 8938c7de..8d595c8a 100644 --- a/Dockerfile.finalresult +++ b/Dockerfile.finalresult @@ -23,6 +23,8 @@ ADD tarball/lfmerge* / RUN mkdir -m 02775 -p /var/lib/languageforge/lexicon/sendreceive/syncqueue /var/lib/languageforge/lexicon/sendreceive/webwork /var/lib/languageforge/lexicon/sendreceive/Templates /var/lib/languageforge/lexicon/sendreceive/state && chown -R www-data:www-data /var/lib/languageforge +RUN install -d -o www-data -g www-data -m 02775 /var/run/lfmerge + # TODO: Turn this into environment variables, because we want to be able to just set env vars in k8s config and restart the container COPY lfmerge.conf /etc/languageforge/conf/sendreceive.conf COPY sudoers.d.lfmerge.conf /etc/sudoers.d/lfmerge diff --git a/src/LfMerge.Core/Settings/LfMergeSettings.cs b/src/LfMerge.Core/Settings/LfMergeSettings.cs index 206bb1cd..6baf6f8d 100644 --- a/src/LfMerge.Core/Settings/LfMergeSettings.cs +++ b/src/LfMerge.Core/Settings/LfMergeSettings.cs @@ -198,7 +198,7 @@ public string LockFile { get { - var path = "/var/run"; + var path = "/var/run/lfmerge"; const string filename = "lfmerge.pid"; var attributes = File.GetAttributes(path); From e492e0963bbe14478549db5e9d4d385ec4f2a172 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 15:50:53 +0700 Subject: [PATCH 14/19] Bump MongoDB.Driver version Version 2.4 is old and has a bug where it doesn't work with .NET 6. Latest as of this commit is version 2.17.1. --- src/LfMerge.Core/LfMerge.Core.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index 1af5b57b..e7ba7a90 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -35,8 +35,8 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + + From ab09512a1827f37db501df7b8ce1ebca8fe753ad Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 16:41:18 +0700 Subject: [PATCH 15/19] Switch GitHub Actions build to FW 9 only --- .github/workflows/docker-build-fw9only.yml | 133 --------------------- .github/workflows/docker-build.yml | 53 +++----- .github/workflows/release-fw9only.yml | 93 -------------- .github/workflows/release.yml | 13 +- 4 files changed, 18 insertions(+), 274 deletions(-) delete mode 100644 .github/workflows/docker-build-fw9only.yml delete mode 100644 .github/workflows/release-fw9only.yml diff --git a/.github/workflows/docker-build-fw9only.yml b/.github/workflows/docker-build-fw9only.yml deleted file mode 100644 index bc22bd37..00000000 --- a/.github/workflows/docker-build-fw9only.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: docker-build-fw9only - -on: - # Don't run automatically, YET - # push: - # branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] - pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - calculate_branches: - runs-on: ubuntu-latest - steps: - - name: Check out current branch - uses: actions/checkout@v3.0.2 - with: - fetch-depth: 0 # All history for all tags and branches, since branch calculation step needs that - - - name: Calculate branches to build - run: | - echo "${GITHUB_REF}" - ./calculate-branches.sh --no-fw8 | grep FW9Branch >> "${GITHUB_ENV}" - - - name: Save branch names in output - id: branches_to_build - run: | - echo "FW9Branch=${FW9Branch}" - echo "::set-output name=FW9Branch::${FW9Branch}" - - outputs: - FW9Branch: ${{ steps.branches_to_build.outputs.FW9Branch }} - - build: - runs-on: ubuntu-latest - needs: calculate_branches - - # As of 2022-xx-xx, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) - strategy: - matrix: - dbversion: [7000072] - distro: [ 'bionic' ] - - steps: - - name: Check out current branch - uses: actions/checkout@v3.0.2 - with: - fetch-depth: 0 # All history for all tags and branches, since version number script needs that - - - name: Verify current branch - run: | - git branch --contains HEAD --format '%(refname)' - echo FW9 was "${FW9Branch}" - env: - FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - - - name: Calculate version number - id: version - env: - BUILD_NUMBER: ${{ github.run_number }} - DbVersion: ${{ matrix.dbversion }} - run: docker/scripts/get-version-number.sh - - - name: Save current version number to an output - id: output_version_number - run: | - echo Will tag ${{matrix.dbversion}} with ${TAG} - echo "::set-output name=TagFor${{matrix.dbversion}}::${TAG}" - echo "::set-output name=VersionFor${{matrix.dbversion}}::${VERSION}" - env: - TAG: v${{ steps.version.outputs.MsBuildVersion }} - VERSION: ${{ steps.version.outputs.MsBuildVersion }} - - - name: Set up buildx for Docker - # docker/setup-buildx-action@v2.0.0 is commit dc7b9719a96d48369863986a06765841d7ea23f6 - uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 - - - name: Find current UID - id: uid - run: echo "::set-output name=uid::$(id -u)" - - - name: Build DBVersion-specific Docker image - # docker/build-push-action@v3.0.0 is commit e551b19e49efd4e98792db7592c17c09b89db8d8 - uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 - with: - push: false - load: true - tags: lfmerge-build-${{matrix.dbversion}} - context: . - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - DbVersion=${{matrix.dbversion}} - BUILDER_UID=${{steps.uid.outputs.uid}} - - - name: Run docker image ls to verify build - run: docker image ls - - - name: Run the build container - env: - BUILD_NUMBER: ${{ github.run_number }} - DebPackageVersion: ${{ steps.version.outputs.DebPackageVersion }} - MsBuildVersion: ${{ steps.version.outputs.MsBuildVersion }} - MajorMinorPatch: ${{ steps.version.outputs.MajorMinorPatch }} - AssemblySemVer: ${{ steps.version.outputs.AssemblySemVer }} - AssemblySemFileVer: ${{ steps.version.outputs.AssemblySemFileVer }} - InformationalVersion: ${{ steps.version.outputs.InformationalVersion }} - run: docker run --mount type=bind,source="$(pwd)",target=/home/builder/repo --env "BUILD_NUMBER=${BUILD_NUMBER}" --env "DebPackageVersion=${DebPackageVersion}" --env "Version=${MsBuildVersion}" --env "MajorMinorPatch=${MajorMinorPatch}" --env "AssemblyVersion=${AssemblySemVer}" --env "FileVersion=${AssemblySemFileVer}" --env "InformationalVersion=${InformationalVersion}" --name tmp-lfmerge-build-${{matrix.dbversion}} lfmerge-build-${{matrix.dbversion}} - - - name: Collect tarball images - run: docker container cp tmp-lfmerge-build-${{matrix.dbversion}}:/home/builder/packages/lfmerge/tarball ./ - - - name: Compress tarball images for faster uploads - run: time (tar cf - tarball | gzip -c9 > tarball.tar.gz) - - - uses: actions/upload-artifact@v3.0.0 - with: - name: lfmerge-tarball - path: tarball.tar.gz - outputs: - MsBuildVersion: ${{ steps.output_version_number.outputs.VersionFor7000072 }} - TagFor7000072: ${{ steps.output_version_number.outputs.TagFor7000072 }} - FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - - release: - needs: build - uses: ./.github/workflows/release-fw9only.yml - with: - MsBuildVersion: ${{ needs.build.outputs.MsBuildVersion }} - TagFor7000072: ${{ needs.build.outputs.TagFor7000072 }} - FW9Branch: ${{ needs.build.outputs.FW9Branch }} diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index dd05c790..93377680 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,10 +1,11 @@ name: docker-build on: - push: - branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] + # Don't run automatically, YET + # push: + # branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] pull_request: - branches: [ master, fieldworks8-master ] + branches: [ master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -14,59 +15,45 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out current branch - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3.0.2 with: fetch-depth: 0 # All history for all tags and branches, since branch calculation step needs that - name: Calculate branches to build run: | echo "${GITHUB_REF}" - ./calculate-branches.sh | grep FW.Branch >> "${GITHUB_ENV}" + ./calculate-branches.sh --no-fw8 | grep FW9Branch >> "${GITHUB_ENV}" - name: Save branch names in output id: branches_to_build run: | - echo "FW8Branch=${FW8Branch}" echo "FW9Branch=${FW9Branch}" - echo "::set-output name=FW8Branch::${FW8Branch}" echo "::set-output name=FW9Branch::${FW9Branch}" outputs: - FW8Branch: ${{ steps.branches_to_build.outputs.FW8Branch }} FW9Branch: ${{ steps.branches_to_build.outputs.FW9Branch }} build: runs-on: ubuntu-latest needs: calculate_branches - # As of 2021-11-24, we build LfMerge for LCM DB versions 68-72 (and there is no 71) + # As of 2022-xx-xx, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) strategy: matrix: - dbversion: [7000068, 7000069, 7000070, 7000072] + dbversion: [7000072] distro: [ 'bionic' ] steps: - - name: Check out FW8 branch - uses: actions/checkout@v2.4.0 - if: matrix.dbversion < 7000072 - with: - ref: ${{ needs.calculate_branches.outputs.FW8Branch }} - fetch-depth: 0 # All history for all tags and branches, since GitVersion needs that - - - name: Check out FW9 branch - uses: actions/checkout@v2.4.0 - if: matrix.dbversion >= 7000072 + - name: Check out current branch + uses: actions/checkout@v3.0.2 with: - ref: ${{ needs.calculate_branches.outputs.FW9Branch }} - fetch-depth: 0 # All history for all tags and branches, since GitVersion needs that + fetch-depth: 0 # All history for all tags and branches, since version number script needs that - name: Verify current branch run: | git branch --contains HEAD --format '%(refname)' - echo FW8 was "${FW8Branch}" echo FW9 was "${FW9Branch}" env: - FW8Branch: ${{ needs.calculate_branches.outputs.FW8Branch }} FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} - name: Calculate version number @@ -87,16 +74,16 @@ jobs: VERSION: ${{ steps.version.outputs.MsBuildVersion }} - name: Set up buildx for Docker - # docker/setup-buildx-action@v1.6.0 is commit 94ab11c41e45d028884a99163086648e898eed25 - uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 + # docker/setup-buildx-action@v2.0.0 is commit dc7b9719a96d48369863986a06765841d7ea23f6 + uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 - name: Find current UID id: uid run: echo "::set-output name=uid::$(id -u)" - name: Build DBVersion-specific Docker image - # docker/build-push-action@v2.7.0 is commit a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 + # docker/build-push-action@v3.0.0 is commit e551b19e49efd4e98792db7592c17c09b89db8d8 + uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 with: push: false load: true @@ -128,17 +115,13 @@ jobs: - name: Compress tarball images for faster uploads run: time (tar cf - tarball | gzip -c9 > tarball.tar.gz) - - uses: actions/upload-artifact@v2.2.4 + - uses: actions/upload-artifact@v3.0.0 with: - name: lfmerge-tarball-${{matrix.dbversion}} + name: lfmerge-tarball path: tarball.tar.gz outputs: MsBuildVersion: ${{ steps.output_version_number.outputs.VersionFor7000072 }} - TagFor7000068: ${{ steps.output_version_number.outputs.TagFor7000068 }} - TagFor7000069: ${{ steps.output_version_number.outputs.TagFor7000069 }} - TagFor7000070: ${{ steps.output_version_number.outputs.TagFor7000070 }} TagFor7000072: ${{ steps.output_version_number.outputs.TagFor7000072 }} - FW8Branch: ${{ needs.calculate_branches.outputs.FW8Branch }} FW9Branch: ${{ needs.calculate_branches.outputs.FW9Branch }} release: @@ -146,7 +129,5 @@ jobs: uses: ./.github/workflows/release.yml with: MsBuildVersion: ${{ needs.build.outputs.MsBuildVersion }} - TagFor7000070: ${{ needs.build.outputs.TagFor7000070 }} TagFor7000072: ${{ needs.build.outputs.TagFor7000072 }} - FW8Branch: ${{ needs.build.outputs.FW8Branch }} FW9Branch: ${{ needs.build.outputs.FW9Branch }} diff --git a/.github/workflows/release-fw9only.yml b/.github/workflows/release-fw9only.yml deleted file mode 100644 index abd1a7bf..00000000 --- a/.github/workflows/release-fw9only.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: release-fw9only - -on: - workflow_call: - inputs: - MsBuildVersion: - required: true - type: string - FW9Branch: - required: true - type: string - TagFor7000072: - required: true - type: string - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2.4.0 - with: - fetch-depth: 0 - - - name: Ensure all TagForDbVersion outputs were present - env: - TAG72: ${{ inputs.TagFor7000072 }} - run: | - echo "Tag for FW9 (DbVersion 72): (${TAG72})" - - - name: Tag release branches - if: github.event_name == 'push' && github.ref == 'refs/heads/live' - env: - FW9Branch: ${{ inputs.FW9Branch }} - TAG72: ${{ inputs.TagFor7000072 }} - run: | - git config --global user.name "github-actions" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -f -a -m "Release ${TAG72}" "${TAG72}" "refs/remotes/origin/${FW9Branch}" - git push -v origin "${TAG72}" - - - name: Download build artifacts - uses: actions/download-artifact@v2.0.10 - with: - # No name specified, so will download all artifacts - path: all-tarballs - - - name: Verify that download step worked - run: ls -lR all-tarballs - - - name: Uncompress build artifacts - run: for f in all-tarballs/*/*.tar.gz; do gzip -cd "${f}" | tar xf -; done - - - name: Verify that uncompress step worked - run: ls -lR tarball - - - name: Restore executable bits - # GitHub artifacts system strips executable bits, so restore them here - # TODO: Now that we upload .tar.gz format, no longer needed since tar format preserves Unix permissions. Verify, then remove this section - run: | - chmod +x tarball/lfmerge*/usr/bin/lfmerge - chmod +x tarball/lfmerge*/usr/bin/lfmergeqm - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/chorusmerge - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/startlfmerge - chmod +x tarball/lfmerge*/usr/lib/lfmerge/*/Mercurial/hg - - - name: Login to GHCR - if: github.event_name == 'push' && github.ref == 'refs/heads/live' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build final Docker image - id: lfmerge_image - # docker/build-push-action@v2.7.0 is commit a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 - # TODO: Follow https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md for tagging - with: - push: ${{(github.event_name == 'push' && github.ref == 'refs/heads/live')}} - tags: ghcr.io/sillsdev/lfmerge:${{ inputs.MsBuildVersion }},ghcr.io/sillsdev/lfmerge:latest - context: . - file: Dockerfile.finalresult - - - name: Show metadata from LfMerge image build step - run: echo "$METADATA" - env: - METADATA: ${{ steps.lfmerge_image.output.metadata }} - - - name: List Docker images to verify build - run: docker image ls - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1253a8f6..a0a4d450 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,15 +6,9 @@ on: MsBuildVersion: required: true type: string - FW8Branch: - required: true - type: string FW9Branch: required: true type: string - TagFor7000070: - required: true - type: string TagFor7000072: required: true type: string @@ -30,25 +24,20 @@ jobs: - name: Ensure all TagForDbVersion outputs were present env: - TAG70: ${{ inputs.TagFor7000070 }} TAG72: ${{ inputs.TagFor7000072 }} run: | - echo "Tag for FW8 (DbVersion 70): (${TAG70})" echo "Tag for FW9 (DbVersion 72): (${TAG72})" - name: Tag release branches if: github.event_name == 'push' && github.ref == 'refs/heads/live' env: - FW8Branch: ${{ inputs.FW8Branch }} FW9Branch: ${{ inputs.FW9Branch }} - TAG70: ${{ inputs.TagFor7000070 }} TAG72: ${{ inputs.TagFor7000072 }} run: | git config --global user.name "github-actions" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -f -a -m "Release ${TAG70}" "${TAG70}" "refs/remotes/origin/${FW8Branch}" git tag -f -a -m "Release ${TAG72}" "${TAG72}" "refs/remotes/origin/${FW9Branch}" - git push -v origin "${TAG70}" "${TAG72}" + git push -v origin "${TAG72}" - name: Download build artifacts uses: actions/download-artifact@v2.0.10 From 7f1d95eedc5ea03f157d9370b5a8e4a8df3eb740 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 16:43:49 +0700 Subject: [PATCH 16/19] Now run new build process automatically on master --- .github/workflows/docker-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 93377680..d6b6d15e 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,9 +1,8 @@ name: docker-build on: - # Don't run automatically, YET - # push: - # branches: [ master, qa, live, fieldworks8-master, fieldworks8-qa, fieldworks8-live ] + push: + branches: [ master, qa, live ] pull_request: branches: [ master ] From 79d3465fa05fde2bb0bc751ef45a2ad27c0b8f2a Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 16:45:45 +0700 Subject: [PATCH 17/19] Use signed MongoDB driver MongoDB.Driver.signed version is still only at 2.14, though unsigned driver is up to 2.17. For now, stick with the signed driver. --- src/LfMerge.Core/LfMerge.Core.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LfMerge.Core/LfMerge.Core.csproj b/src/LfMerge.Core/LfMerge.Core.csproj index e7ba7a90..ef61cfb9 100644 --- a/src/LfMerge.Core/LfMerge.Core.csproj +++ b/src/LfMerge.Core/LfMerge.Core.csproj @@ -35,8 +35,8 @@ See full changelog at https://github.com/sillsdev/LfMerge/blob/master/CHANGELOG. - - + + From 17bee7137a94e67b51c29806d5c60b2d6122513f Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 16:50:42 +0700 Subject: [PATCH 18/19] Remove SyslogLogger class entirely We've replaced it with the ConsoleLogger.cs file. --- src/LfMerge.Core/Logging/SyslogLogger.cs | 25 ------------------------ 1 file changed, 25 deletions(-) delete mode 100644 src/LfMerge.Core/Logging/SyslogLogger.cs diff --git a/src/LfMerge.Core/Logging/SyslogLogger.cs b/src/LfMerge.Core/Logging/SyslogLogger.cs deleted file mode 100644 index 7bb19be5..00000000 --- a/src/LfMerge.Core/Logging/SyslogLogger.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2016-2018 SIL International -// This software is licensed under the MIT license (http://opensource.org/licenses/MIT) -using System; -using System.Collections.Generic; - -namespace LfMerge.Core.Logging -{ - public class ConsoleLogger : LoggerBase - { - public ConsoleLogger(string programName = null) - { - } - - public override void LogMany(LogSeverity severity, IEnumerable messages) - { - Console.WriteLine(string.Join(Environment.NewLine, messages)); - } - - public override void Log(LogSeverity severity, string message) - { - Console.WriteLine(message); - } - } -} - From 123a0daaf2b0bcfc39a1fd30357543e6ab0e244f Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Tue, 16 Aug 2022 16:54:17 +0700 Subject: [PATCH 19/19] Update date in GitHub Actions comment --- .github/workflows/docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index d6b6d15e..d8141ac2 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -36,7 +36,7 @@ jobs: runs-on: ubuntu-latest needs: calculate_branches - # As of 2022-xx-xx, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) + # As of 2022-08-16, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) strategy: matrix: dbversion: [7000072]