• 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/cldr-code/ */
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(CldrUtility.DIR_KEY, 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/cldr-code/src/main/resources/org/unicode/cldr/util/data/births");
65     public static final String UNITTEST_DATA_DIR = CldrUtility.getPath(BASE_DIRECTORY, "tools/cldr-code/src/test/resources/org/unicode/cldr/unittest/data");
66 
67     public static final String CHART_DIRECTORY = CldrUtility.getPath(STAGING_DIRECTORY + "docs/charts/", ToolConstants.CHART_VERSION);
68     public static final String VERIFY_DIR = CLDRPaths.CHART_DIRECTORY + "verify/";
69 
70     public static final String APPS_EMOJI_DIRECTORY = CLDRPaths.BASE_DIRECTORY + "/tools/cldr-apps/src/main/webapp/images/emoji";
71 
72     /** Maintained in SVN */
73 
74     public static final String AUX_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR", "cldr-aux/"));
75 
76     /** Local files, not backed up on either Github or SVN **/
77 
78     public static final String LOCAL_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("LOCAL_DIR", BASE_DIRECTORY + "/../"));
79 
80     public static final String ARCHIVE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("ARCHIVE",
81         CldrUtility.getPath(LOCAL_DIRECTORY, "cldr-archive/")));
82     public static final String LAST_RELEASE_DIRECTORY = ARCHIVE_DIRECTORY + "cldr-" + ToolConstants.LAST_RELEASE_VERSION_WITH0 + "/";
83     public static final String LAST_COMMON_DIRECTORY = CldrUtility.getPath(LAST_RELEASE_DIRECTORY, "common/");
84     public static final String LAST_TRANSFORMS_DIRECTORY = CldrUtility.getPath(CLDRPaths.LAST_COMMON_DIRECTORY, TRANSFORMS_SUBDIR);
85 
86     public static final String GEN_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_GEN_DIR",
87         CldrUtility.getPath(LOCAL_DIRECTORY, "Generated/cldr/")));
88     public static final String DATA_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_EXT_DATA_DIR",
89         CldrUtility.getPath(LOCAL_DIRECTORY, "Data/")));
90 
91     // probably can be removed & replaced
92     public static final String CLDR_PRIVATE_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_PRIVATE_DATA",
93         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-private/")));
94     public static final String TMP_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
95         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp/")));
96     public static final String TMP2_DIRECTORY = CldrUtility.getPath(CldrUtility.getProperty("CLDR_TMP_DIR",
97         CldrUtility.getPath(LOCAL_DIRECTORY, "../cldr-tmp2/")));
98 
99     /**
100      * @deprecated please use XMLFile and CLDRFILE getSupplementalDirectory()
101      * @see DEFAULT_SUPPLEMENTAL_DIRECTORY
102      */
103     @Deprecated
104     public static final String SUPPLEMENTAL_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, "supplemental/");
105     /**
106      * Only the default, if no other directory is specified.
107      */
108     public static final String DEFAULT_SUPPLEMENTAL_DIRECTORY = CldrUtility.getPath(COMMON_DIRECTORY, "supplemental/");
109     public static final String LOG_DIRECTORY = CldrUtility.getPath(TMP_DIRECTORY, "logs/");
110     public static final String TEST_DIR = CldrUtility.getPath(CLDRPaths.TMP_DIRECTORY, "test/");
111 
112     /** If the generated BAT files are to work, this needs to be set right */
113     public static final String COMPARE_PROGRAM = "\"C:\\Program Files (x86)\\Compare It!\\wincmp3.exe\"";
114 
115     /**
116      * @deprecated Don't use this from any code that is run from the .JAR (SurveyTool, tests, etc).
117      *             If it must be used, add a comment next to the usage to explain why it is needed.
118      */
119     @Deprecated
120     public static final String UTIL_DATA_DIR = FileReaders.getRelativeFileName(CldrUtility.class, "data/");
121 
122     public enum DIRECTORIES {
123         common_dtd, common_properties, common_uca,
124 
125         common_bcp47(DtdType.ldmlBCP47),
126 
127         common_annotations(DtdType.ldml), common_casing(DtdType.ldml), common_collation(DtdType.ldml), common_main(DtdType.ldml), common_rbnf(
128             DtdType.ldml), common_segments(DtdType.ldml), common_subdivisions(DtdType.ldml),
129 
130         common_supplemental(DtdType.supplementalData), common_transforms(DtdType.supplementalData), common_validity(DtdType.supplementalData),
131 
132         keyboards_android(DtdType.keyboard, DtdType.platform), keyboards_chromeos(DtdType.keyboard, DtdType.platform), keyboards_dtd(DtdType.keyboard,
133             DtdType.platform), keyboards_osx(DtdType.keyboard,
134                 DtdType.platform), keyboards_und(DtdType.keyboard, DtdType.platform), keyboards_windows(DtdType.keyboard, DtdType.platform),
135                 ;
136 
137         public final List<DtdType> dtdType;
138 
DIRECTORIES(DtdType... dtdType)139         private DIRECTORIES(DtdType... dtdType) {
140             this.dtdType = ImmutableList.copyOf(dtdType);
141         }
142     }
143 }
144