Modify cldr-import to work with last cldr-25 version

- cldr-25 needs some code modifications, and java 7 to compile.
- Updated instructions.

Change-Id: I56d61621591138ac2b568ebe8bb2b7d5173bb3d2
diff --git a/eclipse/README-CLDR.txt b/eclipse/README-CLDR.txt
index 31c4ce7..49c0279 100644
--- a/eclipse/README-CLDR.txt
+++ b/eclipse/README-CLDR.txt
@@ -2,7 +2,7 @@
 
 1) Get latest CLDR data available locally on your system and compile
    it, such as by:
-  $ svn co http://unicode.org/repos/cldr/tags/release-24 <cldrdir>
+  $ svn co http://unicode.org/repos/cldr/tags/release-25 <cldrdir>
   $ cd release-25/tools/java
   $ ant clean jar
 2) Required CLDR variables in Eclipse
@@ -21,6 +21,9 @@
     File -> Import -> General -> Existing Projects in Workspace
   Browse to $GWT_ROOT/eclipse and select the cldr-data, cldr-tools,
   and cldr-import projects.
-4) Run the GenerateGwtCldrData launch config -- by default, it will
+4) Set Compiler compliance level to 1.7
+    Project -> Properties -> Java Compiler -> Enable project specific settings
+    -> Compiler compliance level 1.7 -> use default compliance settings.
+5) Run the GenerateGwtCldrData launch config -- by default, it will
   overwrite files in the GWT distribution; edit the --outdir argument
   if you want it to go somewhere else.
diff --git a/eclipse/external/cldr-tools/.classpath b/eclipse/external/cldr-tools/.classpath
index 13f01b3..3a5eda8 100644
--- a/eclipse/external/cldr-tools/.classpath
+++ b/eclipse/external/cldr-tools/.classpath
@@ -7,5 +7,6 @@
 	<classpathentry kind="var" path="GWT_TOOLS/lib/apache/ant-1.7.1.jar"/>
 	<classpathentry kind="var" path="CLDR_ROOT/tools/java/libs/icu4j.jar" sourcepath="/CLDR_ROOT/tools/java/libs/icu4j-src.jar"/>
 	<classpathentry kind="var" path="CLDR_ROOT/tools/java/libs/utilities.jar" sourcepath="/CLDR_ROOT/tools/java/libs/utilities-src.jar"/>
+	<classpathentry kind="var" path="CLDR_ROOT/tools/java/libs/guava-16.0.1.jar" sourcepath="/CLDR_ROOT/tools/java/libs/guava-16.0.1-sources.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/eclipse/external/cldr-tools/.settings/org.eclipse.jdt.core.prefs b/eclipse/external/cldr-tools/.settings/org.eclipse.jdt.core.prefs
index ee81b53..7f193b6 100644
--- a/eclipse/external/cldr-tools/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/external/cldr-tools/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,8 @@
-#Mon Oct 04 15:17:42 EDT 2010
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -71,7 +70,7 @@
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/tools/cldr-import/README.txt b/tools/cldr-import/README.txt
index 1bff7b2..1561046 100644
--- a/tools/cldr-import/README.txt
+++ b/tools/cldr-import/README.txt
@@ -1,12 +1,22 @@
 Steps to process CLDR data from command-line:
 
+- You need at least java 1.7 installed in your system and ant
+
 - First you have to get latest CLDR data available locally on your system
   and compile it:
-  $ svn co http://unicode.org/repos/cldr/tags/release-24 <cldrdir>
+  $ svn co http://unicode.org/repos/cldr/tags/release-25 <cldrdir>
+
+- Second you have to appropriately patch cldr data with modifications
+  maintained in GWT (replace GWT_TOOLS with your gwt tools folder)
+  $ cd <cldrdir>
+  $ patch -p0 -i GWT_TOOLS/lib/cldr/25/GoogleMods.patch
+
+- Third, you need to compile cldr tools
   $ cd <cldrdir>/tools/java
   $ ant clean jar
 
 - Now you can run cldr-import tests:
+  $ cd GWT_ROOT/tools/cldr-import
   $ ant clean test
 
 - To generate files for certain locales in a tmp folder run:
diff --git a/tools/cldr-import/build.xml b/tools/cldr-import/build.xml
index 5f56bb0..41c69ac 100644
--- a/tools/cldr-import/build.xml
+++ b/tools/cldr-import/build.xml
@@ -9,12 +9,12 @@
   <property.ensure name="gwt.servlet.jar" location="${gwt.build.lib}/gwt-servlet.jar" />
 
   <condition property="CLDR_TOOLS" value="${env.CLDR_ROOT}/tools/java"
-      else="${gwt.tools}/lib/cldr/21">
+      else="${gwt.tools}/lib/cldr/25">
     <isset property="env.CLDR_ROOT" />
   </condition>
 
   <condition property="ICU" value="${env.CLDR_ROOT}/tools/java/libs"
-      else="${gwt.tools}/lib/cldr/21">
+      else="${gwt.tools}/lib/cldr/25">
     <isset property="env.CLDR_ROOT" />
   </condition>
 
