| Index: gn_data_build_system/BUILD.gn | 
| diff --git a/gn_data_build_system/BUILD.gn b/gn_data_build_system/BUILD.gn | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..ee0c2f196a01d80ac34e21c282ab099a7f349b80 | 
| --- /dev/null | 
| +++ b/gn_data_build_system/BUILD.gn | 
| @@ -0,0 +1,966 @@ | 
| +# Copyright (c) 2015 The Chromium Authors. All rights reserved. | 
| + | 
| +ICU_VER = 54 | 
| +icu_gen_dir = "$target_gen_dir/icudt${ICU_VER}l" | 
| +icu_gen_tmp_dir = "$target_gen_dir/tmp_icudt${ICU_VER}l" | 
| + | 
| +vars = exec_script("//build/gypi_to_gn.py", | 
| +                            [ | 
| +                                rebase_path("../icu_data.gypi"), | 
| +                                "--replace=<(icu_gen_dir)=$icu_gen_dir", | 
| +                                "--replace=<(icu_gen_tmp_dir)=$icu_gen_tmp_dir", | 
| +                            ], | 
| +                            "scope", | 
| +                            [ "../icu_data.gypi" ]) | 
| + | 
| +genrb_exe = rebase_path(get_label_info("../gn_tool_build_system:genrb", | 
| +                                       "root_out_dir") + "/genrb") | 
| + | 
| +gencnval_exe = rebase_path(get_label_info("../gn_tool_build_system:gencnval", | 
| +                                          "root_out_dir") + "/gencnval") | 
| + | 
| +icupkg_exe = rebase_path(get_label_info("../gn_tool_build_system:icupkg", | 
| +                                        "root_out_dir") + "/icupkg") | 
| + | 
| +makeconv_exe = rebase_path(get_label_info("../gn_tool_build_system:makeconv", | 
| +                                          "root_out_dir") + "/makeconv") | 
| + | 
| +gendict_exe = rebase_path(get_label_info("../gn_tool_build_system:gendict", | 
| +                                         "root_out_dir") + "/gendict") | 
| + | 
| +genbrk_exe = rebase_path(get_label_info("../gn_tool_build_system:genbrk", | 
| +                                        "root_out_dir") + "/genbrk") | 
| + | 
| +gencfu_exe = rebase_path(get_label_info("../gn_tool_build_system:gencfu", | 
| +                                        "root_out_dir") + "/gencfu") | 
| + | 
| +pkgdata_exe = rebase_path(get_label_info("../gn_tool_build_system:pkgdata", | 
| +                                         "root_out_dir") + "/pkgdata") | 
| + | 
| + | 
| +local_icu_data_curr_res_raw_sources = vars.icu_data_curr_res_raw_sources | 
| +local_icu_data_region_res_sources = vars.icu_data_region_res_sources | 
| +local_icu_data_region_res_alias_sources = vars.icu_data_region_res_alias_sources | 
| + | 
| +icu_data_generated_contents = ([ ] + | 
| +            # Coll | 
| +            vars.icu_data_coll_res_root_generated + | 
| +            vars.icu_data_coll_res_generated + | 
| +            vars.icu_data_coll_res_alias_generated + | 
| +            ["$icu_gen_dir/coll/res_index.res"] + | 
| +            # Brk_brk | 
| +            vars.icu_data_brkitr_brk_generated + | 
| +            # Brk_res | 
| +            vars.icu_data_brkitr_res_root_generated + | 
| +            vars.icu_data_brkitr_res_generated + | 
| +            ["$icu_gen_dir/brkitr/res_index.res"] + | 
| +            # Brk_dict | 
| +            ["$icu_gen_dir/brkitr/burmesedict.dict"] + | 
| +            ["$icu_gen_dir/brkitr/cjdict.dict"] + | 
| +            ["$icu_gen_dir/brkitr/khmerdict.dict"] + | 
| +            ["$icu_gen_dir/brkitr/laodict.dict"] + | 
| +            ["$icu_gen_dir/brkitr/thaidict.dict"] + | 
| +            # Locales | 
| +            vars.icu_data_locales_res_root_generated + | 
| +            vars.icu_data_locales_res_generated + | 
| +            # Misc + end of Locales | 
| +            vars.icu_data_locales_res_alias_generated + | 
| +            vars.icu_data_misc_res_generated + | 
| +            ["$icu_gen_dir/res_index.res"] + | 
| +            ["$icu_gen_dir/pool.res"] + | 
| +            # Lang | 
| +            vars.icu_data_lang_res_root_generated + | 
| +            vars.icu_data_lang_res_generated + | 
| +            vars.icu_data_lang_res_alias_generated + | 
| +            ["$icu_gen_dir/lang/res_index.res"] + | 
| +            ["$icu_gen_dir/lang/pool.res"] + | 
| +            # Region | 
| +            vars.icu_data_region_res_root_generated + | 
| +            vars.icu_data_region_res_generated + | 
| +            vars.icu_data_region_res_alias_generated + | 
| +            ["$icu_gen_dir/region/res_index.res"] + | 
| +            ["$icu_gen_dir/region/pool.res"] + | 
| +            # Zone | 
| +            vars.icu_data_zone_res_root_generated + | 
| +            vars.icu_data_zone_res_generated + | 
| +            vars.icu_data_zone_res_alias_generated + | 
| +            vars.icu_data_zone_res_extra_generated + | 
| +            ["$icu_gen_dir/zone/res_index.res"] + | 
| +            ["$icu_gen_dir/zone/pool.res"] + | 
| +            # Unit | 
| +            vars.icu_data_unit_res_root_generated + | 
| +            vars.icu_data_unit_res_generated + | 
| +            vars.icu_data_unit_res_alias_generated + | 
| +            ["$icu_gen_dir/unit/res_index.res"] + | 
| +            ["$icu_gen_dir/unit/pool.res"] + | 
| +            # Random data | 
| +            ["$icu_gen_dir/cnvalias.icu"] + | 
| +            ["$icu_gen_dir/coll/ucadata.icu"] + | 
| +            ["$icu_gen_dir/nfkc.nrm"] + | 
| +            ["$icu_gen_dir/nfkc_cf.nrm"] + | 
| +            ["$icu_gen_dir/uts46.nrm"] + | 
| + | 
| +            # converters | 
| +            vars.icu_data_ucm_generated + | 
| + | 
| +            # Currency | 
| +            vars.icu_data_curr_res_root_generated + | 
| +            vars.icu_data_curr_res_supplemental_generated + | 
| +            vars.icu_data_curr_res_generated + | 
| +            vars.icu_data_curr_res_alias_generated + | 
| +            ["$icu_gen_dir/curr/res_index.res"] + | 
| +            ["$icu_gen_dir/curr/pool.res"] + | 
| + | 
| +            # RBNF | 
| +            ["$icu_gen_dir/rbnf/res_index.res"] + | 
| + | 
| +            # Translit (note css3transform.txt -> root.txt) | 
| +            ["$icu_gen_dir/translit/root.res"] + | 
| + | 
| +            # Confusables | 
| +            ["$icu_gen_dir/confusables.cfu"] | 
| +        ) | 
| + | 
| +put_icu_data_on_diet = target_os == "android" | 
| + | 
| +languages_to_minimize = "bn,et,gu,kn,ml,mr,ms,ta,te" # Move to gypi? | 
| + | 
| +if (put_icu_data_on_diet) { | 
| +    icu_data_generated_contents += [ | 
| +        # Workaround items for not having cjdict.dict | 
| +        "$icu_gen_dir/brkitr/word_ja.brk", | 
| +        "$icu_gen_dir/brkitr/ja.res", | 
| +    ] | 
| +    icu_data_generated_contents -= ( | 
| +        # Region data is fetched from the Android API on Android. | 
| +        vars.icu_data_region_res_root_generated + | 
| +        vars.icu_data_region_res_generated + | 
| +        vars.icu_data_region_res_alias_generated + | 
| + | 
| +        [ | 
| +            # Languages from 'languages_to_minimize' above. | 
| +            "$icu_gen_dir/curr/bn.res", | 
| +            "$icu_gen_dir/curr/et.res", | 
| +            "$icu_gen_dir/curr/gu.res", | 
| +            "$icu_gen_dir/curr/kn.res", | 
| +            "$icu_gen_dir/curr/ml.res", | 
| +            "$icu_gen_dir/curr/mr.res", | 
| +            "$icu_gen_dir/curr/ms.res", | 
| +            "$icu_gen_dir/curr/ta.res", | 
| +            "$icu_gen_dir/curr/te.res", | 
| + | 
| +            # Too big to include. | 
| +            "$icu_gen_dir/brkitr/cjdict.dict", | 
| +        ] | 
| +    ) | 
| +    # Remove from raw_sources since raw_sources is used when building | 
| +    # res_index.txt. | 
| +    local_icu_data_curr_res_raw_sources -= [ | 
| +        # Languages from 'languages_to_minimize' above. | 
| +        "source/data/curr/bn.txt", | 
| +        "source/data/curr/et.txt", | 
| +        "source/data/curr/gu.txt", | 
| +        "source/data/curr/kn.txt", | 
| +        "source/data/curr/ml.txt", | 
| +        "source/data/curr/mr.txt", | 
| +        "source/data/curr/ms.txt", | 
| +        "source/data/curr/ta.txt", | 
| +        "source/data/curr/te.txt", | 
| +    ] | 
| +    local_icu_data_region_res_sources = [] | 
| +    local_icu_data_region_res_alias_sources = [] | 
| +} else { | 
| +    # Workaround files listed in case cjdict.dict is missing. Not needed | 
| +    # since we'll include cjdict.dict. | 
| +    icu_data_generated_contents -= [ | 
| +        "$icu_gen_dir/brkitr/word_ja.brk", | 
| +        "$icu_gen_dir/brkitr/ja.res", | 
| +    ] | 
| +} | 
| + | 
| +icu_resource_files_file = "$icu_gen_tmp_dir/icu_data_resource_list.tmp" | 
| +write_file(icu_resource_files_file, icu_data_generated_contents) | 
| + | 
| +group("icu_cnv_base_files") { | 
| +    deps = [ | 
| +        ":icu_cnvalias", | 
| +        ":icu_icupkg_nrm", | 
| +        ":icu_ucadata_icu", | 
| +    ] | 
| +} | 
| + | 
| +action_foreach("icu_icupkg_nrm") { | 
| +    script = "run.py" | 
| +    sources = rebase_path(vars.icu_data_nrm_sources, | 
| +                          ".", | 
| +                          "..") | 
| +    inputs = [ | 
| +        icupkg_exe, | 
| +    ] | 
| +    outputs = [ | 
| +        "$icu_gen_dir/{{source_file_part}}", | 
| +    ] | 
| +    args = [ | 
| +        icupkg_exe, | 
| +        "-tl", | 
| +        "{{source}}", | 
| +        rebase_path("$icu_gen_dir/{{source_file_part}}"), | 
| +    ] | 
| +} | 
| + | 
| +action("icu_cnvalias") { | 
| +    script = "run.py" | 
| +    inputs = [ | 
| +        gencnval_exe, | 
| +        "../source/data/mappings/convrtrs.txt", | 
| +    ] | 
| +    outputs = [ | 
| +        "$icu_gen_dir/cnvalias.icu", | 
| +    ] | 
| + | 
| +    args = [ | 
| +        gencnval_exe, | 
| +        "-d", | 
| +        rebase_path(icu_gen_dir), | 
| +        rebase_path("../source/data/mappings/convrtrs.txt"), | 
| +    ] | 
| +} | 
| + | 
| +action("icu_ucadata_icu") { | 
| +    script = "run.py" | 
| +    inputs = [ | 
| +        icupkg_exe, | 
| +        "../source/data/in/coll/ucadata-implicithan.icu", | 
| +    ] | 
| +     outputs = [ | 
| +         "$icu_gen_dir/coll/ucadata.icu", | 
| +     ] | 
| + | 
| +    args = [ | 
| +        icupkg_exe, | 
| +        "-tl", | 
| +        rebase_path("../source/data/in/coll/ucadata-implicithan.icu"), | 
| +        rebase_path("$icu_gen_dir/coll/ucadata.icu"), | 
| +    ] | 
| +} | 
| + | 
| +action_foreach("icu_cnv_ucm_files") { | 
| +    script = "run.py" | 
| +    sources = rebase_path(vars.icu_data_ucm_sources, | 
| +                          ".", | 
| +                          "..") | 
| +    inputs = [ | 
| +        makeconv_exe, | 
| +    ] | 
| +    outputs = [ | 
| +        "$icu_gen_dir/{{source_name_part}}.cnv", | 
| +    ] | 
| +    args = [ | 
| +        makeconv_exe, | 
| +        "-c", | 
| +        "-d", | 
| +        rebase_path(icu_gen_dir), | 
| +        "{{source}}", | 
| +    ] | 
| +} | 
| + | 
| +action("icu_filtered_for_size_files") { | 
| +    script = "../build_tools/filter_data_for_size.py" | 
| +    inputs = ([ | 
| +        # Order here is important. See indexing below. | 
| +        "../source/data/brkitr/word.txt", | 
| +        "../source/data/brkitr/root.txt", | 
| +        "../source/data/brkitr/ja.txt", | 
| +        "../source/data/locales/pool.res", | 
| +        "../source/data/curr/pool.res", | 
| +        "../source/data/lang/pool.res", | 
| +        "../source/data/zone/pool.res", | 
| +    ] + | 
| +    rebase_path(local_icu_data_curr_res_raw_sources + | 
| +                vars.icu_data_curr_res_alias_raw_sources + | 
| +                vars.icu_data_curr_res_supplemental_raw_sources + | 
| +                vars.icu_data_locales_res_raw_sources + | 
| +                vars.icu_data_locales_res_alias_raw_sources + | 
| +                vars.icu_data_lang_res_raw_sources + | 
| +                vars.icu_data_lang_res_alias_raw_sources + | 
| +                vars.icu_data_zone_res_raw_sources + | 
| +                vars.icu_data_zone_res_alias_raw_sources, | 
| +                ".", | 
| +                "..") | 
| +          ) | 
| +    outputs = ([ | 
| +        # Order here is important. See indexing below. | 
| +        "$icu_gen_tmp_dir/brkitr/word.txt", | 
| +        "$icu_gen_tmp_dir/brkitr/root.txt", | 
| +        "$icu_gen_tmp_dir/brkitr/ja.txt", | 
| +        "$icu_gen_tmp_dir/locales/pool.res", | 
| +        "$icu_gen_tmp_dir/curr/pool.res", | 
| +        "$icu_gen_tmp_dir/lang/pool.res", | 
| +        "$icu_gen_tmp_dir/zone/pool.res", | 
| +    ] + | 
| +               vars.icu_data_curr_res_filtered_sources + | 
| +               vars.icu_data_curr_res_alias_filtered_sources + | 
| +               vars.icu_data_curr_res_supplemental_filtered_sources + | 
| +               vars.icu_data_locales_res_filtered_sources + | 
| +               vars.icu_data_locales_res_alias_filtered_sources + | 
| +               vars.icu_data_lang_res_filtered_sources + | 
| +               vars.icu_data_lang_res_alias_filtered_sources + | 
| +               vars.icu_data_zone_res_filtered_sources + | 
| +               vars.icu_data_zone_res_alias_filtered_sources | 
| +           ) | 
| + | 
| +    # To go from inputs to outputs in gn: | 
| +    # outputs = rebase_path(rebase_path(inputs, "../source/data"), | 
| +    #                       ".", icu_gen_tmp_dir) | 
| +    # But then we would diverge from icu_data.gyp and might not catch | 
| +    # errors in the vars above (that would not be needed if we only had gn). | 
| +    computed_outputs = rebase_path(rebase_path(inputs, "../source/data"), | 
| +                                   ".", icu_gen_tmp_dir) | 
| +    assert(rebase_path(computed_outputs) == rebase_path(outputs)) | 
| + | 
| +    if (put_icu_data_on_diet) { | 
| +        filter_mode = "strip-for-size" | 
| +    } else { | 
| +        filter_mode = "clean-copy" | 
| +    } | 
| +    args = [ | 
| +        "--mode", | 
| +        filter_mode, | 
| +        "--in-word-txt", | 
| +        rebase_path(inputs[0]), | 
| +        "--out-word-txt", | 
| +        rebase_path(outputs[0]), | 
| +        "--in-brkitr-root-txt", | 
| +        rebase_path(inputs[1]), | 
| +        "--out-brkitr-root-txt", | 
| +        rebase_path(outputs[1]), | 
| +        "--in-brkitr-ja-txt", | 
| +        rebase_path(inputs[2]), | 
| +        "--out-brkitr-ja-txt", | 
| +        rebase_path(outputs[2]), | 
| +        "--currency-keep-list", | 
| +        rebase_path("../android/currencies.list"), | 
| +        "--in-curr-dir", | 
| +        rebase_path("../source/data/curr"), | 
| +        "--out-curr-dir", | 
| +        rebase_path("$icu_gen_tmp_dir/curr"), | 
| +        "--minimize-language-list", | 
| +        languages_to_minimize, | 
| +        "--in-locales-dir", | 
| +        rebase_path("../source/data/locales"), | 
| +        "--out-locales-dir", | 
| +        rebase_path("$icu_gen_tmp_dir/locales"), | 
| +        "--in-lang-dir", | 
| +        rebase_path("../source/data/lang"), | 
| +        "--out-lang-dir", | 
| +        rebase_path("$icu_gen_tmp_dir/lang"), | 
| +        "--in-zone-dir", | 
| +        rebase_path("../source/data/zone"), | 
| +        "--out-zone-dir", | 
| +        rebase_path("$icu_gen_tmp_dir/zone"), | 
| +        "--remove-data-already-existing-in-android", | 
| +    ] | 
| +} | 
| + | 
| +dicts_with_transform = [ | 
| +    ["burmesedict", "0x1000"], | 
| +    ["khmerdict", "0x1780"], | 
| +    ["thaidict", "0xe00"], | 
| +    ["laodict", "0xe80"], | 
| +] | 
| + | 
| +if (!put_icu_data_on_diet) { | 
| +    dicts_with_transform += [["cjdict", ""]] | 
| +} | 
| + | 
| +foreach(dict_with_transform, dicts_with_transform) { | 
| +    dict_to_compile = dict_with_transform[0] | 
| +    dict_transform_offset = dict_with_transform[1] | 
| + | 
| +    action("icu_dict_" + dict_to_compile) { | 
| +        script = "run.py" | 
| +        inputs = [ | 
| +            gendict_exe, | 
| +            "../source/data/brkitr/$dict_to_compile.txt", | 
| +        ] | 
| +        outputs = [ | 
| +            "$icu_gen_dir/brkitr/$dict_to_compile.dict", | 
| +        ] | 
| + | 
| +        if (dict_transform_offset == "") { | 
| +            target_args = ["--uchars"] | 
| +        } else { | 
| +            target_args = [ | 
| +                "--bytes", | 
| +                "--transform", | 
| +                "offset-$dict_transform_offset", | 
| +            ] | 
| +        } | 
| +        args = [ | 
| +            gendict_exe, | 
| +            ] + target_args + [ | 
| +            "-c", | 
| +            "-i", | 
| +            rebase_path(icu_gen_dir), | 
| +            rebase_path(inputs[1]), | 
| +            rebase_path(outputs[0]), | 
| +        ] | 
| +    } | 
| +} | 
| + | 
| +action_foreach("icu_brk_files") { | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +        ":icu_filtered_for_size_files", | 
| +    ] | 
| +    inputs = [ | 
| +        genbrk_exe, | 
| +    ] | 
| +    sources = rebase_path(vars.icu_data_brkitr_brk_sources, | 
| +                          ".", | 
| +                          "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/brkitr/{{source_name_part}}.brk" ] | 
| +    args = [ | 
| +        genbrk_exe, | 
| +        "-c", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-r", | 
| +        "{{source}}", | 
| +        "-o", | 
| +        rebase_path("$icu_gen_dir/brkitr/{{source_name_part}}.brk"), | 
| +    ] | 
| +} | 
| + | 
| +action_foreach("icu_locales_res_files") { | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +        ":icu_filtered_for_size_files", | 
| +    ] | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +        "$icu_gen_tmp_dir/locales/pool.res", | 
| +    ] | 
| +    sources = rebase_path(vars.icu_data_locales_res_root_sources + | 
| +                          vars.icu_data_locales_res_filtered_sources + | 
| +                          vars.icu_data_locales_res_alias_filtered_sources, | 
| +                          ".", | 
| +                          "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/{{source_name_part}}.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "--usePoolBundle", | 
| +        "-k", | 
| +        "-R", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path(icu_gen_tmp_dir + "/locales"), | 
| +        "-d", | 
| +        rebase_path(icu_gen_dir), | 
| +        "{{source_file_part}}", | 
| +    ] | 
| +} | 
| + | 
| +action_foreach("icu_misc_res_files") { | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +    ] | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +    ] | 
| +    sources = rebase_path(vars.icu_data_misc_res_sources, | 
| +                          ".", | 
| +                          "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/{{source_name_part}}.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "-k", | 
| +        "-R", | 
| +        "-q", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path("../source/data/misc"), | 
| +        "-d", | 
| +        rebase_path(icu_gen_dir), | 
| +        "{{source_file_part}}", | 
| +    ] | 
| +} | 
| + | 
| +res_indexes = [ | 
| +    # In-dir, out-dir, uses-pool, source-name-list. | 
| +    ["locales", "", true, vars.icu_data_locales_res_raw_sources], | 
| +    ["curr", "/curr", true, local_icu_data_curr_res_raw_sources], | 
| +    ["lang", "/lang", true, vars.icu_data_lang_res_raw_sources], | 
| +    ["region", "/region", true, local_icu_data_region_res_sources], | 
| +    ["zone", "/zone", true, vars.icu_data_zone_res_raw_sources], | 
| +    ["unit", "/unit", true, vars.icu_data_unit_res_sources], | 
| +    ["coll", "/coll", false, vars.icu_data_coll_res_sources], | 
| +    ["brkitr", "/brkitr", false, vars.icu_data_brkitr_res_sources + | 
| +                           vars.icu_data_brkitr_res_filtered_sources], | 
| +    ["rbnf", "/rbnf", false, []], | 
| +] | 
| + | 
| +foreach(res_index, res_indexes) { | 
| +    res_index_dir = res_index[0] | 
| +    res_index_output_dir = res_index[1] | 
| +    res_index_uses_pool = res_index[2] | 
| +    res_index_sources = [] # Or we will fail to overwrite the value | 
| +                           # from the last iteration. | 
| +    res_index_sources = res_index[3] | 
| + | 
| +    action("icu_write_${res_index_dir}_res_index_txt") { | 
| +        script = "../build_tools/write_res_index.py" | 
| +        inputs = [ | 
| +            # Only using file names, not file contents of source files. | 
| +        ] | 
| +        outputs = [ | 
| +            icu_gen_tmp_dir + res_index_output_dir + "/res_index.txt", | 
| +        ] | 
| +        args = [] | 
| +        if (res_index_dir == "locales") { | 
| +            args += [ | 
| +                "--cldr-version", | 
| +                "1.9", # FIXME: Move somewhere | 
| +            ] | 
| +        } | 
| + | 
| +        args += [ | 
| +            "--outfile", | 
| +            rebase_path(outputs[0]), | 
| +        ] | 
| +        args += rebase_path(res_index_sources, | 
| +                            ".", | 
| +                            "..") | 
| +    } | 
| + | 
| +    action("icu_${res_index_dir}_res_index_res_file") { | 
| +        script = "run.py" | 
| +        deps = [ | 
| +            ":icu_write_${res_index_dir}_res_index_txt" | 
| +            # Simple resources, do not need anything from icu_cnv_base_files. | 
| +            # ":icu_cnv_base_files", | 
| +        ] | 
| +        inputs = [ | 
| +            genrb_exe, | 
| +            icu_gen_tmp_dir + res_index_output_dir + "/res_index.txt", | 
| +        ] | 
| +        outputs = [ | 
| +            icu_gen_dir + res_index_output_dir + "/res_index.res", | 
| +        ] | 
| +        args = [ | 
| +            genrb_exe, | 
| +            "--quiet",  # Chromium addition to silence warnings. | 
| +            "-k", | 
| +            "-R", | 
| +            "-i", | 
| +            rebase_path(icu_gen_dir), | 
| +            "-d", | 
| +            rebase_path(icu_gen_dir + res_index_output_dir), | 
| +            rebase_path(inputs[1]), | 
| +        ] | 
| +    } | 
| + | 
| +    if (res_index_uses_pool) { | 
| +        action("icu_${res_index_dir}_pool_res") { | 
| +            script = "run.py" | 
| +            inputs = [ | 
| +                icupkg_exe, | 
| +                "../source/data/$res_index_dir/pool.res", | 
| +            ] | 
| +            outputs = [ | 
| +                icu_gen_dir + res_index_output_dir + "/pool.res", | 
| +            ] | 
| +            args = [ | 
| +                icupkg_exe, | 
| +                "-tl", | 
| +                rebase_path(inputs[1]), | 
| +                rebase_path(outputs[0]), | 
| +            ] | 
| +        } | 
| +    } | 
| +} | 
| + | 
| +res_chunks = [ | 
| +    # Dir, source_files, is_filtered. | 
| +    ["curr", vars.icu_data_curr_res_root_sources + | 
| +             vars.icu_data_curr_res_supplemental_filtered_sources + | 
| +             vars.icu_data_curr_res_filtered_sources + | 
| +             vars.icu_data_curr_res_alias_filtered_sources, true], | 
| +    ["lang", vars.icu_data_lang_res_root_sources + | 
| +             vars.icu_data_lang_res_filtered_sources + | 
| +             vars.icu_data_lang_res_alias_filtered_sources, true], | 
| +    ["region", vars.icu_data_region_res_root_sources + | 
| +               local_icu_data_region_res_sources + | 
| +               local_icu_data_region_res_alias_sources, false], | 
| +    ["zone", vars.icu_data_zone_res_root_sources + | 
| +             vars.icu_data_zone_res_filtered_sources + | 
| +             vars.icu_data_zone_res_alias_filtered_sources + | 
| +             vars.icu_data_zone_res_extra_sources, true], | 
| +    ["unit", vars.icu_data_unit_res_root_sources + | 
| +             vars.icu_data_unit_res_sources + | 
| +             vars.icu_data_unit_res_alias_sources, false], | 
| +] | 
| + | 
| +foreach(res_chunk, res_chunks) { | 
| +    chunk_dir = res_chunk[0] | 
| +    files = [] | 
| +    files = res_chunk[1] | 
| +    is_filtered = res_chunk[2] | 
| + | 
| +    if (is_filtered) { | 
| +        source_dir = icu_gen_tmp_dir | 
| +    } else { | 
| +        source_dir = "../source/data" | 
| +    } | 
| + | 
| +    action_foreach("icu_${chunk_dir}_res_files") { | 
| +        script = "run.py" | 
| +        deps = [ | 
| +            ":icu_cnv_base_files", | 
| +            ":icu_filtered_for_size_files", # Some have this. Keep it simple. | 
| +        ] | 
| + | 
| +        inputs = [ | 
| +            genrb_exe, | 
| +            "$source_dir/$chunk_dir/pool.res", | 
| +        ] | 
| +        sources = rebase_path(files, | 
| +                          ".", | 
| +                          "..") | 
| + | 
| +        outputs = [ "$icu_gen_dir/$chunk_dir/{{source_name_part}}.res" ] | 
| +        args = [ | 
| +            genrb_exe, | 
| +            "--quiet",  # Chromium addition to silence warnings. | 
| +            "--usePoolBundle", | 
| +            "-k", | 
| +            "-R", | 
| +            "-i", | 
| +            rebase_path(icu_gen_dir), | 
| +            "-s", | 
| +            rebase_path("$source_dir/$chunk_dir"), | 
| +            "-d", | 
| +            rebase_path("$icu_gen_dir/$chunk_dir"), | 
| +            "{{source_file_part}}", | 
| +        ] | 
| +    } | 
| +} | 
| +# START COLL | 
| +action_foreach("icu_coll_res_files") { | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +        ":icu_misc_res_files", # Specifically keyTypeData for sr_Latn.txt | 
| +    ] | 
| +    section_dir = "coll" | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +        "$icu_gen_dir/keyTypeData.res", | 
| +    ] | 
| +    sources = rebase_path(vars.icu_data_coll_res_root_sources + | 
| +                          vars.icu_data_coll_res_sources + | 
| +                          vars.icu_data_coll_res_alias_sources, | 
| +                          ".", | 
| +                          "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "-k", | 
| +        "-R", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path("../source/data/$section_dir"), | 
| +        "-d", | 
| +        rebase_path("$icu_gen_dir/$section_dir"), | 
| +        "{{source_file_part}}", | 
| +    ] | 
| +} | 
| +# END COLL | 
| + | 
| +# START BRKITR | 
| +action_foreach("icu_brkitr_res_files") { | 
| +    # icu_brkitr_res_filtered_files is the same except that -s (source | 
| +    # dir) is icu_gen_tmp_dir in that action. | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +    ] | 
| +    section_dir = "brkitr" | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +        "$icu_gen_dir/brkitr/cjdict.dict", | 
| +        "$icu_gen_dir/brkitr/burmesedict.dict", | 
| +        "$icu_gen_dir/brkitr/khmerdict.dict", | 
| +        "$icu_gen_dir/brkitr/laodict.dict", | 
| +        "$icu_gen_dir/brkitr/thaidict.dict" | 
| +    ] + vars.icu_data_brkitr_brk_generated | 
| + | 
| +    if (put_icu_data_on_diet) { | 
| +        inputs -= [ | 
| +            "$icu_gen_dir/brkitr/cjdict.dict", | 
| +        ] | 
| +    } | 
| + | 
| +    sources = rebase_path( | 
| +        vars.icu_data_brkitr_res_sources, | 
| +        ".", | 
| +        "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "-k", | 
| +        "-R", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path("../source/data/$section_dir"), | 
| +        "-d", | 
| +        rebase_path("$icu_gen_dir/$section_dir"), | 
| +        "{{source_file_part}}", | 
| +    ] | 
| +} | 
| + | 
| +action_foreach("icu_brkitr_res_filtered_files") { | 
| +    # Same as icu_brkitr_res_files except that -s (source dir) is | 
| +    # icu_gen_tmp_dir. | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +        ":icu_filtered_for_size_files", | 
| +    ] | 
| +    section_dir = "brkitr" | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +        "$icu_gen_dir/brkitr/cjdict.dict", | 
| +        "$icu_gen_dir/brkitr/burmesedict.dict", | 
| +        "$icu_gen_dir/brkitr/khmerdict.dict", | 
| +        "$icu_gen_dir/brkitr/laodict.dict", | 
| +        "$icu_gen_dir/brkitr/thaidict.dict" | 
| +    ] + vars.icu_data_brkitr_brk_generated | 
| + | 
| +    if (put_icu_data_on_diet) { | 
| +        inputs -= [ | 
| +            "$icu_gen_dir/brkitr/cjdict.dict", | 
| +        ] | 
| +    } | 
| + | 
| +    sources = rebase_path( | 
| +        vars.icu_data_brkitr_res_root_filtered_sources + | 
| +        vars.icu_data_brkitr_res_filtered_sources, | 
| +        ".", | 
| +        "..") | 
| + | 
| +    outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "-k", | 
| +        "-R", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path("$icu_gen_tmp_dir/$section_dir"), | 
| +        "-d", | 
| +        rebase_path("$icu_gen_dir/$section_dir"), | 
| +        "{{source_file_part}}", | 
| +    ] | 
| +} | 
| +# END BRKITR | 
| + | 
| +# START RBNF | 
| +# END RBNF | 
| + | 
| +# START TRANSLIT | 
| +action("icu_data_translit") { | 
| +    script = "run.py" | 
| +    deps = [ | 
| +        ":icu_cnv_base_files", | 
| +    ] | 
| +    section_dir = "translit" | 
| +    inputs = [ | 
| +        genrb_exe, | 
| +        "../source/data/$section_dir/css3transform.txt", | 
| +    ] | 
| +    outputs = [ "$icu_gen_dir/$section_dir/root.res" ] | 
| +    args = [ | 
| +        genrb_exe, | 
| +        "-k", | 
| +        "-R", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-s", | 
| +        rebase_path("../source/data/$section_dir"), | 
| +        "-d", | 
| +        rebase_path("$icu_gen_dir/$section_dir"), | 
| +        "css3transform.txt", | 
| +    ] | 
| +} | 
| +# END TRANSLIT | 
| + | 
| +# START CONFUSABLES | 
| +action("icu_data_confusables") { | 
| +    script = "run.py" | 
| +    inputs = [ | 
| +        gencfu_exe, | 
| +        "$icu_gen_dir/cnvalias.icu", | 
| +        "../source/data/unidata/confusables.txt", | 
| +        "../source/data/unidata/confusablesWholeScript.txt", | 
| +    ] | 
| +    outputs = [ | 
| +        "$icu_gen_dir/confusables.cfu", | 
| +    ] | 
| + | 
| +    args = [ | 
| +        gencfu_exe, | 
| +        "-c", | 
| +        "-i", | 
| +        rebase_path(icu_gen_dir), | 
| +        "-r", | 
| +        rebase_path("../source/data/unidata/confusables.txt"), | 
| +        "-w", | 
| +        rebase_path("../source/data/unidata/confusablesWholeScript.txt"), | 
| +        "-o", | 
| +        rebase_path(outputs[0]) | 
| +    ] | 
| +} | 
| +# END CONFUSABLES | 
| + | 
| +# START icudata.lst/icupkg.inc/icudtl.dat | 
| +action("icu_write_icudata_lst") { | 
| +    write_file(icu_resource_files_file, icu_data_generated_contents) | 
| +    script = "../build_tools/write_icudata_lst.py" | 
| +    inputs = [ | 
| +        icu_resource_files_file, | 
| +    ] | 
| +    outputs = [ | 
| +        "$icu_gen_tmp_dir/icudata.lst", | 
| +    ] | 
| + | 
| +    args = [ | 
| +        "--inroot", | 
| +        rebase_path(icu_gen_dir), | 
| +        "--infile", | 
| +        rebase_path(icu_resource_files_file), | 
| +        "--gn-root", | 
| +        rebase_path("//."), | 
| +        "--outfile", | 
| +        rebase_path(outputs[0]) | 
| +    ] | 
| +} | 
| + | 
| +action("icu_write_icupkg_inc") { | 
| +    script = "../build_tools/write_icupkg_inc.py" | 
| +    outputs = [ | 
| +        "$icu_gen_tmp_dir/icupkg.inc", | 
| +    ] | 
| + | 
| +    args = [ | 
| +        "--outfile", | 
| +        rebase_path(outputs[0]), | 
| +        "--ver", | 
| +        "$ICU_VER", | 
| +        "--icu-dir", | 
| +        rebase_path(".."), | 
| +    ] | 
| +} | 
| + | 
| +import("//third_party/icu/config.gni") | 
| + | 
| +action("icu_pkgdata") { | 
| +    script = "run.py" | 
| +    inputs = [ | 
| +        pkgdata_exe, | 
| +        "$icu_gen_tmp_dir/icudata.lst", | 
| +        "$icu_gen_tmp_dir/icupkg.inc", | 
| +        ] + icu_data_generated_contents | 
| + | 
| +    deps = ["../gn_tool_build_system:pkgdata"] | 
| + | 
| +    if (icu_use_data_file) { | 
| +        pkgdata_args = [ | 
| +            "-m", # Mode | 
| +            "common", | 
| +        ] | 
| +        outputs = [ | 
| +            "$icu_gen_tmp_dir/result/icudt${ICU_VER}l.dat", | 
| +        ] | 
| +    } else { | 
| +        pkgdata_args = [ | 
| +            "-m", # Mode | 
| +            "dll", | 
| +            "-e", # Entry point | 
| +            "icudt<(ICU_VER)", | 
| +            "-L", # Lib name | 
| +            "icudata", | 
| +            "-T<(icu_gen_tmp_dir)", | 
| +        ] | 
| + | 
| +        if (is_win) { | 
| +            outputs = [ | 
| +                "$icu_gen_dir/icudt${ICU_VER}l.dll", | 
| +            ] | 
| +        } else { | 
| +            pkgdata_args += [ | 
| +                "-O", | 
| +                "<(icu_gen_tmp_dir)/icupkg.inc", | 
| +            ] | 
| +            outputs = [ | 
| +                "$icu_gen_dir/libicudata.so.${ICU_VER}.1", | 
| +            ] | 
| +        } | 
| +    } | 
| +    args = [ | 
| +        pkgdata_exe, | 
| +        ] + pkgdata_args + [ | 
| +        "-q", # Quiet | 
| +        "-c", # Default copyright | 
| +        "-s", # Source | 
| +        rebase_path(icu_gen_dir), | 
| +        "-d", # Destination | 
| +        rebase_path(icu_gen_tmp_dir + "/result"), | 
| +        "-T", # Temporary directory | 
| +        rebase_path(icu_gen_tmp_dir), | 
| +        "-p", # Data name | 
| +        "icudt${ICU_VER}l", | 
| +        "-r", # Revision | 
| +        "${ICU_VER}.1", | 
| +        rebase_path("$icu_gen_tmp_dir/icudata.lst"), | 
| +    ] | 
| +} | 
| + | 
| +if (icu_use_data_file && is_ios) { | 
| +    # TODO(GYP): Support mac resource bundle shown below. | 
| +    # 'link_settings': { | 
| +    #   'mac_bundle_resources': [ | 
| +    #     "$icu_gen_tmp_dir/icudt${ICU_VER}l.dat", | 
| +    #   ], | 
| +    # } | 
| +} else if (icu_use_data_file || is_win) { | 
| +    copy("icu_data") { | 
| +        if (icu_use_data_file) { | 
| +            sources = [ "$icu_gen_tmp_dir/result/icudt${ICU_VER}l.dat", ] | 
| +            outputs = [ "$root_out_dir/icudtl.dat", ] | 
| +        } else { | 
| +            sources = [ "$icu_gen_dir/icud${ICU_VER}.dll", ] | 
| +            outputs = [ "$root_out_dir/icudt.dll", ] | 
| +        } | 
| +    } | 
| +} else { | 
| +    source_set("icu_data") { | 
| +        sources = [ | 
| +            "$icu_gen_tmp_dir/icudt${ICU_VER}l_dat.S", | 
| +        ] | 
| +    } | 
| +    defines = [ "U_HIDE_DATA_SYMBOL" ] | 
| +} | 
| +# END icudata.lst/icudtl.dat | 
|  |