diff --git a/.github/workflows/ci+cd.yml b/.github/workflows/ci+cd.yml index 139cd6488..a3e79c14c 100644 --- a/.github/workflows/ci+cd.yml +++ b/.github/workflows/ci+cd.yml @@ -26,11 +26,11 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - framework: [net461, net8.0] + framework: [net462, net8.0] exclude: # dotnet on Linux cannot build net461 without additional, unnecessary, work - os: ubuntu-latest - framework: net461 + framework: net462 concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.framework }} cancel-in-progress: true @@ -45,7 +45,6 @@ jobs: uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 with: dotnet-version: | - 6.0.x 8.0.x - name: Restore @@ -60,11 +59,11 @@ jobs: - name: Test Chorus run: dotnet test src/Chorus.Tests/Chorus.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults - if: matrix.framework == 'net461' + if: matrix.framework == 'net462' - name: Test Chorus Hub run: dotnet test src/ChorusHubTests/ChorusHubTests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults - if: matrix.framework == 'net461' + if: matrix.framework == 'net462' - name: Test ChorusMerge run: dotnet test src/ChorusMerge.Tests/ChorusMerge.Tests.csproj -f ${{ matrix.framework }} --no-build -c Release --filter TestCategory!=SkipOnBuildServer -- NUnit.TestOutputXml=TestResults diff --git a/Directory.Build.props b/Directory.Build.props index 264f8f660..01bf03074 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - net461 + net462 Debug;Release End-user collaboration library via 3-way xml merging and hg dvcs under the hood. SIL International @@ -27,7 +27,7 @@ See full changelog at https://github.com/sillsdev/chorus/blob/master/CHANGELOG.m has platform dependent binaries, so msbuild decides that Chorus is platform specific, regardless of the actual platform target. For the same reason we have to set RuntimeIdentifiers when building with .NET 5 on AppVeyor. Otherwise the build - fails with an error that there is no target for'net461/win7-x86'. --> + fails with an error that there is no target for'net462/win7-x86'. --> AnyCPU win-x86;win-x64 diff --git a/l10n/l10n.proj b/l10n/l10n.proj index 6754c84ff..5b6e5f76d 100644 --- a/l10n/l10n.proj +++ b/l10n/l10n.proj @@ -46,7 +46,7 @@ Lines=" <note xml:lang="en">Not found in static scan of compiled code (version 0.0.0)</note>"/> - + diff --git a/src/Chorus.Tests/ChorusFixtureSetup.cs b/src/Chorus.Tests/ChorusFixtureSetup.cs new file mode 100644 index 000000000..1941e365d --- /dev/null +++ b/src/Chorus.Tests/ChorusFixtureSetup.cs @@ -0,0 +1,18 @@ +using L10NSharp; +using NUnit.Framework; + +namespace Chorus.Tests +{ + internal class ChorusFixtureSetup + { + [SetUpFixture] + public class SetupFixture + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + LocalizationManager.StrictInitializationMode = false; + } + } + } +} diff --git a/src/Chorus.Tests/clone/ClonerTests.cs b/src/Chorus.Tests/clone/ClonerTests.cs index e83c2476a..295adaa13 100644 --- a/src/Chorus.Tests/clone/ClonerTests.cs +++ b/src/Chorus.Tests/clone/ClonerTests.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Drawing; using System.IO; diff --git a/src/Chorus/Chorus.csproj b/src/Chorus/Chorus.csproj index 354bd746e..9109fbf87 100644 --- a/src/Chorus/Chorus.csproj +++ b/src/Chorus/Chorus.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/Chorus/ChorusSystem.cs b/src/Chorus/ChorusSystem.cs index fe6c79c75..9df704e3b 100644 --- a/src/Chorus/ChorusSystem.cs +++ b/src/Chorus/ChorusSystem.cs @@ -123,11 +123,11 @@ public static void SetUpLocalization(string desiredUiLangId, var versionObj = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; // We don't need to reload strings for every "revision" (that might be every time we build). var version = "" + versionObj.Major + "." + versionObj.Minor + "." + versionObj.Build; - LocalizationManager.Create(TranslationMemory.XLiff, desiredUiLangId, "Chorus", + LocalizationManager.Create(desiredUiLangId, "Chorus", Application.ProductName, version, directoryOfInstalledXlfFiles, directoryOfUserModifiedXlfFiles, Icon.FromHandle(Properties.Resources.chorus32x32.GetHicon()), // should call DestroyIcon, but when? - "issues@chorus.palaso.org", "Chorus"); + "issues@chorus.palaso.org", new [] {"Chorus"}); } [Obsolete("Only one kind of TranslationMemory is supported: XLF; there is no need for the kind parameter.")] diff --git a/src/Chorus/app.config b/src/Chorus/app.config index 4f5f46af5..d4e233644 100644 --- a/src/Chorus/app.config +++ b/src/Chorus/app.config @@ -5,7 +5,7 @@
- + diff --git a/src/ChorusHub/ChorusHub.csproj b/src/ChorusHub/ChorusHub.csproj index 95644a920..bad50e55e 100644 --- a/src/ChorusHub/ChorusHub.csproj +++ b/src/ChorusHub/ChorusHub.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/src/ChorusHub/app.config b/src/ChorusHub/app.config index 3dbff35f4..2a0024f75 100644 --- a/src/ChorusHub/app.config +++ b/src/ChorusHub/app.config @@ -1,3 +1,3 @@ - + diff --git a/src/ChorusHubApp/ChorusHubApp.csproj b/src/ChorusHubApp/ChorusHubApp.csproj index 177232fec..4b36fba56 100644 --- a/src/ChorusHubApp/ChorusHubApp.csproj +++ b/src/ChorusHubApp/ChorusHubApp.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/ChorusHubApp/app.config b/src/ChorusHubApp/app.config index 4e05733d3..88a86c811 100644 --- a/src/ChorusHubApp/app.config +++ b/src/ChorusHubApp/app.config @@ -2,4 +2,4 @@ - + diff --git a/src/ChorusHubTests/ChorusHubFixtureSetup.cs b/src/ChorusHubTests/ChorusHubFixtureSetup.cs new file mode 100644 index 000000000..bf6f76389 --- /dev/null +++ b/src/ChorusHubTests/ChorusHubFixtureSetup.cs @@ -0,0 +1,15 @@ +using L10NSharp; +using NUnit.Framework; + +namespace ChorusHubTests +{ + [SetUpFixture] + public class ChorusHubFixtureSetup + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + LocalizationManager.StrictInitializationMode = false; + } + } +} diff --git a/src/ChorusMerge.Tests/ChorusMerge.Tests.csproj b/src/ChorusMerge.Tests/ChorusMerge.Tests.csproj index c9adf996f..6fcfc68c2 100644 --- a/src/ChorusMerge.Tests/ChorusMerge.Tests.csproj +++ b/src/ChorusMerge.Tests/ChorusMerge.Tests.csproj @@ -4,7 +4,7 @@ ChorusMerge.Tests ChorusMerge.Tests Unit tests for LibChorus.dll - net461;net8.0 + net462;net8.0 true false @@ -16,7 +16,7 @@ - + diff --git a/src/ChorusMerge.Tests/ChorusMergeFixtureSetup.cs b/src/ChorusMerge.Tests/ChorusMergeFixtureSetup.cs new file mode 100644 index 000000000..ab9b568ca --- /dev/null +++ b/src/ChorusMerge.Tests/ChorusMergeFixtureSetup.cs @@ -0,0 +1,15 @@ +using L10NSharp; +using NUnit.Framework; + +namespace ChorusMerge.Tests +{ + [SetUpFixture] + public class ChorusMergeFixtureSetup + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + LocalizationManager.StrictInitializationMode = false; + } + } +} diff --git a/src/ChorusMerge/ChorusMerge.csproj b/src/ChorusMerge/ChorusMerge.csproj index 37d019c20..4348af3e0 100644 --- a/src/ChorusMerge/ChorusMerge.csproj +++ b/src/ChorusMerge/ChorusMerge.csproj @@ -5,7 +5,7 @@ ChorusMerge SIL.Chorus.ChorusMerge Exe - net461;net8.0 + net462;net8.0 https://github.com/sillsdev/chorus.git true @@ -13,7 +13,7 @@ - + diff --git a/src/ChorusMerge/Program.cs b/src/ChorusMerge/Program.cs index 75e692215..d48f79af0 100644 --- a/src/ChorusMerge/Program.cs +++ b/src/ChorusMerge/Program.cs @@ -2,12 +2,10 @@ using System; using System.IO; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; using Chorus.FileTypeHandlers; using Chorus.merge; using Chorus.merge.xml.generic; -using SIL.PlatformUtilities; +using L10NSharp; // Allow redirecting Console.Error for unit tests (Avoid spurious build failures) [assembly: InternalsVisibleTo("ChorusMerge.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005f4452c387d979e3cba05fd73bb9aebe8f8830874663d66a7869f614a8f5e8def658d5c5920fae609d28aa005d5a9af5bd758ca8f19ad0347b7aa76e1f723f8994792136f5ceff9fb6f719d4337f65da2e1d66a85cc5e28e4656a1a30c2ff513440393177625c725d3fb156dc3c11610ea5936b9404ab9d51f7eb71ac0aa27bd")] @@ -35,6 +33,7 @@ public static int Main(string[] args) { try { + LocalizationManager.StrictInitializationMode = false; string ourFilePath = args[0]; string commonFilePath = args[1]; string theirFilePath = args[2]; diff --git a/src/Installer/ChorusHub.wxs b/src/Installer/ChorusHub.wxs index b17d90665..7192f36c3 100644 --- a/src/Installer/ChorusHub.wxs +++ b/src/Installer/ChorusHub.wxs @@ -22,9 +22,9 @@ http://blogs.msdn.com/robmen/archive/2003/10/04/56479.aspx --> - - - + + + - + @@ -73,46 +73,46 @@ http://blogs.msdn.com/robmen/archive/2003/10/04/56479.aspx --> - + - + - + - + - + - + - + - + - + - + @@ -149,7 +149,7 @@ http://blogs.msdn.com/robmen/archive/2003/10/04/56479.aspx --> - + diff --git a/src/Installer/ChorusMergeModule.wxs b/src/Installer/ChorusMergeModule.wxs index 703c51970..b95e61b43 100644 --- a/src/Installer/ChorusMergeModule.wxs +++ b/src/Installer/ChorusMergeModule.wxs @@ -45,13 +45,13 @@ http://blogs.msdn.com/robmen/archive/2003/10/04/56479.aspx --> - + - + - + @@ -59,34 +59,34 @@ http://blogs.msdn.com/robmen/archive/2003/10/04/56479.aspx --> - + - + - + - + - + - + - + - + - + diff --git a/src/LibChorus.TestUtilities/LibChorus.TestUtilities.csproj b/src/LibChorus.TestUtilities/LibChorus.TestUtilities.csproj index a6ca46956..a74d65687 100644 --- a/src/LibChorus.TestUtilities/LibChorus.TestUtilities.csproj +++ b/src/LibChorus.TestUtilities/LibChorus.TestUtilities.csproj @@ -10,9 +10,9 @@ - - - + + + diff --git a/src/LibChorus/LibChorus.csproj b/src/LibChorus/LibChorus.csproj index 330dbd98a..70f2c2326 100644 --- a/src/LibChorus/LibChorus.csproj +++ b/src/LibChorus/LibChorus.csproj @@ -4,22 +4,22 @@ Chorus LibChorus SIL.Chorus.LibChorus - net461;netstandard2.0 + net462;netstandard2.0 https://github.com/sillsdev/chorus.git - + - + - - - + + + diff --git a/src/LibChorus/Properties/launchSettings.json.sample b/src/LibChorus/Properties/launchSettings.json.sample index 32ed1dfed..9183b8576 100644 --- a/src/LibChorus/Properties/launchSettings.json.sample +++ b/src/LibChorus/Properties/launchSettings.json.sample @@ -2,12 +2,12 @@ "profiles": { "FLEx Bridge (Get)": { "commandName": "Executable", - "executablePath": "C:\\fwrepo\\flexbridge\\output\\Debug\\net461\\FLExBridge.exe", + "executablePath": "C:\\fwrepo\\flexbridge\\output\\Debug\\net462\\FLExBridge.exe", "commandLineArgs": "-u developer -p c:\\fwrepo\\fw\\DistFiles\\Projects -v obtain -projDir c:\\fwrepo\\fw\\DistFiles\\Projects -fwAppsDir C:\\fwrepo\\fw\\Output\\Debug -fwmodel 7000072 -liftmodel 0.13_ldml3 -locale en -pipeID SendReceivec:\\fwrepo\\fw\\DistFiles\\Projectsobtain" }, "FLEx Bridge (S&R)": { "commandName": "Executable", - "executablePath": "C:\\fwrepo\\flexbridge\\output\\Debug\\net461\\FLExBridge.exe", + "executablePath": "C:\\fwrepo\\flexbridge\\output\\Debug\\net462\\FLExBridge.exe", "commandLineArgs": "-u developer -p c:\\fwrepo\\fw\\DistFiles\\Projects\\Sena 3\\Sena 3.fwdata -v send_receive -f C:\\fwrepo\\fw\\Output\\Debug\\FixFwData.exe -projDir c:\\fwrepo\\fw\\DistFiles\\Projects -fwAppsDir C:\\fwrepo\\fw\\Output\\Debug -fwmodel 7000072 -liftmodel 0.13_ldml3 -locale en -pipeID SendReceivec:\\fwrepo\\fw\\DistFiles\\Projects\\Sena 3\\Sena 3.fwdatasend_receive -ws seh" } } diff --git a/src/LibChorus/app.config b/src/LibChorus/app.config index 36837ee8f..73187c7b0 100644 --- a/src/LibChorus/app.config +++ b/src/LibChorus/app.config @@ -12,4 +12,4 @@ - + diff --git a/src/LibChorusTests/FileHandlers/ChorusFileTypeHandlerCollectionTests.cs b/src/LibChorusTests/FileHandlers/ChorusFileTypeHandlerCollectionTests.cs index 703443145..57a92c3e1 100644 --- a/src/LibChorusTests/FileHandlers/ChorusFileTypeHandlerCollectionTests.cs +++ b/src/LibChorusTests/FileHandlers/ChorusFileTypeHandlerCollectionTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using NUnit.Framework; using Chorus.FileTypeHandlers; using Chorus.FileTypeHandlers.audio; @@ -22,7 +23,8 @@ private static string SamplePluginPath var configOutputDir = Directory.GetParent(BaseDir); var outputDir = configOutputDir.Parent.FullName; var config = configOutputDir.Name; - var samplePluginDllPath = Path.Combine(outputDir, "SamplePlugin", config, "net461", "Tests-ChorusPlugin.dll"); + var frameworkDir = Path.GetFileName(BaseDir); + var samplePluginDllPath = Path.Combine(outputDir, "SamplePlugin", config, frameworkDir, "Tests-ChorusPlugin.dll"); return samplePluginDllPath; } } @@ -43,6 +45,7 @@ public void CreateWithInstalledHandlers_ContainsTestAFileTypeHandler() [Test] public void CreateWithInstalledHandlers_HandlersFromAdditionalAssembly() { + Assume.That(RuntimeInformation.FrameworkDescription.Contains(".NET Framework"), "Not running on .NET Framework"); var handlers = ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers( new[] { SamplePluginPath }).Handlers; Assert.That(handlers.Select(x => x.GetType().Name), Has.Member("TestAFileTypeHandler")); diff --git a/src/LibChorusTests/LibChorus.Tests.csproj b/src/LibChorusTests/LibChorus.Tests.csproj index f35a40c54..daac3380b 100644 --- a/src/LibChorusTests/LibChorus.Tests.csproj +++ b/src/LibChorusTests/LibChorus.Tests.csproj @@ -4,7 +4,7 @@ LibChorus.Tests LibChorus.Tests Unit tests for LibChorus.dll - net461;net8.0 + net462;net8.0 true false @@ -17,9 +17,9 @@ - - - + + + diff --git a/src/LibChorusTests/LibChorusSetupFixture.cs b/src/LibChorusTests/LibChorusSetupFixture.cs new file mode 100644 index 000000000..c8b0801f9 --- /dev/null +++ b/src/LibChorusTests/LibChorusSetupFixture.cs @@ -0,0 +1,15 @@ +using L10NSharp; +using NUnit.Framework; + +namespace LibChorus.Tests +{ + [SetUpFixture] + public class LibChorusSetupFixture + { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + LocalizationManager.StrictInitializationMode = false; + } + } +} \ No newline at end of file diff --git a/src/LibChorusTests/merge/xml/lift/MultiTextMergingTests.cs b/src/LibChorusTests/merge/xml/lift/MultiTextMergingTests.cs index 5c78a6b80..a5e65e1db 100644 --- a/src/LibChorusTests/merge/xml/lift/MultiTextMergingTests.cs +++ b/src/LibChorusTests/merge/xml/lift/MultiTextMergingTests.cs @@ -7,7 +7,7 @@ using NUnit.Framework; -namespace LiftIO.Tests.Merging +namespace LibChorus.Tests.merge.xml.lift { [TestFixture] public class MultiTextMergingTests @@ -84,163 +84,5 @@ public void SkipConvertingElementToTextElementInAnotherFile() Assert.That(doc.DocumentElement.OuterXml, Does.Not.Contain("myStuff"), "Converted element to , but should not have."); Assert.That(doc.DocumentElement.OuterXml, Does.Contain("myStuff"), "Element went away, but should have been present."); } -/* - [Test] - public void MergeMultiTextNodes_OneAddedNewMultiTextElement() - { - string red = @""; - string ancestor = red; - - string blue = @" -
- first -
-
"; - - CheckBothWays(red, blue, ancestor, "lexical-unit/form[@lang='one']/text[text()='first']"); - } - - // private void CheckBothWays(string red, string blue, string ancestor, string xpath) - // { - // XmlNode result= LiftSavvyMergeStrategy.MergeMultiTextPieces(red, blue, ancestor); - // XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath); - // result= LiftSavvyMergeStrategy.MergeMultiTextPieces(blue, red, ancestor); - // XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath); - // } - - private void CheckBothWays(string red, string blue, string ancestor, params string[] xpaths) - { - CheckOneWay(red, blue, ancestor, xpaths); - CheckOneWay(blue, red, ancestor, xpaths); - } - - private void CheckOneWay(string ours, string theirs, string ancestor, params string[] xpaths) - { - XmlNode result = MultiTextMerger.MergeMultiTextPieces(ours, theirs, ancestor); - foreach (string xpath in xpaths) - { - XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath); - } - } - - [Test] - public void MergeMultiTextNodes_EachAddedDifferentAlternatives_GetBoth() - { - - string ancestor = @" - "; - - - string red = @" -
- first -
-
"; - - string blue = @" -
- second -
-
"; - - CheckBothWays(red, blue, ancestor, - "lexical-unit/form[@lang='one']/text[text()='first']", - "lexical-unit/form[@lang='two']/text[text()='second']"); - } - - [Test] - public void MergeMultiTextNodes_OneAddedAnAlternatives_GetBoth() - { - string red = @" -
- first -
-
"; - - string ancestor = red; - - string blue = @" -
- first -
-
- second -
-
"; - - CheckBothWays(red, blue, ancestor, - "lexical-unit/form[@lang='one']/text[text()='first']", - "lexical-unit/form[@lang='two']/text[text()='second']"); - } - - [Test] - public void MergeMultiTextNodes_OnePutSomethingInPreviouslyEmptyForm() - { - string red = @" -
- "; - - string ancestor = red; - - string blue = @" - - first - -
"; - - Assert.That(Utilities.AreXmlElementsEqual(red, blue), Is.False); - - CheckBothWays(red, blue, ancestor, - "lexical-unit/form[@lang='one']/text[text()='first']"); - } - - [Test] - public void MergeMultiTextNodes_OnePutSomethingInPreviouslyEmptyFormText() - { - string red = @" -
-
"; - - string ancestor = red; - - - string blue = @" -
- first -
-
"; - - CheckBothWays(red, blue, ancestor, - "lexical-unit/form[@lang='one']/text[text()='first']"); - } - - [Test] - public void WeDeletedAForm_FormRemoved() - { - string red = @""; - string blue = @" -
- first -
-
"; - string ancestor = blue; - - CheckOneWay(blue, red, ancestor, "lexical-unit[ not(form)]"); - } - - [Test] - public void TheyDeleteAForm_FormRemoved() - { - string red = @""; - string blue = @" -
- first -
-
"; - string ancestor = blue; - - CheckOneWay(blue, red, ancestor, "lexical-unit[ not(form)]"); - } -*/ } } diff --git a/src/SampleApp/app.config b/src/SampleApp/app.config index 0dff63a07..ac5aa757c 100644 --- a/src/SampleApp/app.config +++ b/src/SampleApp/app.config @@ -1,3 +1,3 @@ - +