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

Side by Side Diff: sdk/BUILD.gn

Issue 2826793002: [Fuchsia] Build only the parts of the SDK that are needed (Closed)
Patch Set: Back out bad fix Created 3 years, 8 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
« no previous file with comments | « BUILD.gn ('k') | tools/copy_tree.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file.
4
5 # The SDK for Fuchsia does not include:
6 # dart2js
7 # dartdoc
8 # ddc
9 # and libraries that are browser-specific, since these are not used and require
10 # significant time to build.
11 # TODO(zra): Assemble the SDK completely with GN, and remove create_sdk.py.
12 if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
13
14 template("copy_tree") {
15 assert(defined(invoker.source), "copy_tree must define 'source'")
16 assert(defined(invoker.dest), "copy_tree must define 'dest'")
17 source = invoker.source
18 dest = invoker.dest
19 action(target_name) {
20 deps = []
21 if (defined(invoker.deps)) {
22 deps += invoker.deps
23 }
24 input_files = exec_script("../tools/list_files.py",
25 [
26 "absolute",
27 "",
28 rebase_path(source),
29 ],
30 "list lines")
31 inputs = input_files
32 relative_files = rebase_path(input_files, rebase_path(source))
33
34 output_files = []
35 foreach(input, relative_files) {
36 output_files += ["$dest/$input"]
37 }
38
39 outputs = output_files
40 script = "../tools/copy_tree.py"
41 args = [
42 "--from",
43 rebase_path(source),
44 "--to",
45 rebase_path(dest),
46 ]
47 if (defined(invoker.exclude)) {
48 args += [
49 "--exclude",
50 invoker.exclude,
51 ]
52 }
53 }
54 }
55
56 copy("copy_dart") {
57 deps = [ "../runtime/bin:dart" ]
58 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
59 dart_name = get_label_info("../runtime/bin:dart", "name")
60 sources = [ "$dart_out/$dart_name" ]
61 outputs = [ "$root_out_dir/dart-sdk/bin/dart" ]
62 }
63
64 copy("copy_dylibs") {
65 deps = [
66 "//third_party/boringssl:crypto",
67 "//third_party/boringssl:ssl",
68 ]
69 crypto_out = get_label_info("//third_party/boringssl:crypto", "root_out_dir")
70 crypto_name = get_label_info("//third_party/boringssl:crypto", "name")
71 ssl_out = get_label_info("//third_party/boringssl:ssl", "root_out_dir")
72 ssl_name = get_label_info("//third_party/boringssl:ssl", "name")
73 sources = [
74 "$crypto_out/lib${crypto_name}.so",
75 "$ssl_out/lib${ssl_name}.so"
76 ]
77 outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
78 }
79
80 template("copy_sdk_script") {
81 assert(defined(invoker.name), "copy_sdk_script must define 'name'")
82 name = invoker.name
83 copy(target_name) {
84 sources = [ "bin/${name}_sdk" ]
85 outputs = [ "$root_out_dir/dart-sdk/bin/${name}"]
86 }
87 }
88
89 _sdk_scripts = [
90 "dartanalyzer",
91 "dartfmt",
92 "pub",
93 ]
94
95 foreach(sdk_script, _sdk_scripts) {
96 copy_sdk_script("copy_${sdk_script}_script") {
97 name = sdk_script
98 }
99 }
100
101 group("copy_scripts") {
102 deps = [
103 ":copy_dartanalyzer_script",
104 ":copy_dartfmt_script",
105 ":copy_pub_script",
106 ]
107 }
108
109 _snapshots = [
110 ["analysis_server", "../utils/analysis_server"],
111 ["dartanalyzer", "../utils/dartanalyzer:generate_dartanalyzer_snapshot"],
112 ["dartfmt", "../utils/dartfmt"],
113 ["pub", "../utils/pub"],
114 ]
115
116 foreach(snapshot, _snapshots) {
117 copy("copy_${snapshot[0]}_snapshot") {
118 deps = [
119 snapshot[1],
120 ]
121 sources = [ "$root_gen_dir/${snapshot[0]}.dart.snapshot" ]
122 outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
123 }
124 }
125
126 group("copy_snapshots") {
127 deps = [
128 ":copy_analysis_server_snapshot",
129 ":copy_dartanalyzer_snapshot",
130 ":copy_dartfmt_snapshot",
131 ":copy_pub_snapshot",
132 ]
133 }
134
135 copy("copy_analysis_summaries") {
136 deps = [
137 ":copy_libraries",
138 "../utils/dartanalyzer:generate_summary_spec",
139 "../utils/dartanalyzer:generate_summary_strong",
140 ]
141 sources = [
142 "$root_gen_dir/spec.sum",
143 "$root_gen_dir/strong.sum",
144 ]
145 outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
146 }
147
148 copy("copy_headers") {
149 sources = [
150 "../runtime/include/dart_api.h",
151 "../runtime/include/dart_mirrors_api.h",
152 "../runtime/include/dart_native_api.h",
153 "../runtime/include/dart_tools_api.h",
154 ]
155 outputs = [ "$root_out_dir/dart-sdk/include/{{source_file_part}}" ]
156 }
157
158 copy("copy_platform_files") {
159 sources = [
160 "lib/dart_client.platform",
161 "lib/dart_server.platform",
162 "lib/dart_shared.platform",
163 ]
164 outputs = [ "$root_out_dir/dart-sdk/lib/{{source_file_part}}" ]
165 }
166
167 copy_tree("copy_pub_assets") {
168 deps = [ ":copy_libraries" ]
169 source = "../third_party/pkg/pub/lib/src/asset"
170 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
171 }
172
173 _libraries = [
174 "_internal",
175 "async",
176 "collection",
177 "convert",
178 "core",
179 "developer",
180 "internal",
181 "io",
182 "isolate",
183 "math",
184 "mirrors",
185 "profiler",
186 "typed_data",
187 ]
188
189 foreach(library, _libraries) {
190 copy_tree("copy_${library}_library") {
191 source = "lib/$library"
192 dest = "$root_out_dir/dart-sdk/lib/$library"
193 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
194 }
195 }
196
197 group("copy_libraries") {
198 deps = [
199 ":copy__internal_library",
200 ":copy_async_library",
201 ":copy_collection_library",
202 ":copy_convert_library",
203 ":copy_core_library",
204 ":copy_developer_library",
205 ":copy_internal_library",
206 ":copy_io_library",
207 ":copy_isolate_library",
208 ":copy_math_library",
209 ":copy_mirrors_library",
210 ":copy_profiler_library",
211 ":copy_typed_data_library",
212 ]
213 }
214
215 action("write_version_file") {
216 output = "$root_out_dir/dart-sdk/version"
217 outputs = [ output ]
218 script = "../tools/write_version_file.py"
219 args = [
220 "--output",
221 rebase_path(output),
222 ]
223 }
224
225 action("write_revision_file") {
226 output = "$root_out_dir/dart-sdk/revision"
227 outputs = [ output ]
228 script = "../tools/write_revision_file.py"
229 args = [
230 "--output",
231 rebase_path(output)
232 ]
233 }
234
235 copy("copy_readme") {
236 sources = [ "../README.dart-sdk" ]
237 outputs = [ "$root_out_dir/dart-sdk/README" ]
238 }
239
240
241 copy("copy_license") {
242 sources = [ "../LICENSE" ]
243 outputs = [ "$root_out_dir/dart-sdk/LICENSE" ]
244 }
245
246
247 copy("copy_api_readme") {
248 sources = [ "api_readme.md" ]
249 outputs = [ "$root_out_dir/dart-sdk/lib/api_readme.md" ]
250 }
251
252
253 group("create_sdk") {
254 deps = [
255 ":copy_analysis_summaries",
256 ":copy_api_readme",
257 ":copy_dart",
258 ":copy_headers",
259 ":copy_libraries",
260 ":copy_license",
261 ":copy_platform_files",
262 ":copy_pub_assets",
263 ":copy_readme",
264 ":copy_scripts",
265 ":copy_snapshots",
266 ":write_revision_file",
267 ":write_version_file",
268 ]
269 if (is_fuchsia_host && is_linux) {
270 deps += [ ":copy_dylibs" ]
271 }
272 }
273
274 } else {
275
276 action("create_sdk") {
277 deps = [
278 "../runtime/bin:dart",
279 "../utils/analysis_server",
280 "../utils/compiler:dart2js",
281 "../utils/compiler:utils_wrapper",
282 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
283 "../utils/dartanalyzer:generate_summary_spec",
284 "../utils/dartanalyzer:generate_summary_strong",
285 "../utils/dartdevc",
286 "../utils/dartdoc",
287 "../utils/dartfmt",
288 "../utils/pub",
289 ]
290
291 sdk_lib_files = exec_script("../tools/list_dart_files.py",
292 [
293 "absolute",
294 rebase_path("lib"),
295 ],
296 "list lines")
297
298 preamble_files =
299 exec_script("../tools/list_files.py",
300 [
301 "absolute",
302 "",
303 rebase_path("lib/_internal/js_runtime/lib/preambles"),
304 ],
305 "list lines")
306
307 sdk_bin_files = exec_script("../tools/list_files.py",
308 [
309 "absolute",
310 "",
311 rebase_path("bin"),
312 ],
313 "list lines")
314
315 inputs = sdk_lib_files + preamble_files + sdk_bin_files + [
316 "lib/dart_client.platform",
317 "lib/dart_server.platform",
318 "lib/dart_shared.platform",
319 "$root_gen_dir/dart2js.dart.snapshot",
320 "$root_gen_dir/utils_wrapper.dart.snapshot",
321 "$root_gen_dir/pub.dart.snapshot",
322 "$root_gen_dir/dartanalyzer.dart.snapshot",
323 "$root_gen_dir/dartdevc.dart.snapshot",
324 "$root_gen_dir/dartfmt.dart.snapshot",
325 "$root_gen_dir/analysis_server.dart.snapshot",
326 "$root_gen_dir/dartdoc.dart.snapshot",
327 "$root_gen_dir/spec.sum",
328 "$root_gen_dir/strong.sum",
329 "../tools/VERSION",
330 ]
331
332 outputs = [
333 "$root_out_dir/dart-sdk/README",
334 ]
335
336 script = "../tools/create_sdk.py"
337 args = [
338 "--sdk_output_dir",
339 rebase_path("$root_out_dir/dart-sdk"),
340 "--snapshot_location",
341 rebase_path("$root_gen_dir"),
342 ]
343 }
344
345 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | tools/copy_tree.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698