zip.gni 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright 2014 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("python.gni")
  5. # Creates a zip archive of the inputs.
  6. #
  7. # output (required)
  8. # Path to output zip.
  9. # inputs (required)
  10. # List of input files to zip.
  11. # base_dir (optional)
  12. # If provided, the archive paths will be relative to this directory.
  13. # Applies only to |inputs|.
  14. # zip_comment_values (optional)
  15. # A list of key=value strings to store in a JSON-encoded archive comment.
  16. #
  17. # deps, public_deps, data, data_deps, testonly, visibility
  18. # Normal meaning.
  19. template("zip") {
  20. action_with_pydeps(target_name) {
  21. forward_variables_from(invoker,
  22. [
  23. "data",
  24. "data_deps",
  25. "deps",
  26. "public_deps",
  27. "testonly",
  28. "visibility",
  29. ])
  30. script = "//build/android/gyp/zip.py"
  31. inputs = invoker.inputs
  32. outputs = [ invoker.output ]
  33. args = [
  34. "--output",
  35. rebase_path(invoker.output, root_build_dir),
  36. ]
  37. if (defined(invoker.zip_comment_values)) {
  38. foreach(comment, invoker.zip_comment_values) {
  39. args += [
  40. "--comment-json",
  41. comment,
  42. ]
  43. }
  44. }
  45. _rebased_inputs = rebase_path(invoker.inputs, root_build_dir)
  46. args += [ "--input-files=$_rebased_inputs" ]
  47. if (defined(invoker.base_dir)) {
  48. args += [
  49. "--input-files-base-dir",
  50. rebase_path(invoker.base_dir, root_build_dir),
  51. ]
  52. }
  53. }
  54. }