summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/vulcanize.gni
blob: f241c07d37983a613a61600f81911beebee84889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

template("node") {
  action(target_name) {
    forward_variables_from(invoker, "*")

    # Declare dependencies to all involved tools.
    inputs += [
      "//third_party/node/node.py",
      "//third_party/node/node_modules.py",
      "//third_party/node/node_modules.tar.gz.sha1",
    ]

    if (is_linux) {
      inputs += [ "//third_party/node/linux/node-linux-x64.tar.gz.sha1" ]
    }
    if (is_win) {
      inputs += [ "//third_party/node/win/node.exe.sha1" ]
    }
    if (is_mac) {
      inputs += [ "//third_party/node/mac/node-darwin-x64.tar.gz.sha1" ]
    }
  }
}

template("vulcanize") {
  node(target_name) {
    script = "//chrome/browser/resources/vulcanize_gn.py"

    inputs = [
      "//chrome/browser/resources/unpack_pak.py",
    ]

    # This depfile is generated by vulcanize_gn.py
    depfile = "${target_gen_dir}/${invoker.html_out_file}.d"

    outputs = [
      "$target_gen_dir/${invoker.html_out_file}",
      "$target_gen_dir/${invoker.js_out_file}",
    ]
    deps = invoker.deps

    # Note that we have to manually pass the sources to our script if the
    # script needs them as inputs.
    args = [
      "--host",
      invoker.host,
      "--html_in_file",
      invoker.html_in_file,
      "--html_out_file",
      invoker.html_out_file,
      "--js_out_file",
      invoker.js_out_file,
      "--input",
      invoker.input,
      "--out_folder",
      rebase_path(target_gen_dir, root_build_dir),
      "--depfile",
      rebase_path(depfile, root_build_dir),
    ]

    if (defined(invoker.excludes)) {
      args += [ "--exclude" ] + invoker.excludes
    }

    if (defined(invoker.insert_in_head)) {
      args += [
        "--insert_in_head",
        invoker.insert_in_head,
      ]
    }
  }
}

template("polymer_css_build") {
  node(target_name) {
    script = "//chrome/browser/resources/polymer_css_build_gn.py"

    # Input and outputs files must be in the same order.
    inputs = []
    foreach(_input, invoker.input_files) {
      inputs += [ "$target_gen_dir/$_input" ]
    }

    outputs = []
    foreach(_output, invoker.output_files) {
      outputs += [ "$target_gen_dir/$_output" ]
    }

    deps = invoker.deps

    args = [
             "--out_folder",
             rebase_path(target_gen_dir, root_build_dir),
             "--input_files",
           ] + invoker.input_files + [ "--output_files" ] + invoker.output_files
  }
}