Commit 18c898ac authored by Takuto Ikuta's avatar Takuto Ikuta Committed by Commit Bot

Added dependency to jinja2 sources for mojom generator

mojom generator uses jinja2 template.
If we update jinja2 library, jinja2 may update api/internal structure.
In such case, all mojom generator using jinja2 may need to re-run.

I added jinja2_sources for such case and use it as inputs dependency for mojom generator action.
It is recommended by gn.
https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/reference.md#target-declarations-action_declare-a-target-that-runs-a-script-a-single-time-inputs

* Minor fix
Update README.chromium to pass current presubmit check.

Change-Id: I8b7f126c3a807ac211db01c90437d584c9c39f85
Reviewed-on: https://chromium-review.googlesource.com/961763Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@google.com>
Cr-Commit-Position: refs/heads/master@{#543073}
parent bf9f2827
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/jinja2/jinja2.gni")
action("precompile_templates") {
sources = mojom_generator_sources
......@@ -68,6 +69,8 @@ action("precompile_templates") {
"$mojom_generator_root/generators/js_templates/validation_macros.tmpl",
]
script = mojom_generator_script
inputs = jinja2_sources
outputs = [
"$target_gen_dir/cpp_templates.zip",
"$target_gen_dir/java_templates.zip",
......
......@@ -12,6 +12,7 @@ import("//build/config/jumbo.gni")
import("//build/config/chrome_build.gni")
import("//build/config/nacl/config.gni")
import("//components/nacl/features.gni")
import("//third_party/jinja2/jinja2.gni")
declare_args() {
# Indicates whether typemapping should be supported in this build
......@@ -399,7 +400,7 @@ template("mojom") {
}
action_foreach(parser_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
outputs = [
"{{source_gen_dir}}/{{source_name_part}}.p",
......@@ -444,7 +445,7 @@ template("mojom") {
source_file_name = target_name
action_foreach(verify_deps_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
deps = [
":$parsed_target_name",
......@@ -537,7 +538,7 @@ template("mojom") {
action_foreach(generator_cpp_message_ids_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
deps = [
":$parsed_target_name",
......@@ -569,7 +570,7 @@ template("mojom") {
generator_shared_target_name = "${target_name}_shared__generator"
action_foreach(generator_shared_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
deps = [
":$parsed_target_name",
......@@ -743,7 +744,7 @@ template("mojom") {
generator_target_name = "${target_name}${variant_suffix}__generator"
action_foreach(generator_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = invoker.sources
deps = [
":$parsed_target_name",
......@@ -813,7 +814,8 @@ template("mojom") {
}
action(type_mappings_target_name) {
inputs = _bindings_configuration_files + mojom_generator_sources
inputs = _bindings_configuration_files + mojom_generator_sources +
jinja2_sources
outputs = [
type_mappings_path,
]
......@@ -994,7 +996,7 @@ template("mojom") {
[ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
action_foreach(java_generator_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = enabled_sources
deps = [
":$parsed_target_name",
......@@ -1078,7 +1080,7 @@ template("mojom") {
]
action_foreach(generator_js_target_name) {
script = mojom_generator_script
inputs = mojom_generator_sources
inputs = mojom_generator_sources + jinja2_sources
sources = []
if (defined(invoker.sources)) {
sources += invoker.sources
......
Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.
Some rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.
Some rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -2,8 +2,8 @@ Name: Jinja2 Python Template Engine
Short Name: jinja2
URL: http://jinja.pocoo.org/
Version: 2.8
License: BSD 3-clause License
License File: NOT_SHIPPED
License: BSD 3-Clause
License File: LICENSE
Security Critical: no
Description:
......@@ -19,7 +19,8 @@ AUTHORS files. Unit tests (testsuite directory) have been removed.
Additional chromium-specific files are:
* README.chromium (this file)
* OWNERS
* install script (get_jinja2.sh)
* get_jinja2.sh (install script)
* jinja2.gni (generated by get_jinja2.sh)
* files of hashes (MD5 is also posted on website, SHA-512 computed locally).
Script checks hash then unpacks archive and installs desired files.
Retrieve or update by executing jinja2/get_jinja2.sh from third_party.
......@@ -120,3 +120,17 @@ mv "$INSTALL_DIR" "$OLD_DIR"
mv "$PACKAGE_DIR" "$INSTALL_DIR"
cd "$INSTALL_DIR"
rm -fr "$OLD_DIR"
# Generating jinja2.gni
cat > jinja2.gni <<EOF
# DO NOT EDIT
# This is generated from get_jinja2.sh.
jinja2_sources = [
EOF
for i in $(LC_COLLATE=C ls *.py)
do
echo " \"//third_party/jinja2/${i}\"," >> jinja2.gni
done
echo "]" >> jinja2.gni
# DO NOT EDIT
# This is generated from get_jinja2.sh.
jinja2_sources = [
"//third_party/jinja2/__init__.py",
"//third_party/jinja2/_compat.py",
"//third_party/jinja2/_stringdefs.py",
"//third_party/jinja2/bccache.py",
"//third_party/jinja2/compiler.py",
"//third_party/jinja2/constants.py",
"//third_party/jinja2/debug.py",
"//third_party/jinja2/defaults.py",
"//third_party/jinja2/environment.py",
"//third_party/jinja2/exceptions.py",
"//third_party/jinja2/ext.py",
"//third_party/jinja2/filters.py",
"//third_party/jinja2/lexer.py",
"//third_party/jinja2/loaders.py",
"//third_party/jinja2/meta.py",
"//third_party/jinja2/nodes.py",
"//third_party/jinja2/optimizer.py",
"//third_party/jinja2/parser.py",
"//third_party/jinja2/runtime.py",
"//third_party/jinja2/sandbox.py",
"//third_party/jinja2/tests.py",
"//third_party/jinja2/utils.py",
"//third_party/jinja2/visitor.py",
]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment