OLD | NEW |
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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/android/rules.gni") | 6 import("//build/config/android/rules.gni") |
7 | 7 |
| 8 declare_args() { |
| 9 # Controls whether we build app.skyx bundles in the sky_app template below. |
| 10 # An app.skyx bundle contains all the code an resources needed to run a Sky |
| 11 # app offline. Unfortunately, we don't yet have all the Dart packages we need |
| 12 # to create skyx packages installed on the build bots, so this functionality |
| 13 # is currently disabled. This flag allows for local testing of this feature. |
| 14 enable_skyx = false |
| 15 } |
| 16 |
8 package_root = "$root_gen_dir/dart-pkg/packages" | 17 package_root = "$root_gen_dir/dart-pkg/packages" |
9 | 18 |
10 template("sky_apk") { | 19 template("sky_apk") { |
11 android_apk(target_name) { | 20 android_apk(target_name) { |
12 apk_name = invoker.apk_name | 21 apk_name = invoker.apk_name |
13 android_manifest = invoker.android_manifest | 22 android_manifest = invoker.android_manifest |
14 | 23 |
15 native_libs = [ "libsky_shell.so" ] | 24 native_libs = [ "libsky_shell.so" ] |
16 asset_location = "$root_build_dir/sky_shell/assets" | 25 asset_location = "$root_build_dir/sky_shell/assets" |
17 | 26 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 "-C", | 65 "-C", |
57 cwd, | 66 cwd, |
58 ] | 67 ] |
59 | 68 |
60 deps = [ | 69 deps = [ |
61 "//sky/tools/packager($host_toolchain)", | 70 "//sky/tools/packager($host_toolchain)", |
62 "//sky/sdk", | 71 "//sky/sdk", |
63 ] | 72 ] |
64 } | 73 } |
65 | 74 |
66 if (defined(invoker.sky_yaml)) { | 75 app_bundle = "$target_gen_dir/app.skyx" |
67 app_bundle = "$target_gen_dir/${target_name}.skyx" | |
68 | 76 |
69 action("gen_bundle") { | 77 action("gen_bundle") { |
70 asset_base = "$package_root/sky/assets/material-design-icons" | 78 asset_base = "$package_root/sky/assets/material-design-icons" |
71 sky_yaml = invoker.sky_yaml | 79 sky_yaml = invoker.sky_yaml |
72 | 80 |
73 sources = [ | 81 sources = [ |
74 sky_yaml, | 82 "//sky/tools/skyx/bin/skyx.dart", |
75 snapshot, | 83 sky_yaml, |
76 ] | 84 snapshot, |
| 85 ] |
77 | 86 |
78 outputs = [ | 87 outputs = [ |
79 app_bundle, | 88 app_bundle, |
80 ] | 89 ] |
81 | 90 |
82 script = "//sky/tools/skyx.py" | 91 script = "//sky/tools/skyx.py" |
| 92 args = [ |
| 93 "--asset-base", |
| 94 rebase_path(asset_base, root_build_dir), |
| 95 "--snapshot", |
| 96 rebase_path(snapshot, root_build_dir), |
| 97 "-o", |
| 98 rebase_path(app_bundle, root_build_dir), |
| 99 rebase_path(sky_yaml, root_build_dir), |
| 100 ] |
83 | 101 |
84 args = [ | 102 deps = [ |
85 rebase_path(sky_yaml, root_build_dir), | 103 ":gen_snapshot", |
86 "--asset-base", | 104 ] |
87 rebase_path(asset_base, root_build_dir), | |
88 "--snapshot", | |
89 rebase_path(snapshot, root_build_dir), | |
90 "-o", | |
91 rebase_path(app_bundle, root_build_dir), | |
92 ] | |
93 | |
94 deps = [ | |
95 ":gen_snapshot", | |
96 ] | |
97 } | |
98 } | 105 } |
99 | 106 |
100 copy_ex("assets") { | 107 copy_ex("assets") { |
101 clear_dir = true | 108 clear_dir = true |
102 dest = "$target_gen_dir/assets" | 109 dest = "$target_gen_dir/assets" |
103 | 110 |
104 sources = [ | 111 sources = [ |
105 "$root_build_dir/icudtl.dat", | 112 "$root_build_dir/icudtl.dat", |
106 "$target_gen_dir/snapshot_blob.bin", | |
107 ] | 113 ] |
108 | 114 |
109 deps = [ | 115 deps = [ |
110 "//third_party/icu", | 116 "//third_party/icu", |
111 ] | 117 ] |
| 118 |
| 119 if (enable_skyx) { |
| 120 sources += [ app_bundle ] |
| 121 deps += [ ":gen_bundle" ] |
| 122 } |
112 } | 123 } |
113 | 124 |
114 android_apk(target_name) { | 125 android_apk(target_name) { |
115 apk_name = invoker.apk_name | 126 apk_name = invoker.apk_name |
116 android_manifest = "apk/AndroidManifest.xml" | 127 android_manifest = "apk/AndroidManifest.xml" |
117 | 128 |
118 native_libs = [ "libsky_shell.so" ] | 129 native_libs = [ "libsky_shell.so" ] |
119 asset_location = "$target_gen_dir/assets" | 130 asset_location = "$target_gen_dir/assets" |
120 | 131 |
121 deps = [ | 132 deps = [ |
122 "//base:base_java", | 133 "//base:base_java", |
123 "//sky/shell:assets", | 134 "//sky/shell:assets", |
124 "//sky/shell:java", | 135 "//sky/shell:java", |
125 "//sky/shell:sky_shell", | 136 "//sky/shell:sky_shell", |
126 ":assets", | 137 ":assets", |
127 ":gen_snapshot", | |
128 ] | 138 ] |
129 | 139 |
130 if (defined(invoker.deps)) { | 140 if (defined(invoker.deps)) { |
131 deps += invoker.deps | 141 deps += invoker.deps |
132 } | 142 } |
133 } | 143 } |
134 } | 144 } |
OLD | NEW |