From 4276ee5095d853fc62478f7300e9b33583dd9055 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Mon, 9 Dec 2024 18:58:46 +0100 Subject: [PATCH 01/11] Fix placeholder name for addition comparison test --- .../{TODO-MISSING-RMG-ISSUE.txt => 154.txt} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/{TODO-MISSING-RMG-ISSUE.txt => 154.txt} (72%) diff --git a/unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/TODO-MISSING-RMG-ISSUE.txt b/unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/154.txt similarity index 72% rename from unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/TODO-MISSING-RMG-ISSUE.txt rename to unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/154.txt index 21a9644c8..c050b2a62 100644 --- a/unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/TODO-MISSING-RMG-ISSUE.txt +++ b/unicodetools/src/main/resources/org/unicode/text/UCD/AdditionComparisons/154.txt @@ -1,6 +1,5 @@ -# [Template for property comparison tests of character encoding proposals] -# [RMG ISSUE TITLE] -# https://github.com/unicode-org/utc-release-management/issues/[RMG ISSUE NUMBER] +# Tangut: Two Tangut ideographs (18D1D..18D1E) +# https://github.com/unicode-org/utc-release-management/issues/154 # Names always differ. # Age always differs since these tests are comparing additions to pre-existing characters. From d4ad7b880a8daaeab3aae0e364f8acf7e1aff283 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 14:47:18 +0100 Subject: [PATCH 02/11] wat --- .../java/org/unicode/text/UCD/TestTestUnicodeInvariants.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index 1d4c4e779..c984531b7 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -43,6 +43,9 @@ void testUnicodeInvariants() throws IOException { @Test void testAdditionComparisons() throws IOException { final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/"); + if (!directory.exists()) { + throw new IOException(directory.getAbsolutePath() + " does not exist"); + } int rc = 0; for (var file : directory.listFiles()) { final String filename = file.getName(); From 8461d425f9e67d4965ce10ea6d845cad39b2e7ca Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 14:53:29 +0100 Subject: [PATCH 03/11] spots --- .../java/org/unicode/text/UCD/TestTestUnicodeInvariants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index c984531b7..29e266309 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -44,7 +44,7 @@ void testUnicodeInvariants() throws IOException { void testAdditionComparisons() throws IOException { final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/"); if (!directory.exists()) { - throw new IOException(directory.getAbsolutePath() + " does not exist"); + throw new IOException(directory.getAbsolutePath() + " does not exist"); } int rc = 0; for (var file : directory.listFiles()) { From 1c447d3850f22284de34b64adc3c5baf9ab40cbf Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 15:03:34 +0100 Subject: [PATCH 04/11] Trace more --- .../org/unicode/text/UCD/TestTestUnicodeInvariants.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index 29e266309..e067a34a0 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -44,7 +44,13 @@ void testUnicodeInvariants() throws IOException { void testAdditionComparisons() throws IOException { final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/"); if (!directory.exists()) { - throw new IOException(directory.getAbsolutePath() + " does not exist"); + throw new IOException( + "new File(" + + Settings.SRC_DIR + + "UCD/AdditionComparisons/" + + ") has absolute path" + + directory.getAbsolutePath() + + " which does not exist"); } int rc = 0; for (var file : directory.listFiles()) { From 838bf9ddb01dcb6ba7615484d42d66c7bbb88c2f Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 15:25:04 +0100 Subject: [PATCH 05/11] aaaaaaaaa --- .../text/UCD/TestTestUnicodeInvariants.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index e067a34a0..2c017c89b 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test; import org.unicode.text.UCD.TestUnicodeInvariants.BackwardParseException; import org.unicode.text.utility.Settings; +import org.unicode.text.utility.Settings.UnicodeTools; public class TestTestUnicodeInvariants { @Test @@ -45,10 +46,18 @@ void testAdditionComparisons() throws IOException { final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/"); if (!directory.exists()) { throw new IOException( - "new File(" + "UnicodeTools.UNICODETOOLS_REPO_DIR=" + + UnicodeTools.UNICODETOOLS_REPO_DIR + + ", " + + "UnicodeTools.UNICODETOOLS_DIR=" + + UnicodeTools.UNICODETOOLS_DIR + + ", " + + "UnicodeTools.UNICODETOOLS_RSRC_DIR=" + + UnicodeTools.UNICODETOOLS_RSRC_DIR + + ", " + + "Settings.SRC_DIR=" + Settings.SRC_DIR - + "UCD/AdditionComparisons/" - + ") has absolute path" + + ", " + directory.getAbsolutePath() + " which does not exist"); } From d8d0845d2725d6f136b66d58c3b2e4b9f84e74e7 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 17:48:41 +0100 Subject: [PATCH 06/11] Try something --- .../src/main/java/org/unicode/text/utility/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java index 7c8d523ab..e443baf3b 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java @@ -319,7 +319,7 @@ public static void ensureOutputDir(String dir) { } public static final String SRC_DIR = - Utility.fixFileName(UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text") + "/"; + UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; /** Used for data files */ public static final String SRC_UCA_DIR = SRC_DIR + "UCA/"; From 89d658eacf63a928ebb94e359aa6707297063e53 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 10 Dec 2024 18:28:19 +0100 Subject: [PATCH 07/11] spots --- .../src/main/java/org/unicode/text/utility/Settings.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java index e443baf3b..c3c033772 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java @@ -318,8 +318,7 @@ public static void ensureOutputDir(String dir) { } } - public static final String SRC_DIR = - UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; + public static final String SRC_DIR = UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; /** Used for data files */ public static final String SRC_UCA_DIR = SRC_DIR + "UCA/"; From b966672fa873a2eeccae860fcf3c7a5697866036 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Wed, 11 Dec 2024 09:47:56 +0100 Subject: [PATCH 08/11] meow --- .../org/unicode/text/utility/Settings.java | 2 +- .../text/UCD/TestTestUnicodeInvariants.java | 22 ++++++------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java index c3c033772..c5b18af00 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java @@ -318,7 +318,7 @@ public static void ensureOutputDir(String dir) { } } - public static final String SRC_DIR = UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; + private static final String SRC_DIR = UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; /** Used for data files */ public static final String SRC_UCA_DIR = SRC_DIR + "UCA/"; diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index 2c017c89b..82a0142f8 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.unicode.text.UCD.TestUnicodeInvariants.BackwardParseException; import org.unicode.text.utility.Settings; -import org.unicode.text.utility.Settings.UnicodeTools; public class TestTestUnicodeInvariants { @Test @@ -20,7 +19,6 @@ void testSRC_UCD_DIR() { assertAll( "assert that no components of Settings.SRC_UCD_DIR are null", () -> assertNotNull(Settings.SRC_UCD_DIR, "Settings.SRC_UCD_DIR"), - () -> assertNotNull(Settings.SRC_DIR, "Settings.SRC_DIR"), () -> assertNotNull( Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR, @@ -43,23 +41,17 @@ void testUnicodeInvariants() throws IOException { @Test void testAdditionComparisons() throws IOException { - final var directory = new File(Settings.SRC_DIR + "UCD/AdditionComparisons/"); + final var directory = + new File( + Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR + + "org/unicode/text/UCD/AdditionComparisons/"); if (!directory.exists()) { throw new IOException( - "UnicodeTools.UNICODETOOLS_REPO_DIR=" - + UnicodeTools.UNICODETOOLS_REPO_DIR - + ", " - + "UnicodeTools.UNICODETOOLS_DIR=" - + UnicodeTools.UNICODETOOLS_DIR - + ", " - + "UnicodeTools.UNICODETOOLS_RSRC_DIR=" - + UnicodeTools.UNICODETOOLS_RSRC_DIR - + ", " - + "Settings.SRC_DIR=" - + Settings.SRC_DIR + "Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR=" + + Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR + ", " + directory.getAbsolutePath() - + " which does not exist"); + + " does not exist"); } int rc = 0; for (var file : directory.listFiles()) { From f2c5181a10bc30a80eea80dabf46119c01e5079c Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Wed, 11 Dec 2024 10:24:43 +0100 Subject: [PATCH 09/11] Try to just get rid of them --- .../org/unicode/text/UCA/MakeNamesChart.java | 10 ++- .../org/unicode/text/UCA/WriteCharts.java | 76 ++++++++++++++----- .../unicode/text/UCD/GenerateCaseFolding.java | 11 ++- .../unicode/text/UCD/GenerateConfusables.java | 2 +- .../text/UCD/GenerateConfusablesCopy.java | 4 +- .../text/UCD/GenerateNamedSequences.java | 2 +- .../UCD/GenerateStandardizedVariants.java | 4 +- .../unicode/text/UCD/MakeUnicodeFiles.java | 5 +- .../unicode/text/UCD/UseTransliterator.java | 3 +- .../org/unicode/text/utility/Settings.java | 8 -- .../unicode/text/utility/UnicodeDataFile.java | 4 +- .../text/UCD/TestTestUnicodeInvariants.java | 13 +--- 12 files changed, 89 insertions(+), 53 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/text/UCA/MakeNamesChart.java b/unicodetools/src/main/java/org/unicode/text/UCA/MakeNamesChart.java index 04753950e..a42121ef8 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCA/MakeNamesChart.java +++ b/unicodetools/src/main/java/org/unicode/text/UCA/MakeNamesChart.java @@ -69,17 +69,19 @@ public static void main(String[] args) throws Exception { isWhiteSpace = new UnicodeSet(up.getSet("whitespace=Yes")); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "nameslist_index.html", + MakeNamesChart.class.getResource("nameslist_index.html").getPath(), Utility.UTF8, NAMESLIST_DIR + "index.html"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, NAMESLIST_DIR + "charts.css"); + MakeNamesChart.class.getResource("charts.css").getPath(), + Utility.LATIN1, + NAMESLIST_DIR + "charts.css"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "nameslist_help.html", + MakeNamesChart.class.getResource("nameslist_help.html").getPath(), Utility.UTF8, NAMESLIST_DIR + "help.html"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "nameslist.css", + MakeNamesChart.class.getResource("nameslist.css").getPath(), Utility.LATIN1, NAMESLIST_DIR + "nameslist.css"); diff --git a/unicodetools/src/main/java/org/unicode/text/UCA/WriteCharts.java b/unicodetools/src/main/java/org/unicode/text/UCA/WriteCharts.java index 3b2fbdf32..7d0ccae5b 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCA/WriteCharts.java +++ b/unicodetools/src/main/java/org/unicode/text/UCA/WriteCharts.java @@ -107,18 +107,27 @@ public static void collationChart(UCA uca) throws IOException { final String folder = GEN_CHARTS_DIR + "collation/"; Utility.copyTextFile( - Settings.SRC_UCA_DIR + "index.html", + WriteCharts.class.getResource("index.html").getPath(), Utility.UTF8, folder + "index.html", replacement); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css", null); + WriteCharts.class.getResource("charts.css").getPath(), + Utility.LATIN1, + folder + "charts.css", + null); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "help.html", Utility.UTF8, folder + "help.html", null); + WriteCharts.class.getResource("help.html").getPath(), + Utility.UTF8, + folder + "help.html", + null); indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS); Utility.appendFile( - Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement); + WriteCharts.class.getResource("index_header.html").getPath(), + Utility.UTF8, + indexFile, + replacement); /* indexFile.println(""); @@ -319,18 +328,25 @@ public static void normalizationChart() throws IOException { // System.out.println("File: " + new File(".").getCanonicalPath()); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "index.html", + WriteCharts.class.getResource("index.html").getPath(), Utility.UTF8, folder + "index.html", replacement); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css"); + WriteCharts.class.getResource("charts.css").getPath(), + Utility.LATIN1, + folder + "charts.css"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "norm_help.html", Utility.UTF8, folder + "help.html"); + WriteCharts.class.getResource("norm_help.html").getPath(), + Utility.UTF8, + folder + "help.html"); indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS); Utility.appendFile( - Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement); + WriteCharts.class.getResource("index_header.html").getPath(), + Utility.UTF8, + indexFile, + replacement); /* indexFile.println(""); @@ -447,18 +463,27 @@ public static void caseChart() throws IOException { final String folder = GEN_CHARTS_DIR + "case/"; Utility.copyTextFile( - Settings.SRC_UCA_DIR + "index.html", + WriteCharts.class.getResource("index.html").getPath(), Utility.UTF8, folder + "index.html", replacement); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css", null); + WriteCharts.class.getResource("charts.css").getPath(), + Utility.LATIN1, + folder + "charts.css", + null); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "case_help.html", Utility.UTF8, folder + "help.html", null); + WriteCharts.class.getResource("case_help.html").getPath(), + Utility.UTF8, + folder + "help.html", + null); indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS); Utility.appendFile( - Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement); + WriteCharts.class.getResource("index_header.html").getPath(), + Utility.UTF8, + indexFile, + replacement); /* indexFile.println(""); @@ -574,18 +599,22 @@ public static void scriptChart() throws IOException { final String folder = GEN_CHARTS_DIR + "script/"; Utility.copyTextFile( - Settings.SRC_UCA_DIR + "index.html", + WriteCharts.class.getResource("index.html").getPath(), Utility.UTF8, folder + "index.html", replacement); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css"); + WriteCharts.class.getResource("charts.css").getPath(), + Utility.LATIN1, + folder + "charts.css"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "script_help.html", Utility.UTF8, folder + "help.html"); + WriteCharts.class.getResource("script_help.html").getPath(), + Utility.UTF8, + folder + "help.html"); indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS); Utility.appendFile( - Settings.SRC_UCA_DIR + "script_index_header.html", + WriteCharts.class.getResource("script_index_header.html").getPath(), Utility.UTF8, indexFile, replacement); @@ -724,18 +753,25 @@ public static void indexChart() throws IOException { final String folder = GEN_CHARTS_DIR + "name/"; Utility.copyTextFile( - Settings.SRC_UCA_DIR + "index.html", + WriteCharts.class.getResource("index.html").getPath(), Utility.UTF8, folder + "index.html", replacement); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "charts.css", Utility.LATIN1, folder + "charts.css"); + WriteCharts.class.getResource("charts.css").getPath(), + Utility.LATIN1, + folder + "charts.css"); Utility.copyTextFile( - Settings.SRC_UCA_DIR + "name_help.html", Utility.UTF8, folder + "help.html"); + WriteCharts.class.getResource("name_help.html").getPath(), + Utility.UTF8, + folder + "help.html"); indexFile = Utility.openPrintWriter(folder, "index_list.html", Utility.UTF8_WINDOWS); Utility.appendFile( - Settings.SRC_UCA_DIR + "index_header.html", Utility.UTF8, indexFile, replacement); + WriteCharts.class.getResource("index_header.html").getPath(), + Utility.UTF8, + indexFile, + replacement); int columnCount = 0; char lastInitial = 0; diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateCaseFolding.java b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateCaseFolding.java index 93e05b25d..5275e2159 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateCaseFolding.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateCaseFolding.java @@ -872,7 +872,11 @@ static void generateSpecialCasing(boolean normalize) throws IOException { break; case 6: Utility.appendFile( - Settings.SRC_UCD_DIR + "SpecialCasingIota.txt", Utility.UTF8, out); + GenerateCaseFolding.class + .getResource("SpecialCasingIota.txt") + .getPath(), + Utility.UTF8, + out); break; case 7: out.println( @@ -888,7 +892,10 @@ static void generateSpecialCasing(boolean normalize) throws IOException { } out.println(line); } - Utility.appendFile(Settings.SRC_UCD_DIR + "SpecialCasingFooter.txt", Utility.UTF8, out); + Utility.appendFile( + GenerateCaseFolding.class.getResource("SpecialCasingFooter.txt").getPath(), + Utility.UTF8, + out); udf.close(); // Utility.renameIdentical(mostRecent, Utility.getOutputName(newFile), batName[0]); } diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusables.java b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusables.java index c19e670cc..b623aac36 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusables.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusables.java @@ -1421,7 +1421,7 @@ public void writeSourceOrder( if (appendFile) { final String[] replacements = {"%date%", Default.getDate()}; Utility.appendFile( - Settings.SRC_UCD_DIR + "confusablesHeader.txt", + GenerateConfusables.class.getResource("confusablesHeader.txt").getPath(), Utility.UTF8_WINDOWS, out, replacements); diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusablesCopy.java b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusablesCopy.java index 98223af55..d6e9830fe 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusablesCopy.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateConfusablesCopy.java @@ -2125,7 +2125,9 @@ public void writeSourceOrder( if (appendFile) { final String[] replacements = {"%date%", Default.getDate()}; Utility.appendFile( - Settings.SRC_UCD_DIR + "confusablesHeader.txt", + GenerateConfusablesCopy.class + .getResource("confusablesHeader.txt") + .getPath(), Utility.UTF8_WINDOWS, out, replacements); diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateNamedSequences.java b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateNamedSequences.java index acb34dd92..c947feeef 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateNamedSequences.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateNamedSequences.java @@ -160,7 +160,7 @@ public static void generate(String filename2) throws IOException { }; Utility.appendFile( - Settings.SRC_UCD_DIR + "NamedSequences-Template.html", + GenerateNamedSequences.class.getResource("NamedSequences-Template.html").getPath(), Utility.UTF8, out, replacementList); diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateStandardizedVariants.java b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateStandardizedVariants.java index 0045bc7b8..ea9d10338 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/GenerateStandardizedVariants.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/GenerateStandardizedVariants.java @@ -186,7 +186,9 @@ public static void generate() throws IOException { }; Utility.appendFile( - Settings.SRC_UCD_DIR + "StandardizedVariants-Template.html", + GenerateStandardizedVariants.class + .getResource("StandardizedVariants-Template.html") + .getPath(), Utility.UTF8, out, replacementList); diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java b/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java index 7eabf498c..579d063ee 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/MakeUnicodeFiles.java @@ -370,7 +370,10 @@ private void build() { try { br = Utility.openReadFile( - Settings.SRC_UCD_DIR + "MakeUnicodeFiles.txt", Utility.UTF8); + MakeUnicodeFiles.class + .getResource("MakeUnicodeFiles.txt") + .getPath(), + Utility.UTF8); String file = null, property = null, value = "", comments = ""; while (true) { String line = br.readLine(); diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java b/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java index 27e1658a1..0cf56d8b7 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java @@ -6,7 +6,6 @@ import java.io.PrintWriter; import org.unicode.cldr.draft.FileUtilities; import org.unicode.cldr.util.TransliteratorUtilities; -import org.unicode.text.utility.Settings; public class UseTransliterator { public static void main(String[] args) throws IOException { @@ -15,7 +14,7 @@ public static void main(String[] args) throws IOException { final File f2 = new File("org/unicode/text/UCD/"); System.out.println(f2.getAbsolutePath()); TransliteratorUtilities.registerTransliteratorFromFile( - Settings.SRC_UCD_DIR, "any-temp"); + UseTransliterator.class.getResource("/").getPath(), "any-temp"); final Transliterator t = Transliterator.getInstance("any-temp"); final File f = new File(filename); final String fileContents = diff --git a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java index c5b18af00..e207c63cc 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/Settings.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/Settings.java @@ -317,12 +317,4 @@ public static void ensureOutputDir(String dir) { } } } - - private static final String SRC_DIR = UnicodeTools.UNICODETOOLS_RSRC_DIR + "org/unicode/text/"; - - /** Used for data files */ - public static final String SRC_UCA_DIR = SRC_DIR + "UCA/"; - - /** Used for data files */ - public static final String SRC_UCD_DIR = SRC_DIR + "UCD/"; } diff --git a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java index 0c48dee8b..8742263e8 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java @@ -70,7 +70,9 @@ private UnicodeDataFile(String directory, String filename, boolean isHTML) throw } try { Utility.appendFile( - Settings.SRC_UCD_DIR + filename + "Header" + fileType, Utility.UTF8_UNIX, out); + getClass().getResource(filename + "Header" + fileType).getPath(), + Utility.UTF8_UNIX, + out); } catch (final RuntimeIOException e) { if (!(e.getCause() instanceof FileNotFoundException)) { throw e; diff --git a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java index 82a0142f8..d21f50eb8 100644 --- a/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java +++ b/unicodetools/src/test/java/org/unicode/text/UCD/TestTestUnicodeInvariants.java @@ -18,7 +18,6 @@ public class TestTestUnicodeInvariants { void testSRC_UCD_DIR() { assertAll( "assert that no components of Settings.SRC_UCD_DIR are null", - () -> assertNotNull(Settings.SRC_UCD_DIR, "Settings.SRC_UCD_DIR"), () -> assertNotNull( Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR, @@ -41,17 +40,9 @@ void testUnicodeInvariants() throws IOException { @Test void testAdditionComparisons() throws IOException { - final var directory = - new File( - Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR - + "org/unicode/text/UCD/AdditionComparisons/"); + final var directory = new File(getClass().getResource("AdditionComparisons").getPath()); if (!directory.exists()) { - throw new IOException( - "Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR=" - + Settings.UnicodeTools.UNICODETOOLS_RSRC_DIR - + ", " - + directory.getAbsolutePath() - + " does not exist"); + throw new IOException(directory.getAbsolutePath() + " does not exist"); } int rc = 0; for (var file : directory.listFiles()) { From 20b01bfa7dc825a85ca0d68284d62e357f10ce64 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Wed, 11 Dec 2024 10:32:19 +0100 Subject: [PATCH 10/11] meow --- .../src/main/java/org/unicode/text/utility/UnicodeDataFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java index 8742263e8..6489c5db0 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java @@ -70,7 +70,7 @@ private UnicodeDataFile(String directory, String filename, boolean isHTML) throw } try { Utility.appendFile( - getClass().getResource(filename + "Header" + fileType).getPath(), + getClass().getResource("/").getPath() + filename + "Header" + fileType, Utility.UTF8_UNIX, out); } catch (final RuntimeIOException e) { From f10cc946674b1a17600ee27f3fead238aa53f73c Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Wed, 11 Dec 2024 11:26:55 +0100 Subject: [PATCH 11/11] . not /, and use a class in the right package --- .../main/java/org/unicode/text/UCD/UseTransliterator.java | 2 +- .../main/java/org/unicode/text/utility/UnicodeDataFile.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java b/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java index 0cf56d8b7..3321216ae 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/UseTransliterator.java @@ -14,7 +14,7 @@ public static void main(String[] args) throws IOException { final File f2 = new File("org/unicode/text/UCD/"); System.out.println(f2.getAbsolutePath()); TransliteratorUtilities.registerTransliteratorFromFile( - UseTransliterator.class.getResource("/").getPath(), "any-temp"); + UseTransliterator.class.getResource(".").getPath(), "any-temp"); final Transliterator t = Transliterator.getInstance("any-temp"); final File f = new File(filename); final String fileContents = diff --git a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java index 6489c5db0..f8c630c22 100644 --- a/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java +++ b/unicodetools/src/main/java/org/unicode/text/utility/UnicodeDataFile.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.PrintWriter; import org.unicode.text.UCD.Default; +import org.unicode.text.UCD.MakeUnicodeFiles; import org.unicode.text.utility.Utility.RuntimeIOException; public class UnicodeDataFile { @@ -70,7 +71,10 @@ private UnicodeDataFile(String directory, String filename, boolean isHTML) throw } try { Utility.appendFile( - getClass().getResource("/").getPath() + filename + "Header" + fileType, + MakeUnicodeFiles.class.getResource(".").getPath() + + filename + + "Header" + + fileType, Utility.UTF8_UNIX, out); } catch (final RuntimeIOException e) {