• 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     public static final String COMMON_SUBDIR = "common/";
21     public static final String CASING_SUBDIR = "casing/";
22     public static final String VALIDITY_SUBDIR = "validity/";
23     public static final String ANNOTATIONS_DERIVED_SUBDIR = "annotationsDerived/";
24     public static final String COLLATION_SUBDIR = "collation/";
25     public static final String RBNF_SUBDIR = "rbnf/";
26     public static final String TRANSFORMS_SUBDIR = "transforms/";
27     public static final String MAIN_SUBDIR = "main/";
28     public static final String SUBDIVISIONS_SUBDIR = "subdivisions/";
29     public static final String ANNOTATIONS_SUBDIR = "annotations/";
30 
31     /** default working directory for Eclipse is . = ${workspace_loc:cldr}, which is <CLDR>/tools/java/ */
32     // set the base directory with -Dcldrdata=<value>
33     // if the main is different, use -Dcldrmain=<value>
34 
35     /** Maintained in GitHub, base directory for CLDR */
36 
37     public static final String BASE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_DIR", null));
38 
39     public static final String COMMON_DIRECTORY = CldrUtility.getPath(BASE_DIRECTORY, "common/");
40     public static final String COLLATION_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, COLLATION_SUBDIR);
41     public static final String CASING_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, CASING_SUBDIR);
42     public static final String MAIN_DIRECTORY = CldrUtility.getProperty("CLDR_MAIN",
43         CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, MAIN_SUBDIR));
44 
45     public static final String RBNF_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, RBNF_SUBDIR);
46     public static final String TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, TRANSFORMS_SUBDIR);
47     public static final String ANNOTATIONS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, ANNOTATIONS_SUBDIR);
48     public static final String SUBDIVISIONS_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, SUBDIVISIONS_SUBDIR);
49     public static final String ANNOTATIONS_DERIVED_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, ANNOTATIONS_DERIVED_SUBDIR);
50     public static final String VALIDITY_DIRECTORY = CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, VALIDITY_SUBDIR);
51 
52     public static final String STAGING_DIRECTORY = CldrUtility.getPath(CLDRPaths.BASE_DIRECTORY, "../cldr-staging/");
53 
54     public static final String TEST_DATA = COMMON_DIRECTORY + "testData/";
55 
56     public static final String SEED_DIRECTORY1 = CldrUtility.getProperty("CLDR_SEED",
57         CldrUtility.getPath(CLDRPaths.COMMON_DIRECTORY, "../" + "seed/"));
58     public static final String SEED_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, MAIN_SUBDIR);
59     public static final String SEED_COLLATION_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, COLLATION_SUBDIR);
60     public static final String SEED_CASING_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, CASING_SUBDIR);
61     public static final String SEED_ANNOTATIONS_DIRECTORY = CldrUtility.getPath(SEED_DIRECTORY1, ANNOTATIONS_SUBDIR);
62 
63     public static final String EXEMPLARS_DIRECTORY = CldrUtility.getPath(CLDRPaths.BASE_DIRECTORY, "exemplars/" + MAIN_SUBDIR);
64     public static final String BIRTH_DATA_DIR = CldrUtility.getPath(BASE_DIRECTORY, "tools/java/org/unicode/cldr/util/data/births/");
65 
66     public static final String CHART_DIRECTORY = CldrUtility.getPath(STAGING_DIRECTORY + "docs/charts/", ToolConstants.CHART_VERSION);
67     public static final String VERIFY_DIR = CLDRPaths.CHART_DIRECTORY + "verify/";
68 
69     /** Maintained in SVN */
70 
71     public static final String SVN_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("SVN_DIR", BASE_DIRECTORY + "/../"));
72 
73     public static final String AUX_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
74         CldrUtility.getPath(SVN_DIRECTORY, "cldr-aux/")));
75 
76     public static final String UCD_DATA_DIRECTORY = CldrUtility.getPath(SVN_DIRECTORY + "unicodetools/unicodetools/data/");
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_RELEASE_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.LAST_RELEASE_VERSION_WITH0 + "/";
85     public static final String LAST_COMMON_DIRECTORY = CldrUtility.getPath(LAST_RELEASE_DIRECTORY, "common/");
86     public static final String LAST_TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_COMMON_DIRECTORY, TRANSFORMS_SUBDIR);
87 
88     public static final String GEN_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_GEN_DIR",
89         CldrUtility.getPath(LOCAL_DIRECTORY, "Generated/cldr/")));
90     public static final String DATA_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_EXT_DATA_DIR",
91         CldrUtility.getPath(LOCAL_DIRECTORY, "Data/")));
92 
93     // probably can be removed & replaced
94     public static final String CLDR_PRIVATE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_PRIVATE_DATA",
95         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-private/")));
96     public static final String TMP_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
97         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp/")));
98     public static final String TMP2_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
99         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp2/")));
100 
101     /**
102      * @deprecated please use XMLFile and CLDRFILE getSupplementalDirectory()
103      * @see DEFAULT_SUPPLEMENTAL_DIRECTORY
104      */
105     @Deprecated
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     @Deprecated
122     public static final String UTIL_DATA_DIR = FileReaders.getRelativeFileName(CldrUtility.class, "data/");
123 
124     public enum DIRECTORIES {
125         common_dtd, common_properties, common_uca,
126 
127         common_bcp47(DtdType.ldmlBCP47),
128 
129         common_annotations(DtdType.ldml), common_casing(DtdType.ldml), common_collation(DtdType.ldml), common_main(DtdType.ldml), common_rbnf(
130             DtdType.ldml), common_segments(DtdType.ldml), common_subdivisions(DtdType.ldml),
131 
132         common_supplemental(DtdType.supplementalData), common_transforms(DtdType.supplementalData), common_validity(DtdType.supplementalData),
133 
134         keyboards_android(DtdType.keyboard, DtdType.platform), keyboards_chromeos(DtdType.keyboard, DtdType.platform), keyboards_dtd(DtdType.keyboard,
135             DtdType.platform), keyboards_osx(DtdType.keyboard,
136                 DtdType.platform), keyboards_und(DtdType.keyboard, DtdType.platform), keyboards_windows(DtdType.keyboard, DtdType.platform),
137                 ;
138 
139         public final List<DtdType> dtdType;
140 
DIRECTORIES(DtdType... dtdType)141         private DIRECTORIES(DtdType... dtdType) {
142             this.dtdType = ImmutableList.copyOf(dtdType);
143         }
144     }
145 }
146