ICU-20472 Moving index res file request to tree category.

- Includes other minor cleanup of buildtool.
This commit is contained in:
Shane Carr 2019-03-06 14:33:17 -08:00 committed by Shane F. Carr
parent e559b30309
commit 852b63dd9f
3 changed files with 18 additions and 6 deletions

View File

@ -432,7 +432,7 @@ def generate_translit(config, glob, common_vars):
]
dep_files = set(InFile(filename) for filename in glob("translit/*.txt"))
dep_files -= set(input_files)
dep_files = list(dep_files)
dep_files = list(sorted(dep_files))
input_basenames = [v.filename[9:] for v in input_files]
output_files = [
OutFile("translit/%s.res" % v[:-4])
@ -554,9 +554,10 @@ def generate_tree(
IN_SUB_DIR = sub_dir,
**common_vars
))
index_file_target_name = "%s_index_txt" % sub_dir
requests += [
IndexTxtRequest(
name = "%s_index_txt" % sub_dir,
name = index_file_target_name,
category = category,
input_files = index_input_files,
output_file = index_file_txt,
@ -572,9 +573,9 @@ def generate_tree(
requests += [
SingleExecutionRequest(
name = "%s_index_res" % sub_dir,
category = "%s_index" % sub_dir,
dep_targets = [],
input_files = [index_file_txt],
category = category,
dep_targets = [DepTarget(index_file_target_name)],
input_files = [],
output_files = [index_res_file],
tool = IcuTool("genrb"),
args = "-s {TMP_DIR}/{IN_SUB_DIR} -d {OUT_DIR}/{OUT_PREFIX} -i {OUT_DIR} "

View File

@ -281,8 +281,10 @@ class ResourceFilterInfo(object):
continue
if request.tool != IcuTool("genrb"):
continue
if not request.input_files:
continue
self._set_files(request.input_files)
request.dep_targets += [self.filter_files]
request.dep_targets += [self.filter_files[:]]
arg_str = "--filterDir {TMP_DIR}/%s" % self.filter_tmp_dir
request.args = "%s %s" % (arg_str, request.args)

View File

@ -41,6 +41,10 @@ class AbstractRequest(object):
raise ValueError("Unknown argument: %s" % key)
def apply_file_filter(self, filter):
"""
Returns True if this request still has input files after filtering,
or False if the request is "empty" after filtering.
"""
return True
def flatten(self, config, all_requests, common_vars):
@ -104,6 +108,11 @@ class AbstractExecutionRequest(AbstractRequest):
del self.input_files[i]
for _, v in self.format_with.items():
if isinstance(v, list):
assert len(v) == len(self.input_files) + 1
del v[i]
for v in self.dep_targets:
if isinstance(v, list):
assert len(v) == len(self.input_files) + 1
del v[i]
def flatten(self, config, all_requests, common_vars):