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

Side by Side Diff: build/config/mac/rules.gni

Issue 1250913002: patch from chinmaygarde@ to make progress on mac, ios. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to #341416 Created 5 years, 4 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
OLDNEW
(Empty)
1 # Copyright 2015 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
5 mac_app_script = "//build/config/mac/mac_app.py"
6
7 template("code_sign_mac") {
8 assert(defined(invoker.entitlements_path),
9 "The path to the entitlements .xcent file")
10 assert(defined(invoker.identity), "The code signing identity")
11 assert(defined(invoker.application_path), "The application to code sign")
12 assert(defined(invoker.deps))
13
14 action(target_name) {
15 sources = [
16 invoker.entitlements_path,
17 ]
18
19 _application_path = invoker.application_path
20
21 script = mac_app_script
22
23 outputs = [
24 "$_application_path/_CodeSignature/CodeResources",
25 ]
26
27 args = [
28 "codesign",
29 "-p",
30 rebase_path(invoker.application_path, root_build_dir),
31 "-i",
32 invoker.identity,
33 "-e",
34 rebase_path(invoker.entitlements_path, root_build_dir),
35 ]
36
37 deps = invoker.deps
brettw 2015/08/04 18:07:29 forward_variables_from(invoker, ["deps", "public_d
Dirk Pranke 2015/08/04 18:27:15 Acknowledged.
38 }
39 }
40
41 template("process_nibs_mac") {
42 assert(defined(invoker.sources), "The nib sources must be specified")
43 assert(defined(invoker.module), "The nib module must be specified")
44 assert(defined(invoker.output_dir), "The output directory must be specified")
45
46 action_foreach(target_name) {
47 sources = invoker.sources
48
49 script = mac_app_script
50
51 invoker_out_dir = invoker.output_dir
52
53 outputs = [
54 "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib",
55 ]
56
57 args = [
58 "nib",
59 "-i",
60 "{{source}}",
61 "-o",
62 invoker_out_dir,
63 "-m",
64 invoker.module,
65 ]
66 }
brettw 2015/08/04 18:07:28 Add: forward_variables_from(invoker, ["deps", "pu
67 }
68
69 template("resource_copy_mac") {
70 assert(defined(invoker.resources),
71 "The source list of resources to copy over")
72 assert(defined(invoker.bundle_directory),
73 "The directory within the bundle to place the sources in")
74 assert(defined(invoker.app_name), "The name of the application")
75
76 _bundle_directory = invoker.bundle_directory
77 _app_name = invoker.app_name
78 _resources = invoker.resources
79
80 copy(target_name) {
81 set_sources_assignment_filter([])
82 sources = _resources
83 outputs = [
84 "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{so urce_file_part}}",
85 ]
86 }
87 }
88
89 template("mac_app") {
90 assert(defined(invoker.deps),
91 "Dependencies must be specified for $target_name")
92 assert(defined(invoker.info_plist),
93 "The application plist file must be specified for $target_name")
94 assert(defined(invoker.app_name),
95 "The name of Mac application for $target_name")
brettw 2015/08/04 18:07:28 Is it necessary for this to be different? I would
Dirk Pranke 2015/08/04 18:27:15 I don't think it's necessary to be different, but
96 assert(defined(invoker.xibs),
97 "The list of XIB files must be specified for $target_name")
98
99 # We just create a variable so we can use the same in interpolation
brettw 2015/08/04 18:07:28 This is fixed as of today. Just do ${invoker.app
Dirk Pranke 2015/08/04 18:27:15 Acknowledged.
100 app_name = invoker.app_name
101
102 # Generate the project structure
103 struct_gen_target_name = target_name + "_struct"
104
105 action(struct_gen_target_name) {
brettw 2015/08/04 18:07:28 Can you restrict visibility for the intermediate t
Dirk Pranke 2015/08/04 18:27:15 Acknowledged.
106 script = mac_app_script
107
108 sources = []
brettw 2015/08/04 18:07:28 You can delete this.
Dirk Pranke 2015/08/04 18:27:15 Acknowledged.
109 outputs = [
110 "$root_build_dir/$app_name.app",
111 ]
112
113 args = [
114 "structure",
115 "-d",
116 rebase_path(root_build_dir),
117 "-n",
118 app_name,
119 ]
120 }
121
122 # Generate the executable
123 bin_gen_target_name = target_name + "_bin"
124 executable(bin_gen_target_name) {
125 deps = invoker.deps
126 output_name = app_name
127 }
128
129 # Process the Info.plist
130 plist_gen_target_name = target_name + "_plist"
131
132 action(plist_gen_target_name) {
133 script = mac_app_script
134
135 sources = [
136 invoker.info_plist,
137 ]
138 outputs = [
139 "$root_build_dir/Info.plist",
140 ]
141
142 args = [
143 "plist",
144 "-i",
145 rebase_path(invoker.info_plist, root_build_dir),
146 "-o",
147 rebase_path(root_build_dir),
148 ]
149 }
150
151 # Copy the generated binaries and assets to their appropriate locations
152 copy_plist_gen_target_name = target_name + "_plist_copy"
153 copy(copy_plist_gen_target_name) {
154 sources = [
155 "$root_build_dir/Info.plist",
156 ]
157
158 outputs = [
159 "$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
160 ]
161
162 deps = [
163 ":$plist_gen_target_name",
164 ]
165 }
166
167 copy_bin_target_name = target_name + "_bin_copy"
168 copy(copy_bin_target_name) {
169 sources = [
170 "$root_build_dir/$app_name",
171 ]
172
173 outputs = [
174 "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
175 ]
176
177 deps = [
178 ":$bin_gen_target_name",
179 ]
180 }
181
182 copy_xib_target_name = target_name + "_xib_copy"
183 process_nibs_mac(copy_xib_target_name) {
184 sources = invoker.xibs
185 module = app_name
186 output_dir = "$app_name.app/Contents/Resources"
187 }
188
189 copy_all_target_name = target_name + "_all_copy"
190 group(copy_all_target_name) {
191 deps = [
brettw 2015/08/04 18:07:28 I'd do public_deps for this group and the below on
Dirk Pranke 2015/08/04 18:27:15 Same reply (I don't think we need to expose these
192 ":$struct_gen_target_name",
193 ":$copy_plist_gen_target_name",
194 ":$copy_bin_target_name",
195 ":$copy_xib_target_name",
196 ]
197 }
198
199 # Top level group
200
201 group(target_name) {
202 deps = [
203 ":$copy_all_target_name",
204 ]
205 }
206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698