asar.gni 863 B

123456789101112131415161718192021222324252627282930
  1. import("npm.gni")
  2. template("asar") {
  3. assert(defined(invoker.sources),
  4. "Need sources in $target_name listing the JS files.")
  5. assert(defined(invoker.outputs),
  6. "Need asar name (as 1-element array, e.g. \$root_out_dir/foo.asar)")
  7. assert(defined(invoker.root),
  8. "Need asar root directory")
  9. asar_root = invoker.root
  10. copy_target_name = target_name + "_inputs"
  11. copy(copy_target_name) {
  12. sources = invoker.sources
  13. outputs = [
  14. "$target_gen_dir/$target_name/{{source_target_relative}}"
  15. ]
  16. }
  17. npm_action(target_name) {
  18. forward_variables_from(invoker, ["deps", "public_deps"])
  19. deps = [":$copy_target_name"]
  20. sources = invoker.sources
  21. script = "asar"
  22. outputs = invoker.outputs
  23. args = [
  24. "pack",
  25. rebase_path("$target_gen_dir/$target_name/$asar_root")
  26. ] + rebase_path(outputs)
  27. }
  28. }