[go: nahoru, domu]

blob: c8c0c5c54ec6201d7ab021be6eeec035256966a0 [file] [log] [blame]
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni")
assert(is_chromeos_ash, "Non-Chrome-OS builds must not depend on //ash")
mojom("mojo_bindings") {
sources = [ "emoji_search.mojom" ]
public_deps = [ "//mojo/public/mojom/base" ]
webui_module_path = "/"
}
source_set("unit_tests") {
testonly = true
deps = [
":emoji",
":resources",
"//base/test:test_support",
"//testing/gtest",
"//ui/base:test_support",
]
sources = [ "emoji_search_unittest.cc" ]
}
action_foreach("emoji_data") {
script = "tools/emoji_data.py"
metadata_json = [
"//third_party/emoji-metadata/src/emoji_15_0_ordering.json",
"./emoji_test_ordering.json",
]
keyword_xmls = [
# later keywords will override earlier keywords for a particular emoji.
"//third_party/cldr/src/common/annotations/en.xml",
"//third_party/cldr/src/common/annotations/en_001.xml",
"//third_party/cldr/src/common/annotationsDerived/en.xml",
"//third_party/cldr/src/common/annotationsDerived/en_001.xml",
]
merged_json = "$target_gen_dir/{{source_name_part}}_start.json"
sources = metadata_json
inputs = keyword_xmls
outputs = [ merged_json ]
args = [
"--firstgroup",
"True",
"--metadata",
"{{source}}",
"--output",
rebase_path(merged_json, root_build_dir),
"--keywords",
] + rebase_path(keyword_xmls, root_build_dir)
}
action_foreach("emoji_data_remaining") {
script = "tools/emoji_data.py"
metadata_json = [
"//third_party/emoji-metadata/src/emoji_15_0_ordering.json",
"./emoji_test_ordering.json",
]
keyword_xmls = [
# later keywords will override earlier keywords for a particular emoji.
"//third_party/cldr/src/common/annotations/en.xml",
"//third_party/cldr/src/common/annotations/en_001.xml",
"//third_party/cldr/src/common/annotationsDerived/en.xml",
"//third_party/cldr/src/common/annotationsDerived/en_001.xml",
]
merged_json = "$target_gen_dir/{{source_name_part}}_remaining.json"
sources = metadata_json
inputs = keyword_xmls
outputs = [ merged_json ]
args = [
"--firstgroup",
"False",
"--metadata",
"{{source}}",
"--output",
rebase_path(merged_json, root_build_dir),
"--keywords",
] + rebase_path(keyword_xmls, root_build_dir)
}
action_foreach("emoticon_data") {
script = "tools/emoticon_data.py"
merged_json = "$target_gen_dir/{{source_name_part}}.json"
sources = [
"./emoticon_test_ordering.json",
"//third_party/emoji-metadata/src/emoticon_ordering.json",
]
outputs = [ merged_json ]
args = [
"--metadata",
"{{source}}",
"--output",
rebase_path(merged_json, root_build_dir),
]
}
action("symbol_data") {
script = "tools/symbol_data.py"
outputs = [ "$target_gen_dir/symbol_ordering.json" ]
deps = [
":emoji_data",
":emoji_data_remaining",
]
args = [
"--output",
rebase_path(outputs[0], root_build_dir),
]
args +=
[ "--filter-data-paths" ] +
rebase_path(get_target_outputs(":emoji_data"), root_build_dir) +
rebase_path(get_target_outputs(":emoji_data_remaining"), root_build_dir)
}
copy("symbol_test_data") {
sources = [ "./symbol_test_ordering.json" ]
outputs = [ "$target_gen_dir/symbol_test_ordering.json" ]
}
# I18n emoji data.
# TODO(b/346457889): Use a script to loop through languages.
# This is used to generate the emoji in a specific order
emoji_metadata = [ "//third_party/emoji-metadata/src/emoji_15_0_ordering.json" ]
emoji_script = "tools/emoji_data.py"
# German emoji keywords
de_keyword_xmls = [
"//third_party/cldr/src/common/annotations/de.xml",
"//third_party/cldr/src/common/annotationsDerived/de.xml",
]
action("emoji_data_de") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_de_start.json" ]
inputs = de_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_de_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_de_remaining.json" ]
inputs = de_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Japanese keywords.
ja_keyword_xmls = [
"//third_party/cldr/src/common/annotations/ja.xml",
"//third_party/cldr/src/common/annotationsDerived/ja.xml",
]
action("emoji_data_ja") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_ja_start.json" ]
inputs = ja_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_ja_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_ja_remaining.json" ]
inputs = ja_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Spanish keywords.
es_keyword_xmls = [
"//third_party/cldr/src/common/annotations/es.xml",
"//third_party/cldr/src/common/annotationsDerived/es.xml",
]
action("emoji_data_es") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_es_start.json" ]
inputs = es_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_es_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_es_remaining.json" ]
inputs = es_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Swedish keywords.
sv_keyword_xmls = [
"//third_party/cldr/src/common/annotations/sv.xml",
"//third_party/cldr/src/common/annotationsDerived/sv.xml",
]
action("emoji_data_sv") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_sv_start.json" ]
inputs = sv_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_sv_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_sv_remaining.json" ]
inputs = sv_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Norwegian keywords.
no_keyword_xmls = [
"//third_party/cldr/src/common/annotations/no.xml",
"//third_party/cldr/src/common/annotationsDerived/no.xml",
]
action("emoji_data_no") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_no_start.json" ]
inputs = no_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_no_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_no_remaining.json" ]
inputs = no_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Finnish keywords.
fi_keyword_xmls = [
"//third_party/cldr/src/common/annotations/fi.xml",
"//third_party/cldr/src/common/annotationsDerived/fi.xml",
]
action("emoji_data_fi") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_fi_start.json" ]
inputs = fi_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_fi_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_fi_remaining.json" ]
inputs = fi_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Danish keywords.
da_keyword_xmls = [
"//third_party/cldr/src/common/annotations/da.xml",
"//third_party/cldr/src/common/annotationsDerived/da.xml",
]
action("emoji_data_da") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_da_start.json" ]
inputs = da_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_da_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_da_remaining.json" ]
inputs = da_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# French keywords.
fr_keyword_xmls = [
"//third_party/cldr/src/common/annotations/fr.xml",
"//third_party/cldr/src/common/annotationsDerived/fr.xml",
]
action("emoji_data_fr") {
firstgroup = "True"
outputs = [ "$target_gen_dir/emoji_fr_start.json" ]
inputs = fr_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
action("emoji_data_fr_remaining") {
firstgroup = "False"
outputs = [ "$target_gen_dir/emoji_fr_remaining.json" ]
inputs = fr_keyword_xmls
# Shared for all emoji scripts
script = emoji_script
sources = emoji_metadata
args = [
"--firstgroup",
firstgroup,
"--output",
] + rebase_path(outputs, root_build_dir)
args += [ "--metadata" ] + rebase_path(sources, root_build_dir)
args += [ "--keywords" ] + rebase_path(inputs, root_build_dir)
}
# Resources used by chrome://picker.
grit("resources") {
source = "emoji.grd"
deps = [
":emoji_data",
":emoji_data_da",
":emoji_data_da_remaining",
":emoji_data_de",
":emoji_data_de_remaining",
":emoji_data_es",
":emoji_data_es_remaining",
":emoji_data_fi",
":emoji_data_fi_remaining",
":emoji_data_fr",
":emoji_data_fr_remaining",
":emoji_data_ja",
":emoji_data_ja_remaining",
":emoji_data_no",
":emoji_data_no_remaining",
":emoji_data_remaining",
":emoji_data_sv",
":emoji_data_sv_remaining",
":emoticon_data",
":symbol_data",
":symbol_test_data",
]
outputs = [
"grit/emoji.h",
"grit/emoji_map.cc",
"grit/emoji_map.h",
"emoji.pak",
]
}
source_set("emoji") {
deps = [
":resources",
"//base",
"//ui/base",
]
sources = [
"emoji_search.cc",
"emoji_search.h",
]
}