• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.unicode.cldr.util;
2 
3 import java.util.List;
4 
5 import org.unicode.cldr.tool.ToolConstants;
6 
7 import com.google.common.collect.ImmutableList;
8 
9 /**
10  * Constant paths (moved here from CldrUtility).
11  * These must not be used by any code destined for the SurveyTool, as this class will not be included.
12  * @author srl
13  *
14  * TODO: clarify "this class will not be included" comment above. Why is it necessary and/or preferable
15  * not to include this class in ST? Anyway, note that CLDRConfig.getInstance().getCldrBaseDirectory()
16  * can be used as an alternative to CLDRPaths.BASE_DIRECTORY.
17  */
18 
19 public class CLDRPaths {
20     private static final String CASING_SUBDIR = "casing/";
21     private static final String VALIDITY_SUBDIR = "validity/";
22     private static final String ANNOTATIONS_DERIVED_SUBDIR = "annotationsDerived/";
23     private static final String COLLATION_SUBDIR = "collation/";
24     private static final String RBNF_SUBDIR = "rbnf/";
25     private static final String TRANSFORMS_SUBDIR = "transforms/";
26     private static final String MAIN_SUBDIR = "main/";
27     private static final String SUBDIVISIONS_SUBDIR = "subdivisions/";
28     private static final String ANNOTATIONS_SUBDIR = "annotations/";
29 
30     /** default working directory for Eclipse is . = ${workspace_loc:cldr}, which is <CLDR>/tools/java/ */
31     // set the base directory with -Dcldrdata=<value>
32     // if the main is different, use -Dcldrmain=<value>
33 
34     /** Maintained in GitHub, base directory for CLDR */
35 
36     public static final String BASE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_DIR", null));
37 
38     public static final String COMMON_DIRECTORY = CldrUtility.getPath(BASE_DIRECTORY, "common/");
39     public static final String COLLATION_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, COLLATION_SUBDIR);
40     public static final String CASING_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, CASING_SUBDIR);
41     public static final String MAIN_DIRECTORY = CldrUtility.getProperty("CLDR_MAIN",
42         CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, MAIN_SUBDIR));
43 
44     public static final String RBNF_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, RBNF_SUBDIR);
45     public static final String TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, TRANSFORMS_SUBDIR);
46     public static final String ANNOTATIONS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, ANNOTATIONS_SUBDIR);
47     public static final String SUBDIVISIONS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, SUBDIVISIONS_SUBDIR);
48     public static final String ANNOTATIONS_DERIVED_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, ANNOTATIONS_DERIVED_SUBDIR);
49     public static final String VALIDITY_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, VALIDITY_SUBDIR);
50 
51     public static final String STAGING_DIRECTORY = CldrUtility.getPath(CLDRPaths.BASE_DIRECTORY, "../cldr-staging/");
52 
53     public static final String TEST_DATA = COMMON_DIRECTORY + "testData/";
54 
55     public static final String SEED_DIRECTORY1 = CldrUtility.getProperty("CLDR_SEED",
56         CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, "../" + "seed/"));
57     public static final String SEED_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, MAIN_SUBDIR);
58     public static final String SEED_COLLATION_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, COLLATION_SUBDIR);
59     public static final String SEED_CASING_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, CASING_SUBDIR);
60     public static final String SEED_ANNOTATIONS_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, ANNOTATIONS_SUBDIR);
61 
62     public static final String EXEMPLARS_DIRECTORY = CldrUtility.getPath(CLDRPaths.BASE_DIRECTORY, "exemplars/" + MAIN_SUBDIR);
63     public static final String BIRTH_DATA_DIR = CldrUtility.getPath(BASE_DIRECTORY, "tools/java/org/unicode/cldr/util/data/births/");
64 
65     /** Maintained in SVN */
66 
67     public static final String SVN_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("SVN_DIR", BASE_DIRECTORY + "/../"));
68 
69     public static final String AUX_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
70         CldrUtility.getPath(SVN_DIRECTORY, "cldr-aux/")));
71     public static final String CHART_DIRECTORY = CldrUtility.getPath(AUX_DIRECTORY + "charts/", ToolConstants.CHART_VERSION);
72     public static final String VERIFY_DIR = CLDRPaths.CHART_DIRECTORY + "verify/";
73 
74     public static final String UCD_DATA_DIRECTORY = CldrUtility.getPath(SVN_DIRECTORY + "unicodetools/unicodetools/data/");
75 
76     public static final String ICU_DATA_DIR = CldrUtility.getPath(CldrUtility.getProperty("ICU_DATA_DIR", null)); // eg
77 
78     /** Local files, not backed up on either Github or SVN **/
79 
80     public static final String LOCAL_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("LOCAL_DIR", BASE_DIRECTORY + "/../"));
81 
82     public static final String ARCHIVE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("ARCHIVE",
83         CldrUtility.getPath(LOCAL_DIRECTORY, "cldr-archive/")));
84     public static final String LAST_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.PREVIOUS_CHART_VERSION + "/";
85     public static final String LAST_RELEASE_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.LAST_RELEASE_VERSION + "/";
86     public static final String LAST_COMMON_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_DIRECTORY, "common/");
87     public static final String LAST_TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_COMMON_DIRECTORY, TRANSFORMS_SUBDIR);
88 
89     public static final String GEN_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_GEN_DIR",
90         CldrUtility.getPath(LOCAL_DIRECTORY, "Generated/cldr/")));
91     public static final String DATA_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_EXT_DATA_DIR",
92         CldrUtility.getPath(LOCAL_DIRECTORY, "Data/")));
93 
94     // probably can be removed & replaced
95     public static final String CLDR_PRIVATE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_PRIVATE_DATA",
96         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-private/")));
97     public static final String TMP_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
98         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp/")));
99     public static final String TMP2_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
100         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp2/")));
101 
102     /**
103      * @deprecated please use XMLFile and CLDRFILE getSupplementalDirectory()
104      * @see DEFAULT_SUPPLEMENTAL_DIRECTORY
105      */
106     public static final String SUPPLEMENTAL_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, "supplemental/");
107     /**
108      * Only the default, if no other directory is specified.
109      */
110     public static final String DEFAULT_SUPPLEMENTAL_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, "supplemental/");
111     public static final String LOG_DIRECTORY = CldrUtility.getPath(TMP_DIRECTORY, "logs/");
112     public static final String TEST_DIR = CldrUtility.getPath(CLDRPaths.TMP_DIRECTORY, "test/");
113 
114     /** If the generated BAT files are to work, this needs to be set right */
115     public static final String COMPARE_PROGRAM = "\"C:\\Program Files (x86)\\Compare It!\\wincmp3.exe\"";
116 
117     /**
118      * @deprecated Don't use this from any code that is run from the .JAR (SurveyTool, tests, etc).
119      *             If it must be used, add a comment next to the usage to explain why it is needed.
120      */
121     public static final String UTIL_DATA_DIR = FileReaders.getRelativeFileName(CldrUtility.class, "data/");
122 
123     public enum DIRECTORIES {
124         common_dtd, common_properties, common_uca,
125 
126         common_bcp47(DtdType.ldmlBCP47),
127 
128         common_annotations(DtdType.ldml), common_casing(DtdType.ldml), common_collation(DtdType.ldml), common_main(DtdType.ldml), common_rbnf(
129             DtdType.ldml), common_segments(DtdType.ldml), common_subdivisions(DtdType.ldml),
130 
131         common_supplemental(DtdType.supplementalData), common_transforms(DtdType.supplementalData), common_validity(DtdType.supplementalData),
132 
133         keyboards_android(DtdType.keyboard, DtdType.platform), keyboards_chromeos(DtdType.keyboard, DtdType.platform), keyboards_dtd(DtdType.keyboard,
134             DtdType.platform), keyboards_osx(DtdType.keyboard,
135                 DtdType.platform), keyboards_und(DtdType.keyboard, DtdType.platform), keyboards_windows(DtdType.keyboard, DtdType.platform),
136                 ;
137 
138         public final List<DtdType> dtdType;
139 
DIRECTORIES(DtdType... dtdType)140         private DIRECTORIES(DtdType... dtdType) {
141             this.dtdType = ImmutableList.copyOf(dtdType);
142         }
143     }
144 }
145