Skip to content

Commit

Permalink
CLDR-17284 v44.1 cldr-json: fix version number
Browse files Browse the repository at this point in the history
- _cldrVersion was, recently, only having the major version (44 not 44.1)
- validate semver of the package version
- print a warning if the 'patch' version  is nonzero (#.#.0)
  • Loading branch information
srl295 committed Dec 13, 2023
1 parent 880c12f commit 1386955
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.ibm.icu.text.MessageFormat;
import com.ibm.icu.util.NoUnit;
import com.ibm.icu.util.ULocale;
import com.vdurmont.semver4j.Semver;
import com.vdurmont.semver4j.Semver.SemverType;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -405,7 +407,20 @@ public Ldml2JsonConverter(
this.coverageValue = Level.get(coverage).getLevel();
this.pkgVersion = pkgVersion;

LdmlConvertRules.addVersionHandler(pkgVersion.split("\\.")[0]);
System.out.println("pkgVersion: " + pkgVersion);
final Semver ver = new Semver(pkgVersion, SemverType.STRICT);

if (ver.getPatch() != 0) {
System.err.println(
WARN_ICON + " WARNING: ignoring non-zero patch version in " + pkgVersion);
}

if (ver.getMinor() == 0) {
LdmlConvertRules.addVersionHandler(ver.getMajor().toString());
} else {
LdmlConvertRules.addVersionHandler(
ver.getMajor().toString() + "." + ver.getMinor().toString());
}

configFileReader = new LdmlConfigFileReader();
configFileReader.read(configFile, type);
Expand Down

0 comments on commit 1386955

Please sign in to comment.