ICU-2055 update to how resfiles.mk is generated, first pass at draft-override inclusion

X-SVN-Rev: 16466
This commit is contained in:
Steven R. Loomis 2004-10-13 04:45:55 +00:00
parent 94a92cdceb
commit 27f2a4bc01

View file

@ -3362,6 +3362,7 @@ public class LDML2ICUConverter {
}
private void writeDeprecated(){
// TODO: separate out reading this file to another item.. need to force -f option.
File f = new File(specialsDir + File.separator + "..", DEPRECATED_LIST);
File depF = new File(options[WRITE_DEPRECATED].value);
if(!depF.isDirectory()) {
@ -3369,6 +3370,7 @@ public class LDML2ICUConverter {
usage();
return; // NOTREACHED
}
HashMap overrideMap = new HashMap(); // list of locales to take regardless of draft status.
String myTreeName = depF.getName();
// System.out.println("myTreeName = " + myTreeName);
// System.out.println("deprecated file " + f.toString());
@ -3392,7 +3394,16 @@ public class LDML2ICUConverter {
// System.out.println(" - not ELEMENT");
continue;
}
//String name = node.getNodeName();
String aName = node.getNodeName();
if(aName.equals("overrideDraft")) {
String theLocale = LDMLUtilities.getAttributeValue(node, "locale");
System.out.println("INFO: added override-draft locale " + theLocale);
overrideMap.put(theLocale,theLocale); // TODO: waste.
continue;
} else if(!aName.equals("deprecates")) {
throw new IllegalArgumentException("ERR: unknown node: " + aName);
// NOTREACHED
}
//String type;
// System.out.println("Node: " + name.toString());
@ -3445,7 +3456,14 @@ public class LDML2ICUConverter {
System.out.print(".");
fromFiles.put(inFiles[i].getName(),inFiles[i]); // add to hash
} else {
System.out.print("d");
String localeName = inFiles[i].getName();
localeName = localeName.substring(0,localeName.indexOf('.'));
if(overrideMap.containsKey(localeName)) {
fromFiles.put(inFiles[i].getName(),inFiles[i]); // add to hash
System.out.print("[o:"+localeName+"]");
} else {
System.out.print("d");
}
}
}
if(writeDraft==false) {
@ -3665,6 +3683,30 @@ public class LDML2ICUConverter {
try {
System.out.println("INFO: writing ICU build file: " + resfiles_mk_name);
PrintStream resfiles_mk = new PrintStream(new FileOutputStream(resfiles_mk_name) );
resfiles_mk.println( "# * Copyright (C) 1997-2004, International Business Machines" );
resfiles_mk.println( "# * Corporation and others. All Rights Reserved." );
resfiles_mk.println( "# A list of txt's to build" );
resfiles_mk.println( "# Note: " );
resfiles_mk.println( "#" );
resfiles_mk.println( "# If you are thinking of modifying this file, READ THIS. " );
resfiles_mk.println( "#" );
resfiles_mk.println( "# Instead of changing this file [unless you want to check it back in]," );
resfiles_mk.println( "# you should consider creating a '" + shortstub + "local.mk' file in this same directory." );
resfiles_mk.println( "# Then, you can have your local changes remain even if you upgrade or" );
resfiles_mk.println( "# reconfigure ICU." );
resfiles_mk.println( "#" );
resfiles_mk.println( "# Example '" + shortstub + "local.mk' files:" );
resfiles_mk.println( "#" );
resfiles_mk.println( "# * To add an additional locale to the list: " );
resfiles_mk.println( "# _____________________________________________________" );
resfiles_mk.println( "# | " + stub + "_SOURCE_LOCAL = myLocale.txt ..." );
resfiles_mk.println( "#" );
resfiles_mk.println( "# * To REPLACE the default list and only build with a few" );
resfiles_mk.println( "# locale:" );
resfiles_mk.println( "# _____________________________________________________" );
resfiles_mk.println( "# | " + stub + "_SOURCE = ar.txt ar_AE.txt en.txt de.txt zh.txt" );
resfiles_mk.println( "#" );
resfiles_mk.println( "#" );
resfiles_mk.println( "# Generated by LDML2ICUConverter, from LDML source files. " );
resfiles_mk.println("");
resfiles_mk.println("# Aliases which do not have a corresponding xx.xml file (see " + DEPRECATED_LIST + ")");