]> granicus.if.org Git - icu/commitdiff
ICU-20529 Generate res_index on partial resource trees.
authorShane F. Carr <shane.carr@wustl.edu>
Fri, 29 Mar 2019 15:55:58 +0000 (11:55 -0400)
committerShane F. Carr <shane@unicode.org>
Mon, 6 May 2019 23:04:36 +0000 (16:04 -0700)
icu4c/source/data/BUILDRULES.py
icu4c/source/data/buildtool/request_types.py

index 696c7b8c30c4f03838effd3130480db1182dbe3d..2442f4e3ff61084b352ddd0a778a23141de25128 100644 (file)
@@ -516,7 +516,7 @@ def generate_tree(
         )
     ]
 
-    # Generate index txt file
+    # Generate res_index file
     synthetic_locales = set()
     deprecates_xml_path = os.path.join(os.path.dirname(__file__), xml_filename)
     deprecates_xml = ET.parse(deprecates_xml_path)
@@ -540,30 +540,19 @@ def generate_tree(
         IN_SUB_DIR = sub_dir,
         **common_vars
     ))
-    index_file_target_name = "%s_index_txt" % sub_dir
-    requests += [
-        IndexTxtRequest(
-            name = index_file_target_name,
-            category = category,
-            input_files = index_input_files,
-            output_file = index_file_txt,
-            cldr_version = cldr_version
-        )
-    ]
-
-    # Generate index res file
     index_res_file = OutFile("{OUT_PREFIX}{INDEX_NAME}.res".format(
         OUT_PREFIX = out_prefix,
         **common_vars
     ))
+    index_file_target_name = "%s_index_txt" % sub_dir
     requests += [
-        SingleExecutionRequest(
-            name = "%s_index_res" % sub_dir,
+        IndexRequest(
+            name = index_file_target_name,
             category = category,
-            dep_targets = [DepTarget(index_file_target_name)],
-            input_files = [],
-            output_files = [index_res_file],
-            tool = IcuTool("genrb"),
+            input_files = index_input_files,
+            txt_file = index_file_txt,
+            output_file = index_res_file,
+            cldr_version = cldr_version,
             args = "-s {TMP_DIR}/{IN_SUB_DIR} -d {OUT_DIR}/{OUT_PREFIX} -i {OUT_DIR} "
                 "-k "
                 "{INDEX_NAME}.txt",
index 0de028513ed6ef45f377da671bf53db4384fd62a..72b3991fbae2093e2946194d19e3e65aa84a39c9 100644 (file)
@@ -284,12 +284,15 @@ class ListRequest(AbstractRequest):
         return [self.output_file]
 
 
-class IndexTxtRequest(AbstractRequest):
+class IndexRequest(AbstractRequest):
     def __init__(self, **kwargs):
         self.input_files = []
+        self.txt_file = None
         self.output_file = None
         self.cldr_version = ""
-        super(IndexTxtRequest, self).__init__(**kwargs)
+        self.args = ""
+        self.format_with = {}
+        super(IndexRequest, self).__init__(**kwargs)
 
     def apply_file_filter(self, filter):
         i = 0
@@ -301,11 +304,22 @@ class IndexTxtRequest(AbstractRequest):
         return i > 0
 
     def flatten(self, config, all_requests, common_vars):
-        return PrintFileRequest(
-            name = self.name,
-            output_file = self.output_file,
-            content = self._generate_index_file(common_vars)
-        ).flatten(config, all_requests, common_vars)
+        return (
+            PrintFileRequest(
+                name = self.name,
+                output_file = self.txt_file,
+                content = self._generate_index_file(common_vars)
+            ).flatten(config, all_requests, common_vars) +
+            SingleExecutionRequest(
+                name = "%s_res" % self.name,
+                category = self.category,
+                input_files = [self.txt_file],
+                output_files = [self.output_file],
+                tool = IcuTool("genrb"),
+                args = self.args,
+                format_with = self.format_with
+            ).flatten(config, all_requests, common_vars)
+        )
 
     def _generate_index_file(self, common_vars):
         locales = [f.filename[f.filename.rfind("/")+1:-4] for f in self.input_files]