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

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

Issue 2454703004: GN: Format more gn files (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « build/config/mac/mac_sdk.gni ('k') | build/config/templates/templates.gni » ('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 2015 The Chromium Authors. All rights reserved. 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 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 mac_app_script = "//build/config/mac/mac_app.py" 5 mac_app_script = "//build/config/mac/mac_app.py"
6 6
7 template("code_sign_mac") { 7 template("code_sign_mac") {
8 assert(defined(invoker.entitlements_path), 8 assert(defined(invoker.entitlements_path),
9 "The path to the entitlements .xcent file") 9 "The path to the entitlements .xcent file")
10 assert(defined(invoker.identity), 10 assert(defined(invoker.identity), "The code signing identity")
11 "The code signing identity") 11 assert(defined(invoker.application_path), "The application to code sign")
12 assert(defined(invoker.application_path),
13 "The application to code sign")
14 assert(defined(invoker.deps)) 12 assert(defined(invoker.deps))
15 13
16 action(target_name) { 14 action(target_name) {
17 sources = [ 15 sources = [
18 invoker.entitlements_path, 16 invoker.entitlements_path,
19 ] 17 ]
20 18
21 _application_path = invoker.application_path 19 _application_path = invoker.application_path
22 20
23 script = mac_app_script 21 script = mac_app_script
24 22
25 outputs = [ 23 outputs = [
26 "$_application_path/_CodeSignature/CodeResources" 24 "$_application_path/_CodeSignature/CodeResources",
27 ] 25 ]
28 26
29 args = [ 27 args = [
30 "codesign", 28 "codesign",
31 "-p", 29 "-p",
32 rebase_path(invoker.application_path, root_build_dir), 30 rebase_path(invoker.application_path, root_build_dir),
33 "-i", 31 "-i",
34 invoker.identity, 32 invoker.identity,
35 "-e", 33 "-e",
36 rebase_path(invoker.entitlements_path, root_build_dir), 34 rebase_path(invoker.entitlements_path, root_build_dir),
37 ] 35 ]
38 36
39 deps = invoker.deps 37 deps = invoker.deps
40 } 38 }
41 } 39 }
42 40
43 template("process_nibs_mac") { 41 template("process_nibs_mac") {
44 assert(defined(invoker.sources), 42 assert(defined(invoker.sources), "The nib sources must be specified")
45 "The nib sources must be specified") 43 assert(defined(invoker.module), "The nib module must be specified")
46 assert(defined(invoker.module), 44 assert(defined(invoker.output_dir), "The output directory must be specified")
47 "The nib module must be specified")
48 assert(defined(invoker.output_dir),
49 "The output directory must be specified")
50 45
51 action_foreach(target_name) { 46 action_foreach(target_name) {
52 sources = invoker.sources 47 sources = invoker.sources
53 48
54 script = mac_app_script 49 script = mac_app_script
55 50
56 invoker_out_dir = invoker.output_dir 51 invoker_out_dir = invoker.output_dir
57 52
58 outputs = [ 53 outputs = [
59 "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib" 54 "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib",
60 ] 55 ]
61 56
62 args = [ 57 args = [
63 "nib", 58 "nib",
64 "-i", 59 "-i",
65 "{{source}}", 60 "{{source}}",
66 "-o", 61 "-o",
67 invoker_out_dir, 62 invoker_out_dir,
68 "-m", 63 "-m",
69 invoker.module, 64 invoker.module,
70 ] 65 ]
71 } 66 }
72 } 67 }
73 68
74 template("resource_copy_mac") { 69 template("resource_copy_mac") {
75 assert(defined(invoker.resources), 70 assert(defined(invoker.resources),
76 "The source list of resources to copy over") 71 "The source list of resources to copy over")
77 assert(defined(invoker.bundle_directory), 72 assert(defined(invoker.bundle_directory),
78 "The directory within the bundle to place the sources in") 73 "The directory within the bundle to place the sources in")
79 assert(defined(invoker.app_name), 74 assert(defined(invoker.app_name), "The name of the application")
80 "The name of the application")
81 75
82 _bundle_directory = invoker.bundle_directory 76 _bundle_directory = invoker.bundle_directory
83 _app_name = invoker.app_name 77 _app_name = invoker.app_name
84 _resources = invoker.resources 78 _resources = invoker.resources
85 79
86 copy(target_name) { 80 copy(target_name) {
87 set_sources_assignment_filter([]) 81 set_sources_assignment_filter([])
88 sources = _resources 82 sources = _resources
89 outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Reso urces/{{source_file_part}}" ] 83 outputs = [
84 "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{so urce_file_part}}",
85 ]
90 86
91 if (defined(invoker.deps)) { 87 if (defined(invoker.deps)) {
92 deps = invoker.deps 88 deps = invoker.deps
93 } 89 }
94 } 90 }
95 } 91 }
96 92
97 template("mac_app") { 93 template("mac_app") {
98
99 assert(defined(invoker.deps), 94 assert(defined(invoker.deps),
100 "Dependencies must be specified for $target_name") 95 "Dependencies must be specified for $target_name")
101 assert(defined(invoker.info_plist), 96 assert(defined(invoker.info_plist),
102 "The application plist file must be specified for $target_name") 97 "The application plist file must be specified for $target_name")
103 assert(defined(invoker.app_name), 98 assert(defined(invoker.app_name),
104 "The name of Mac application for $target_name") 99 "The name of Mac application for $target_name")
105 assert(defined(invoker.xibs), 100 assert(defined(invoker.xibs),
106 "The list of XIB files must be specified for $target_name") 101 "The list of XIB files must be specified for $target_name")
102
107 # assert(defined(invoker.entitlements_path), 103 # assert(defined(invoker.entitlements_path),
108 # "The entitlements path must be specified for $target_name") 104 # "The entitlements path must be specified for $target_name")
109 # assert(defined(invoker.code_signing_identity), 105 # assert(defined(invoker.code_signing_identity),
110 # "The entitlements path must be specified for $target_name") 106 # "The entitlements path must be specified for $target_name")
111 107
112 # We just create a variable so we can use the same in interpolation 108 # We just create a variable so we can use the same in interpolation
113 app_name = invoker.app_name 109 app_name = invoker.app_name
114 110
115 # Generate the project structure 111 # Generate the project structure
116 112
117 struct_gen_target_name = target_name + "_struct" 113 struct_gen_target_name = target_name + "_struct"
118 114
119 action(struct_gen_target_name) { 115 action(struct_gen_target_name) {
120
121 script = mac_app_script 116 script = mac_app_script
122 117
123 sources = [] 118 sources = []
124 outputs = [ "$root_build_dir/$app_name.app" ] 119 outputs = [
120 "$root_build_dir/$app_name.app",
121 ]
125 122
126 args = [ 123 args = [
127 "structure", 124 "structure",
128 "-d", 125 "-d",
129 rebase_path(root_build_dir), 126 rebase_path(root_build_dir),
130 "-n", 127 "-n",
131 app_name 128 app_name,
132 ] 129 ]
133
134 } 130 }
135 131
136 # Generate the executable 132 # Generate the executable
137 133
138 bin_gen_target_name = target_name + "_bin" 134 bin_gen_target_name = target_name + "_bin"
139 135
140 executable(bin_gen_target_name) { 136 executable(bin_gen_target_name) {
141 deps = invoker.deps 137 deps = invoker.deps
142 output_name = app_name 138 output_name = app_name
143 } 139 }
144 140
145 # Process the Info.plist 141 # Process the Info.plist
146 142
147 plist_gen_target_name = target_name + "_plist" 143 plist_gen_target_name = target_name + "_plist"
148 144
149 action(plist_gen_target_name) { 145 action(plist_gen_target_name) {
150
151 script = mac_app_script 146 script = mac_app_script
152 147
153 sources = [ invoker.info_plist ] 148 sources = [
154 outputs = [ "$root_build_dir/plist/$app_name/Info.plist" ] 149 invoker.info_plist,
150 ]
151 outputs = [
152 "$root_build_dir/plist/$app_name/Info.plist",
153 ]
155 154
156 args = [ 155 args = [
157 "plist", 156 "plist",
158 "-i", 157 "-i",
159 rebase_path(invoker.info_plist, root_build_dir), 158 rebase_path(invoker.info_plist, root_build_dir),
160 "-o", 159 "-o",
161 rebase_path("$root_build_dir/plist/$app_name"), 160 rebase_path("$root_build_dir/plist/$app_name"),
162 ] 161 ]
163 } 162 }
164 163
165 # Copy the generated binaries and assets to their appropriate locations 164 # Copy the generated binaries and assets to their appropriate locations
166 165
167 copy_plist_gen_target_name = target_name + "_plist_copy" 166 copy_plist_gen_target_name = target_name + "_plist_copy"
168 copy(copy_plist_gen_target_name) { 167 copy(copy_plist_gen_target_name) {
169 sources = [ 168 sources = [
170 "$root_build_dir/plist/$app_name/Info.plist", 169 "$root_build_dir/plist/$app_name/Info.plist",
171 ] 170 ]
172 171
173 outputs = [ 172 outputs = [
174 "$root_build_dir/$app_name.app/Contents/{{source_file_part}}" 173 "$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
175 ] 174 ]
176 175
177 deps = [ 176 deps = [
178 ":$plist_gen_target_name", 177 ":$plist_gen_target_name",
179 ] 178 ]
180 } 179 }
181 180
182 copy_bin_target_name = target_name + "_bin_copy" 181 copy_bin_target_name = target_name + "_bin_copy"
183 copy(copy_bin_target_name) { 182 copy(copy_bin_target_name) {
184 sources = [ 183 sources = [
185 "$root_build_dir/$app_name", 184 "$root_build_dir/$app_name",
186 ] 185 ]
187 186
188 outputs = [ 187 outputs = [
189 "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}" 188 "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
190 ] 189 ]
191 190
192 deps = [ 191 deps = [
193 ":$bin_gen_target_name", 192 ":$bin_gen_target_name",
194 ] 193 ]
195 } 194 }
196 195
197 copy_xib_target_name = target_name + "_xib_copy" 196 copy_xib_target_name = target_name + "_xib_copy"
198 process_nibs_mac(copy_xib_target_name) { 197 process_nibs_mac(copy_xib_target_name) {
199 sources = invoker.xibs 198 sources = invoker.xibs
200 module = app_name 199 module = app_name
201 output_dir = "$app_name.app/Contents/Resources" 200 output_dir = "$app_name.app/Contents/Resources"
202 } 201 }
203 202
204 copy_all_target_name = target_name + "_all_copy" 203 copy_all_target_name = target_name + "_all_copy"
205 group(copy_all_target_name) { 204 group(copy_all_target_name) {
206 deps = [ 205 deps = [
206 ":$copy_bin_target_name",
207 ":$copy_plist_gen_target_name",
208 ":$copy_xib_target_name",
207 ":$struct_gen_target_name", 209 ":$struct_gen_target_name",
208 ":$copy_plist_gen_target_name",
209 ":$copy_bin_target_name",
210 ":$copy_xib_target_name",
211 ] 210 ]
212 } 211 }
213 212
214 # Top level group 213 # Top level group
215 214
216 group(target_name) { 215 group(target_name) {
217 deps = [ ":$copy_all_target_name" ] 216 deps = [
217 ":$copy_all_target_name",
218 ]
218 } 219 }
219
220 } 220 }
OLDNEW
« no previous file with comments | « build/config/mac/mac_sdk.gni ('k') | build/config/templates/templates.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698