Skip to content

Commit

Permalink
CLDR-17583 v46 BRS Births, part 2 (#3725)
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored May 15, 2024
1 parent 795135e commit 9fe3e80
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ public static void main(String[] args) throws IOException {

String logDirectory = myOptions.get("log").getValue();

System.out.println("en");
System.out.println("en\tBegin");
Births english = new Births("en");
english.writeBirth(logDirectory, "en", null);
english.writeBirthValues(dataDirectory + "/" + OutdatedPaths.OUTDATED_ENGLISH_DATA);
String englishDataFile = dataDirectory + "/" + OutdatedPaths.OUTDATED_ENGLISH_DATA;
english.writeBirthValues(englishDataFile);

Map<Long, Pair<CldrVersion, String>> pathToPrevious = new HashMap<>();

Expand Down Expand Up @@ -194,8 +195,9 @@ public static void main(String[] args) throws IOException {
if (!ltp.set(fileName).getRegion().isEmpty()) {
continue; // skip region locales
}
// TODO skip default content locales
System.out.println(fileName);
// TODO skip default content
System.out.println();
System.out.println(fileName + "\t" + "Begin");
Births other = new Births(fileName);
Set<String> newer = other.writeBirth(logDirectory, fileName, english);

Expand Down Expand Up @@ -254,11 +256,15 @@ public static void main(String[] args) throws IOException {
}
}
}
// give a reminder since the above will be lost
System.out.println("Wrote: " + englishDataFile);
if (errorCount != 0) {
throw new IllegalArgumentException("Done, but " + errorCount + " errors");
throw new IllegalArgumentException(
"Done, but " + errorCount + " errors writing to " + outputDataFile);
} else {
System.out.println("Done, no errors");
System.out.println("Done, no errors writing to: " + outputDataFile);
}
System.out.println("Please commit the above two files and start a PR.");
}

static class Births {
Expand All @@ -277,20 +283,21 @@ static class Births {
DisplayAndInputProcessor[] processors = new DisplayAndInputProcessor[factories.length];

for (int i = 0; i < factories.length; ++i) {
final CldrVersion ver = CldrVersion.CLDR_VERSIONS_DESCENDING.get(i);
try {
files[i] = factories[i].make(file, USE_RESOLVED);
processors[i] = new DisplayAndInputProcessor(files[i], false);
} catch (Exception e) {
// stop when we fail to find
} catch (SimpleFactory.NoSourceDirectoryException nsd) {
// stop when we fail to find a dir
System.out.println(
"Stopped at "
+ file
+ ", "
+ CldrVersion.CLDR_VERSIONS_DESCENDING.get(i));
// e.printStackTrace();
String.format("%s\tEnd of source directories at v%s", file, ver));
break;
} catch (Throwable t) {
throw new RuntimeException(
"Exception while processing " + file + " v" + ver, t);
}
}
System.out.println(String.format("%s\tDone", file));
birthToPaths = Relation.of(new TreeMap<CldrVersion, Set<String>>(), TreeSet.class);
pathToBirthCurrentPrevious = new HashMap<>();
for (String xpath : files[0]) {
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 9fe3e80

Please sign in to comment.