diff --git a/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java b/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
index d55500c..0720cea 100644
--- a/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
+++ b/tools/cldr-import/src/com/google/gwt/tools/cldr/DateTimeFormatInfoProcessor.java
@@ -192,6 +192,10 @@
       String key, String method, final String... args) {
     String value = localeData.getEntry(category, locale, key);
     if (value != null) {
+      // cldr data escapes literals with single quote, but we need two single quotes when
+      // parsing message formats.
+      value = value.replace("'", "''");
+
       pw.println();
       if (getOverrides()) {
         pw.println("  @Override");
@@ -542,24 +546,6 @@
     generateDayNumber(pw, locale, "weekendEnd", "weekendEnd");
     generateDayNumber(pw, locale, "weekendStart", "weekendStart");
 
-    if (locale.isDefault()) {
-      pw.println();
-      pw.println("  @Override");
-      pw.println("  public String dateFormat() {");
-      pw.println("    return dateFormatMedium();");
-      pw.println("  }");
-      pw.println();
-      pw.println("  @Override");
-      pw.println("  public String dateTime(String timePattern, String datePattern) {");
-      pw.println("    return datePattern + \" \" + timePattern;");
-      pw.println("  }");
-      pw.println();
-      pw.println("  @Override");
-      pw.println("  public String timeFormat() {");
-      pw.println("    return timeFormatMedium();");
-      pw.println("  }");
-    }
-
     pw.println("}");
     pw.close();
   }
diff --git a/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java b/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java
index 8ebeb8a..a8e7378 100644
--- a/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java
+++ b/tools/cldr-import/src/com/google/gwt/tools/cldr/GenerateGwtCldrData.java
@@ -20,7 +20,7 @@
 
 import com.ibm.icu.dev.tool.UOption;
 
-import org.unicode.cldr.util.CldrUtility;
+import org.unicode.cldr.util.CLDRPaths;
 import org.unicode.cldr.util.Factory;
 
 import java.io.File;
@@ -36,7 +36,6 @@
  * Generate a country list for each locale, taking into account the literate
  * population of each country speaking the language.
  */
-@SuppressWarnings("unchecked")
 public class GenerateGwtCldrData {
 
   private static final GwtLocaleFactory factory = new GwtLocaleFactoryImpl();
@@ -51,7 +50,7 @@
         + "produced by cldr-tools)");
     UOption[] options = {
         UOption.HELP_H(), UOption.HELP_QUESTION_MARK(),
-        UOption.SOURCEDIR().setDefault(CldrUtility.MAIN_DIRECTORY),
+        UOption.SOURCEDIR().setDefault(CLDRPaths.MAIN_DIRECTORY),
         outputDir().setDefault("./"),
         restrictLocales(),
         processors().setDefault(DEFAULT_PROCESSORS),
diff --git a/tools/cldr-import/src/com/google/gwt/tools/cldr/ListFormattingProcessor.java b/tools/cldr-import/src/com/google/gwt/tools/cldr/ListFormattingProcessor.java
index 81e8662..4b14174 100644
--- a/tools/cldr-import/src/com/google/gwt/tools/cldr/ListFormattingProcessor.java
+++ b/tools/cldr-import/src/com/google/gwt/tools/cldr/ListFormattingProcessor.java
@@ -42,7 +42,7 @@
   protected void loadData() throws IOException {
     System.out.println("Loading data for list formatting");
     localeData.addVersions(cldrFactory);
-    localeData.addEntries("list", cldrFactory, "//ldml/listPatterns/listPattern",
+    localeData.addEntries("list", cldrFactory, "//ldml/listPatterns/listPattern/",
         "listPatternPart", "type");
   }
 
diff --git a/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java b/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java
index 57600fe..47b83d1 100644
--- a/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java
+++ b/tools/cldr-import/src/com/google/gwt/tools/cldr/LocaleData.java
@@ -665,7 +665,8 @@
     Set<GwtLocale> result = new HashSet<GwtLocale>();
     for (Map.Entry<MapKey, Map<String, String>> entry : maps.entrySet()) {
       Map<String, String> map = entry.getValue();
-      if (map.isEmpty()) {
+      // Ignore version entries
+      if ("version".equals(entry.getKey().getCategory()) || map.isEmpty()) {
         continue;
       }
       result.add(entry.getKey().getLocale());
diff --git a/tools/cldr-import/src/com/google/gwt/tools/cldr/Processor.java b/tools/cldr-import/src/com/google/gwt/tools/cldr/Processor.java
index 9f37a9d..e5a8734 100644
--- a/tools/cldr-import/src/com/google/gwt/tools/cldr/Processor.java
+++ b/tools/cldr-import/src/com/google/gwt/tools/cldr/Processor.java
@@ -277,7 +277,6 @@
     for (Map.Entry<String, String> entry : map.entrySet()) {
       pw.println(prefix + " " + entry.getKey() + "=" + entry.getValue());
     }
-    pw.println();
   }
 
   /**