]> granicus.if.org Git - icu/commitdiff
ICU-12734 ICU4C API change report tool, tweaks for ICU 58.
authorAndy Heninger <andy.heninger@gmail.com>
Thu, 22 Sep 2016 01:15:51 +0000 (01:15 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Thu, 22 Sep 2016 01:15:51 +0000 (01:15 +0000)
X-SVN-Rev: 39325

tools/release/java/src/com/ibm/icu/dev/tools/docs/StableAPI.java
tools/release/java/src/com/ibm/icu/dev/tools/docs/genReport.xslt

index 98cf30322588486fc352c27e4a24cf6090082a8f..b8654d421a2352b1062989eb6036caada3002394 100644 (file)
@@ -1,5 +1,6 @@
 /*
  **********************************************************************
+ * Copyright (C) 2016 and later: Unicode, Inc. and others.
  * Copyright (c) 2006-2013, International Business Machines
  * Corporation and others.  All Rights Reserved.
  **********************************************************************
@@ -15,6 +16,7 @@ import java.io.InputStream;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.regex.*;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
@@ -244,36 +246,13 @@ public class StableAPI {
     private static boolean didWarnSuperTrim = false;
 
     private static String trimICU(String ver) {
-        final String ICU_ = ICU_SPACE_PREFIX;
-        final String ICU = "ICU";
-        if(ver != null) { // trim everything before the 'ICU...'
-            ver = ver.trim();
-            int icuidx = ver.lastIndexOf(ICU_);
-            int icuidx1 = ver.lastIndexOf(ICU);
-            if(icuidx>=0) {
-                warn("Trimming text before 'ICU': " + ver.substring(0,icuidx+ICU_.length()));
-                ver = ver.substring(icuidx+ICU_.length()).trim();
-            } else if(icuidx1>=0) {
-                warn("Trimming text before 'ICU ': " + ver.substring(0,icuidx1+ICU.length()));
-                ver = ver.substring(icuidx1+ICU.length()).trim();
-            }
-
-            // always trim anything after a version #
-            {
-                int n;
-                for(n=ver.length()-1;n>0 && ((ver.charAt(n)=='.') || Character.isDigit(ver.charAt(n))) ;n--)
-                    ;
-                if(n>0) {
-                    warn("Trimming extraneous text after version: '" + ver.substring(n+1,ver.length()) + "'");
-                    ver = ver.substring(n+1).trim();
-                    if(!didWarnSuperTrim) {
-                       didWarnSuperTrim = true;
-                       warn("Please ONLY use:  '@whatever ICU X.Y.Z'");
-                    }
-                }
-            }
+        Matcher icuVersionMatcher =  Pattern.compile("ICU *\\d+(\\.\\d+){0,2}").matcher(ver);
+        if (icuVersionMatcher.find()) {
+            return icuVersionMatcher.group();
+        } else {
+            warn("@whatever not followed by ICU <version number>");
+            return "";
         }
-        return ver;
     }
 
     private String setVer(String prevVer, String whichVer, File dir) {
index 6625b6142c5c5b672affa79e7c9711b82670b467..dd0a4ed9f2581abbe09142eca87413bdd0bc31e6 100644 (file)
@@ -26,7 +26,7 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
   <xsl:template match="/">
     <html>
        <xsl:comment>
-     Copyright (C)  <xsl:value-of select="$ourYear" />: Unicode, Inc. and others.
+     Copyright (C) 2016 and later: Unicode, Inc. and others.
      License &amp; terms of use: http://www.unicode.org/copyright.html
        </xsl:comment>
     <head>