process_version_rc_template.gni 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright 2016 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. import("//build/config/chrome_build.gni")
  5. import("//build/util/lastchange.gni")
  6. import("//build/util/process_version.gni")
  7. # This is a wrapper around process_version() that eases the task of processing
  8. # a .rc.version file (used especially on Windows).
  9. #
  10. # This template automatically includes VERSION, LASTCHANGE and BRANDING, and
  11. # any additional source files are passed after those (so their values can
  12. # override the ones specified by those 3 files).
  13. #
  14. # Parameters:
  15. # sources (optional):
  16. # List of files with value definitions that will be passed in addition to
  17. # VERSION, LASTCHANGE and BRANDING.
  18. #
  19. # template_file (optional):
  20. # Template file to use (not a list). If not specified, a default value,
  21. # //chrome/app/chrome_version.rc.version will be used.
  22. #
  23. # This template forwards all other parameters directly to process_version().
  24. #
  25. # Examples:
  26. # process_version_rc_template("my_exe_version") {
  27. # output = "$target_gen_dir/my_exe_version.rc"
  28. # sources = [ "frob/my_exe.ver" ]
  29. # extra_args = [ "-e", "FOO=42" ]
  30. # }
  31. #
  32. # process_version_rc_template("my_dll_version") {
  33. # output = "$target_gen_dir/my_dll_version.rc"
  34. # template_file = [ "//foo/bar/my_dll_version.rc.version" ]
  35. # }
  36. template("process_version_rc_template") {
  37. if (defined(invoker.template_file)) {
  38. _template_file = invoker.template_file
  39. } else {
  40. _template_file = "//chrome/app/chrome_version.rc.version"
  41. }
  42. _sources = [
  43. "//chrome/VERSION",
  44. branding_file_path,
  45. lastchange_file,
  46. ]
  47. if (defined(invoker.sources)) {
  48. _sources += invoker.sources
  49. }
  50. process_version(target_name) {
  51. template_file = _template_file
  52. sources = _sources
  53. forward_variables_from(invoker,
  54. "*",
  55. [
  56. "sources",
  57. "template_file",
  58. ])
  59. }
  60. }