| 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 import("//sky/build/skyx.gni") |
| 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 | |
| 17 package_root = "$root_gen_dir/dart-pkg/packages" | |
| 18 | 8 |
| 19 template("sky_apk") { | 9 template("sky_apk") { |
| 20 android_apk(target_name) { | 10 android_apk(target_name) { |
| 21 apk_name = invoker.apk_name | 11 apk_name = invoker.apk_name |
| 22 android_manifest = invoker.android_manifest | 12 android_manifest = invoker.android_manifest |
| 23 | 13 |
| 24 native_libs = [ "libsky_shell.so" ] | 14 native_libs = [ "libsky_shell.so" ] |
| 25 asset_location = "$root_build_dir/sky_shell/assets" | 15 asset_location = "$root_build_dir/sky_shell/assets" |
| 26 | 16 |
| 27 deps = [ | 17 deps = [ |
| 28 "//base:base_java", | 18 "//base:base_java", |
| 29 "//sky/shell:assets", | 19 "//sky/shell:assets", |
| 30 "//sky/shell:java", | 20 "//sky/shell:java", |
| 31 "//sky/shell:sky_shell", | 21 "//sky/shell:sky_shell", |
| 32 ] + invoker.deps | 22 ] + invoker.deps |
| 33 } | 23 } |
| 34 } | 24 } |
| 35 | 25 |
| 36 template("sky_app") { | 26 template("sky_app") { |
| 37 # Note: org.domokit.sky.shell.SkyApplication knows about 'snapshot_blob.bin'. | 27 skyx("app") { |
| 38 snapshot = "$target_gen_dir/snapshot_blob.bin" | |
| 39 | |
| 40 action("gen_snapshot") { | |
| 41 main_dart = invoker.main_dart | 28 main_dart = invoker.main_dart |
| 42 | 29 |
| 43 inputs = [ | 30 if (defined(invoker.manifest)) { |
| 44 main_dart, | 31 manifest = invoker.manifest |
| 45 ] | 32 } |
| 46 outputs = [ | |
| 47 snapshot, | |
| 48 ] | |
| 49 | 33 |
| 50 sky_packager_dir = | 34 if (defined(invoker.sources)) { |
| 51 get_label_info("//sky/tools/packager($host_toolchain)", "root_out_dir") | 35 sources = invoker.sources |
| 52 | 36 } |
| 53 script = "//sky/tools/sky_packager.py" | |
| 54 | |
| 55 src_dir = "//" | |
| 56 cwd = rebase_path(src_dir, root_build_dir) | |
| 57 | |
| 58 args = [ | |
| 59 rebase_path("$sky_packager_dir/sky_packager", src_dir), | |
| 60 rebase_path(main_dart, src_dir), | |
| 61 "--package-root", | |
| 62 rebase_path(package_root, src_dir), | |
| 63 "--snapshot", | |
| 64 rebase_path(snapshot, src_dir), | |
| 65 "-C", | |
| 66 cwd, | |
| 67 ] | |
| 68 | |
| 69 deps = [ | |
| 70 "//sky/tools/packager($host_toolchain)", | |
| 71 "//sky/sdk", | |
| 72 ] | |
| 73 } | |
| 74 | |
| 75 app_bundle = "$target_gen_dir/app.skyx" | |
| 76 | |
| 77 action("gen_bundle") { | |
| 78 asset_base = "$package_root/sky/assets/material-design-icons" | |
| 79 sky_yaml = invoker.sky_yaml | |
| 80 | |
| 81 sources = [ | |
| 82 "//sky/tools/skyx/bin/skyx.dart", | |
| 83 sky_yaml, | |
| 84 snapshot, | |
| 85 ] | |
| 86 | |
| 87 outputs = [ | |
| 88 app_bundle, | |
| 89 ] | |
| 90 | |
| 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 ] | |
| 101 | |
| 102 deps = [ | |
| 103 ":gen_snapshot", | |
| 104 ] | |
| 105 } | 37 } |
| 106 | 38 |
| 107 copy_ex("assets") { | 39 copy_ex("assets") { |
| 108 clear_dir = true | 40 clear_dir = true |
| 109 dest = "$target_gen_dir/assets" | 41 dest = "$target_gen_dir/assets" |
| 110 | 42 |
| 111 sources = [ | 43 sources = [ |
| 112 "$root_build_dir/icudtl.dat", | 44 "$root_build_dir/icudtl.dat", |
| 113 ] | 45 ] |
| 114 | |
| 115 deps = [ | 46 deps = [ |
| 116 "//third_party/icu", | 47 "//third_party/icu", |
| 117 ] | 48 ] |
| 118 | 49 |
| 119 if (enable_skyx) { | 50 if (enable_skyx) { |
| 120 sources += [ app_bundle ] | 51 sources += [ "$target_gen_dir/app.skyx" ] |
| 121 deps += [ ":gen_bundle" ] | 52 deps += [ ":app" ] |
| 122 } | 53 } |
| 123 } | 54 } |
| 124 | 55 |
| 125 android_apk(target_name) { | 56 android_apk(target_name) { |
| 126 apk_name = invoker.apk_name | 57 apk_name = invoker.apk_name |
| 127 android_manifest = "apk/AndroidManifest.xml" | 58 android_manifest = "apk/AndroidManifest.xml" |
| 128 | 59 |
| 129 native_libs = [ "libsky_shell.so" ] | 60 native_libs = [ "libsky_shell.so" ] |
| 130 asset_location = "$target_gen_dir/assets" | 61 asset_location = "$target_gen_dir/assets" |
| 131 | 62 |
| 132 deps = [ | 63 deps = [ |
| 133 "//base:base_java", | 64 "//base:base_java", |
| 134 "//sky/shell:assets", | 65 "//sky/shell:assets", |
| 135 "//sky/shell:java", | 66 "//sky/shell:java", |
| 136 "//sky/shell:sky_shell", | 67 "//sky/shell:sky_shell", |
| 137 ":assets", | 68 ":assets", |
| 138 ] | 69 ] |
| 139 | 70 |
| 140 if (defined(invoker.deps)) { | 71 if (defined(invoker.deps)) { |
| 141 deps += invoker.deps | 72 deps += invoker.deps |
| 142 } | 73 } |
| 143 } | 74 } |
| 144 } | 75 } |
| OLD | NEW |