Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 01ff5c3

Browse files
committed
Merge history from sky/ directory in https://github.com/domokit/mojo/
2 parents d265041 + a64559a commit 01ff5c3

File tree

2,662 files changed

+447338
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,662 files changed

+447338
-0
lines changed

sky/BUILD.gn

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2014 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+
group("sky") {
6+
testonly = true
7+
8+
deps = [
9+
"//sky/engine/platform:platform_unittests",
10+
"//sky/engine/wtf:unittests",
11+
"//sky/sdk/example",
12+
"//sky/tools/imagediff",
13+
"//sky/tools/packager($host_toolchain)",
14+
":sky_dev",
15+
]
16+
17+
if (!is_android) {
18+
deps += [ "//third_party/mesa:osmesa" ]
19+
}
20+
}
21+
22+
group("sky_dev") {
23+
testonly = true
24+
25+
deps = [
26+
"//sky/sdk",
27+
]
28+
29+
if (is_android) {
30+
deps += [ "//sky/services/activity" ]
31+
}
32+
33+
if (is_linux) {
34+
deps += [ "//sky/shell" ]
35+
}
36+
}

sky/HACKING.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Hacking on Sky
2+
==============
3+
4+
Building
5+
--------
6+
7+
* Follow the setup & build instructions for [Mojo](https://github.com/domokit/mojo)
8+
9+
The build directory will be `out/Debug` for Linux debug builds, and
10+
`out/Release` for Linux release builds. For Android builds, prefix
11+
`android_`, as in, `android_Debug`.
12+
13+
For Sky on iOS, you can try following these [experimental instructions](https://docs.google.com/document/d/1qm8Vvyz8Mngw6EsSg4FELQ7FOegjBJ5Itg9OBJGN5JM/edit#heading=h.ikz9bdwswdct).
14+
15+
Running applications
16+
--------------------
17+
18+
To run an application on your device, run:
19+
20+
* `mojo/devtools/common/mojo_shell --sky [url] --android`
21+
22+
When the shell is running, `mojo/devtools/common/debugger` allows you to
23+
collect traces, symbolize stack crashes and attach gdb if needed. Refer to the
24+
[documentation](https://github.com/domokit/mojo#debugging-tracing-profiling)
25+
for the details.
26+
27+
Running tests
28+
-------------
29+
30+
Tests are only supported on Linux currently.
31+
32+
* ``sky/tools/test_sky --debug``
33+
* This runs the tests against ``//out/Debug``. If you want to run against
34+
``//out/Release``, omit the ``--debug`` flag.
35+
36+
Running tests manually
37+
----------------------
38+
39+
Running tests manually lets you more quickly iterate during
40+
development; rather than having to compile and rerun all the tests,
41+
then trawl through the build output to find the current results, you
42+
can just run the test you're working on and reload it over and over,
43+
seeing the output right there on your console.
44+
45+
* ``sky/tools/skygo/linux64/sky_server -v -p 8000 out/Debug out/Debug/gen/dart-pkg/packages``
46+
* ``out/Debug/mojo_shell --args-for="mojo:native_viewport_service --use-headless-config --use-osmesa" --args-for"=mojo:sky_viewer --testing" --content-handlers=application/dart,mojo:sky_viewer --url-mappings=mojo:window_manager=mojo:sky_tester,mojo:surfaces_service=mojo:fake_surfaces_service mojo:window_manager``
47+
* The ``sky_tester`` should print ``#READY`` when ready
48+
* Type the URL you wish to run, for example ``http://127.0.0.1:8000/sky/tests/widgets/dialog.dart``, and press the enter key
49+
* The harness should print the results of the test. You can then type another URL.
50+
51+
Writing tests
52+
-------------
53+
54+
We recommend using the [Dart
55+
``test``](https://pub.dartlang.org/packages/test) testing framework.
56+
See [``sky/tests/raw/color_bounds.dart``](tests/raw/color_bounds.dart)
57+
for an example.
58+
59+
Debugging Sky
60+
-------------
61+
62+
This document aims to explain how to debug Sky itself.
63+
64+
### C++
65+
66+
Launch a debug Sky build on Android as usual:
67+
68+
```
69+
mojo/devtools/common/mojo_shell --sky [url] --android`
70+
```
71+
72+
and use the debugger to attach gdb:
73+
```
74+
mojo/devtools/common/debugger gdb attach
75+
```
76+
77+
Once gdb has loaded, hit `c` to continue the execution. When your app crashes,
78+
it will pause in the debugger. At that point, regular gdb commands will work:
79+
`n` to step over the current statement, `s` to step into the current statement,
80+
`f` to step out of the current block, `c` to continue until the next breakpoint
81+
or exception.
82+
83+
### Dart
84+
85+
Use Observatory.

sky/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Sky
2+
===
3+
4+
For information about using our latest stable release of Sky, please
5+
see the [Sky SDK](https://github.com/domokit/sky_sdk/) project page.
6+
7+
For more current information about the bleeding edge of the Sky
8+
framework, see [the sdk/ directory](sdk/lib/).
9+
10+
For details about the internals of Sky's engine, see [the engine/
11+
directory](engine/).
12+
13+
For information about contributing to Sky, please see
14+
[HACKING.md](HACKING.md).

sky/build/sky_app.gni

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
import("//sky/build/skyx.gni")
6+
7+
template("sky_app") {
8+
skyx_target_name = target_name
9+
10+
if (is_android) {
11+
skyx_target_name = "app"
12+
}
13+
14+
skyx(skyx_target_name) {
15+
main_dart = invoker.main_dart
16+
17+
if (defined(invoker.manifest)) {
18+
manifest = invoker.manifest
19+
}
20+
21+
if (defined(invoker.sources)) {
22+
sources = invoker.sources
23+
}
24+
}
25+
26+
if (is_android) {
27+
import("//build/config/android/rules.gni")
28+
29+
bundle_prefix = target_name
30+
31+
copy("copy_${bundle_prefix}_bundle") {
32+
sources = [
33+
"$target_gen_dir/app.skyx",
34+
]
35+
outputs = [
36+
"$target_gen_dir/${bundle_prefix}.skyx",
37+
]
38+
39+
deps = [
40+
":app",
41+
]
42+
}
43+
44+
copy_ex("assets") {
45+
clear_dir = true
46+
dest = "$target_gen_dir/assets"
47+
48+
sources = [
49+
"$root_build_dir/icudtl.dat",
50+
"$target_gen_dir/app.skyx",
51+
]
52+
deps = [
53+
"//third_party/icu",
54+
":copy_${bundle_prefix}_bundle",
55+
]
56+
57+
if (defined(invoker.bundles)) {
58+
foreach(bundle, invoker.bundles) {
59+
bundle_gen_dir = get_label_info(bundle, "target_gen_dir")
60+
bundle_name = get_label_info(bundle, "name")
61+
sources += [ "$bundle_gen_dir/${bundle_name}.skyx" ]
62+
deps += [ bundle ]
63+
}
64+
}
65+
}
66+
67+
android_apk(target_name) {
68+
apk_name = invoker.apk_name
69+
android_manifest = "apk/AndroidManifest.xml"
70+
71+
native_libs = [ "libsky_shell.so" ]
72+
asset_location = "$target_gen_dir/assets"
73+
74+
deps = [
75+
"//base:base_java",
76+
"//sky/shell:assets",
77+
"//sky/shell:java",
78+
"//sky/shell:sky_shell",
79+
":assets",
80+
]
81+
82+
if (defined(invoker.deps)) {
83+
deps += invoker.deps
84+
}
85+
}
86+
}
87+
}

sky/build/skyx.gni

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
package_root = "$root_gen_dir/dart-pkg/packages"
6+
7+
template("skyx") {
8+
bundle_prefix = target_name
9+
bundle = "$target_gen_dir/${bundle_prefix}.skyx"
10+
snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin"
11+
12+
action("gen_${bundle_prefix}_snapshot") {
13+
main_dart = invoker.main_dart
14+
15+
inputs = [
16+
main_dart,
17+
]
18+
outputs = [
19+
snapshot,
20+
]
21+
22+
if (defined(invoker.sources)) {
23+
inputs += sources
24+
}
25+
26+
sky_packager_dir =
27+
get_label_info("//sky/tools/packager($host_toolchain)", "root_out_dir")
28+
29+
script = "//sky/tools/sky_packager.py"
30+
31+
src_dir = "//"
32+
cwd = rebase_path(src_dir, root_build_dir)
33+
34+
args = [
35+
rebase_path("$sky_packager_dir/sky_packager", src_dir),
36+
rebase_path(main_dart, src_dir),
37+
"--package-root",
38+
rebase_path(package_root, src_dir),
39+
"--snapshot",
40+
rebase_path(snapshot, src_dir),
41+
"-C",
42+
cwd,
43+
]
44+
45+
deps = [
46+
"//sky/tools/packager($host_toolchain)",
47+
"//sky/sdk",
48+
]
49+
50+
if (defined(invoker.deps)) {
51+
deps += invoker.deps
52+
}
53+
}
54+
55+
action("gen_${bundle_prefix}_bundle") {
56+
asset_base = "$package_root/sky/assets/material-design-icons"
57+
58+
sources = [
59+
"//sky/tools/skyx/bin/skyx.dart",
60+
snapshot,
61+
]
62+
63+
outputs = [
64+
bundle,
65+
]
66+
67+
script = "//sky/tools/skyx.py"
68+
args = [
69+
"--package-root",
70+
rebase_path(package_root, root_build_dir),
71+
"--asset-base",
72+
rebase_path(asset_base, root_build_dir),
73+
"--snapshot",
74+
rebase_path(snapshot, root_build_dir),
75+
"-o",
76+
rebase_path(bundle, root_build_dir),
77+
]
78+
79+
if (defined(invoker.manifest)) {
80+
sources += [ invoker.manifest ]
81+
args += [
82+
"--manifest",
83+
rebase_path(invoker.manifest, root_build_dir),
84+
]
85+
}
86+
87+
deps = [
88+
":gen_${bundle_prefix}_snapshot",
89+
"//third_party/dart-pkg",
90+
]
91+
}
92+
93+
group(target_name) {
94+
deps = [
95+
":gen_${bundle_prefix}_bundle",
96+
]
97+
}
98+
}

0 commit comments

Comments
 (0)