OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Generates a credits HTML file, based on the third-party dependencies of |
| 6 # a provided GN target. |
| 7 # Parameters: |
| 8 # gn_target: The target whose dependencies should be listed in the credits. |
| 9 # credits_gen_dir: Directory (without trailing slash) where the generated |
| 10 # HTML will be placed, together with the copied JSS+CS files. |
| 11 template("remoting_credits") { |
| 12 _credits_source_dir = "//remoting/credits" |
| 13 |
| 14 action("${target_name}__generate") { |
| 15 # Generate credits.html in a temporary location, so it can be copied into |
| 16 # the final location - see comment for 'copy' target. |
| 17 _credits_html_file = "$target_gen_dir/$target_name/credits.html" |
| 18 _credits_template = "$_credits_source_dir/credits.tmpl" |
| 19 _credits_entry_template = "$_credits_source_dir/credits_entry.tmpl" |
| 20 script = "//tools/licenses.py" |
| 21 depfile = "$target_gen_dir/$target_name.d" |
| 22 inputs = [ |
| 23 _credits_template, |
| 24 _credits_entry_template, |
| 25 ] |
| 26 outputs = [ |
| 27 _credits_html_file, |
| 28 ] |
| 29 args = [ |
| 30 "credits", |
| 31 rebase_path(_credits_html_file, root_build_dir), |
| 32 "--file-template", |
| 33 rebase_path(_credits_template, root_build_dir), |
| 34 "--entry-template", |
| 35 rebase_path(_credits_entry_template, root_build_dir), |
| 36 "--depfile", |
| 37 rebase_path(depfile, root_build_dir), |
| 38 "--gn-target", |
| 39 invoker.gn_target, |
| 40 "--gn-out-dir", |
| 41 rebase_path(root_build_dir), |
| 42 ] |
| 43 } |
| 44 |
| 45 # This target purposefully copies the generated HTML file (instead of |
| 46 # directly generating the HTML file into credits_gen_dir), so that the caller |
| 47 # can use get_target_outputs(:target_name) and the HTML file will be |
| 48 # included in the returned list along with the JS+CSS files. |
| 49 copy(target_name) { |
| 50 _generate_target = ":${target_name}__generate" |
| 51 _credits_gen_dir = invoker.credits_gen_dir |
| 52 sources = [ |
| 53 "$_credits_source_dir/credits_css.css", |
| 54 "$_credits_source_dir/credits_js.js", |
| 55 ] + get_target_outputs(_generate_target) |
| 56 outputs = [ |
| 57 "$_credits_gen_dir/{{source_file_part}}", |
| 58 ] |
| 59 deps = [ |
| 60 _generate_target, |
| 61 ] |
| 62 } |
| 63 } |
OLD | NEW |