Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: tools/gn/secondary/tools/grit/grit_rule.gni

Issue 23606031: GN: Use build directory for CD for scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/secondary/chrome/BUILD.gn ('k') | tools/gn/test_with_scope.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 template("grit") { 5 template("grit") {
6 assert(defined(source), 6 assert(defined(source),
7 "\"source\" must be defined for the grit template $target_name") 7 "\"source\" must be defined for the grit template $target_name")
8 assert(!defined(sources) && !defined(outputs), 8 assert(!defined(sources) && !defined(outputs),
9 "Neither \"sources\" nor \"outputs\" can be defined for the grit " + 9 "Neither \"sources\" nor \"outputs\" can be defined for the grit " +
10 "template $target_name") 10 "template $target_name")
11 11
12 resource_ids = "$relative_source_root_dir/tools/gritsettings/resource_ids" 12 resource_ids = to_build_path("//tools/gritsettings/resource_ids")
13 output_dir = "$relative_target_gen_dir" 13 output_dir = to_build_path(target_gen_dir)
14 14 grit_info_script = to_build_path("//tools/grit/grit_info.py")
15 # Note that this needs to be source-absolute since the current directory will 15 source_path = to_build_path(source)
16 # be that of the file invoking the template, not this file.
17 grit_info_script = "$relative_source_root_dir/tools/grit/grit_info.py"
18 16
19 grit_inputs = exec_script(grit_info_script, 17 grit_inputs = exec_script(grit_info_script,
20 [ "--inputs", source, "-f", resource_ids], "list lines") 18 [ "--inputs", source_path, "-f", resource_ids], "list lines")
21 grit_outputs = exec_script(grit_info_script, 19 grit_outputs = exec_script(grit_info_script,
22 [ "--outputs", "$output_dir", source, "-f", resource_ids ], 20 [ "--outputs", "$output_dir", source_path, "-f", resource_ids ],
23 "list lines") 21 "list lines")
24 22
25 # The current grit setup makes an file in $target_gen_dir/grit/foo.h that 23 # The current grit setup makes an file in $target_gen_dir/grit/foo.h that
26 # the source code expects to include via "grit/foo.h". It would be nice to 24 # the source code expects to include via "grit/foo.h". It would be nice to
27 # change this to including absolute paths relative to the root gen directory 25 # change this to including absolute paths relative to the root gen directory
28 # (like "mycomponent/foo.h"). This config sets up the include path. 26 # (like "mycomponent/foo.h"). This config sets up the include path.
29 grit_config = target_name + "_grit_config" 27 grit_config = target_name + "_grit_config"
30 config(grit_config) { 28 config(grit_config) {
31 includes = [ target_gen_dir ] 29 includes = [ target_gen_dir ]
32 } 30 }
33 31
34 grit_custom_target = target_name + "_grit" 32 grit_custom_target = target_name + "_grit"
35 custom(grit_custom_target) { 33 custom(grit_custom_target) {
36 script = "$relative_source_root_dir/tools/grit/grit.py" 34 script = "//tools/grit/grit.py"
37 source_prereqs = grit_inputs 35 source_prereqs = grit_inputs
38 outputs = grit_outputs 36 outputs = grit_outputs
39 37
40 # TODO(brettw) grit_defines. 38 # TODO(brettw) grit_defines.
41 args = [ 39 args = [
42 "-i", source, "build", 40 "-i", source_path, "build",
43 "-f", resource_ids, 41 "-f", resource_ids,
44 "-o", relative_target_gen_dir, 42 "-o", output_dir,
45 ] 43 ]
46 } 44 }
47 45
48 # This is the thing that people actually link with, it must be named the 46 # This is the thing that people actually link with, it must be named the
49 # same as the argument the template was invoked with. 47 # same as the argument the template was invoked with.
50 static_library(target_name) { 48 static_library(target_name) {
51 # Since we generate a file, we need to be run before the targets that 49 # Since we generate a file, we need to be run before the targets that
52 # depend on us. 50 # depend on us.
53 hard_dep = true 51 hard_dep = true
54 52
55 sources = grit_outputs 53 sources = grit_outputs
56 deps = [ ":$grit_custom_target" ] 54 deps = [ ":$grit_custom_target" ]
57 direct_dependent_configs = [ ":$grit_config" ] 55 direct_dependent_configs = [ ":$grit_config" ]
58 } 56 }
59 } 57 }
OLDNEW
« no previous file with comments | « tools/gn/secondary/chrome/BUILD.gn ('k') | tools/gn/test_with_scope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698