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

Commit 553969c

Browse files
committed
Merge pull request #127 from abarth/improve_readme
Improve developer-facing READMEs
2 parents 11b2dd8 + b20b12f commit 553969c

File tree

5 files changed

+50
-182
lines changed

5 files changed

+50
-182
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
Contributing to Sky Engine
2-
==========================
1+
Contributing to Sky
2+
===================
3+
4+
[![Build Status](https://travis-ci.org/domokit/sky_engine.svg)](https://travis-ci.org/domokit/sky_engine)
35

46
Getting the code
57
----------------

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
Sky
22
===
33

4-
[![Build Status](https://travis-ci.org/domokit/sky_engine.svg)](https://travis-ci.org/domokit/sky_engine)
5-
64
Sky is a new way to build high performance, cross platform mobile apps.
75
More specifically, Sky is a rendering engine, a scripting engine, an
86
(optional) framework, and a (optional) set of Material Design widgets.
97
Sky is optimized for today's, and tomorrow's, mobile devices. We are focused
108
on low-latency input, high frame rates, and we are purely mobile first.
119

12-
For information about using the latest stable release of Sky, please
13-
see the [Sky SDK README](sky/sdk/README.md).
10+
- For information about using Sky to build apps, please see
11+
[Getting Started with Sky](sky/sdk/README.md).
1412

15-
For information about contributing to Sky, please see
16-
[CONTRIBUTING.md](CONTRIBUTING.md).
13+
- For information about contributing to Sky, please see
14+
[CONTRIBUTING.md](CONTRIBUTING.md).

sky/sdk/README.md

Lines changed: 41 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,38 @@
1-
Contributing
2-
============
3-
4-
This SDK is generated from the
5-
[Sky repository](https://github.com/domokit/sky_engine) using
6-
[deploy_sdk.py](https://github.com/domokit/sky_engine/blob/master/sky/tools/deploy_sdk.py).
7-
Static files (including this README.md) are located under
8-
[sky/sdk](https://github.com/domokit/sky_engine/tree/master/sky/sdk).
9-
10-
Pull
11-
requests and issue reports are gladly accepted at the
12-
[Sky repository](https://github.com/domokit/sky_engine)!
13-
14-
Sky
15-
===
16-
17-
Sky is an experimental, high-performance UI framework for mobile apps. Sky helps
18-
you create apps with beautiful user interfaces and high-quality interactive
19-
design that run smoothly at 120 Hz.
20-
21-
Sky consists of two components:
22-
23-
1. *The Sky engine.* The engine is the core of the system. Written in C++, the
24-
engine provides the muscle of the Sky system. The engine provides
25-
several primitives, including a soft real-time scheduler and a hierarchical,
26-
retained-mode graphics system, that let you build high-quality apps.
27-
28-
2. *The Sky framework.* The [framework](packages/sky/lib/framework) makes it
29-
easy to build apps using Sky by providing familiar user interface widgets,
30-
such as buttons, infinite lists, and animations, on top of the engine using
31-
Dart. These extensible components follow a functional programming style
32-
inspired by [React](http://facebook.github.io/react/).
33-
34-
We're still iterating on Sky heavily, which means the framework and underlying
35-
engine are both likely to change in incompatible ways several times, but if
36-
you're interested in trying out the system, this document can help you get
37-
started.
38-
39-
Examples
40-
--------
41-
42-
Sky uses Dart and Sky applications are
43-
[Dart Packages](https://www.dartlang.org/docs/tutorials/shared-pkgs/).
44-
Application creation starts by creating a new directory and
1+
Getting Started with Sky
2+
========================
3+
4+
Sky apps are written in Dart. To get started, we need to set up Dart SDK:
5+
6+
- Install the [Dart SDK](https://www.dartlang.org/downloads/).
7+
- Ensure that `$DART_SDK` is set to the path of your Dart SDK.
8+
9+
Once we have the Dart SDK, we can creating a new directory and
4510
adding a [pubspec.yaml](https://www.dartlang.org/tools/pub/pubspec.html):
4611

47-
pubspec.yaml for your app:
4812
```yaml
4913
name: your_app_name
5014
dependencies:
5115
sky: any
5216
```
5317
5418
Once the pubspec is in place, create a `lib` directory (where your dart code
55-
will go), ensure that the 'dart' and 'pub' executables are on your $PATH and
19+
will go) ensure that the 'dart' and 'pub' executables are on your $PATH and
5620
run the following:
5721

58-
`pub get && pub run sky:init`.
22+
- `mkdir lib`
23+
- `pub get && pub run sky:init`
5924

6025
Currently the Sky Engine assumes the entry point for your application is a
61-
`main` function in a Dart file inside your package:
26+
`main` function in `lib/main.dart`:
6227

6328
```dart
6429
import 'package:sky/widgets/basic.dart';
6530
6631
class HelloWorldApp extends App {
6732
Widget build() {
68-
return new Text('Hello, world!');
33+
return new Center(
34+
child: new Text('Hello, world!')
35+
);
6936
}
7037
}
7138
@@ -78,137 +45,58 @@ Execution starts in `main`, which instructs the framework to run a new
7845
instance of the `HelloWorldApp`. The framework then calls the `build()`
7946
function on `HelloWorldApp` to create a tree of widgets, some of which might
8047
be other `Components`, which in turn have `build()` functions that generate
81-
more widgets iteratively to create the widget hierarchy.
82-
83-
Later, if a `Component` changes state, the framework calls that component's
84-
`build()` function again to create a new widget tree. The framework diffs the
85-
new widget tree against the old widget tree and any differences are applyed
86-
to the underlying render tree.
87-
88-
* To learn more about the widget system, please see the
89-
[widgets tutorial](lib/widgets/README.md).
90-
* To learn how to run Sky on your device, please see the
91-
[Running a Sky application](#running-a-sky-application) section in this
92-
document.
93-
* To dive into examples, please see the [examples directory](example/).
94-
95-
Services
96-
--------
97-
98-
Sky apps can access services from the host operating system using Mojo IPC. For
99-
example, you can access the network using the `network_service.mojom` interface.
100-
Although you can use these low-level interfaces directly, you might prefer to
101-
access these services via libraries in the framework. For example, the
102-
`fetch.dart` library wraps the underlying `network_service.mojom` in an
103-
ergonomic interface:
104-
105-
```dart
106-
import 'package:sky/mojo/net/fetch.dart';
107-
108-
main() async {
109-
Response response = await fetchBody('example.txt');
110-
print(response.bodyAsString());
111-
}
112-
```
113-
114-
Set up your computer
115-
--------------------
48+
more widgets iteratively to create the widget hierarchy. To learn more about
49+
the widget system, please see the [widgets tutorial](lib/widgets/README.md).
11650

117-
1. Install the Dart SDK:
118-
- https://www.dartlang.org/tools/download.html
119-
120-
2. Install the `adb` tool from the Android SDK:
121-
- https://developer.android.com/sdk/installing/index.html
122-
123-
3. Ensure that `$DART_SDK` is set to the path of your Dart SDK and `adb`
124-
(inside `platform-tools` in the android sdk) is in your `$PATH`.
125-
126-
Set up your device
127-
------------------
51+
Setup your Android device
52+
-------------------------
12853

12954
Currently Sky requires an Android device running the Lollipop (or newer) version
13055
of the Android operating system.
13156

132-
1. Enable developer mode on your device by visiting `Settings > About phone`
57+
- Install the `adb` tool from the [Android SDK](https://developer.android.com/sdk/installing/index.html)
58+
and ensure that `adb (inside `platform-tools` in the Android SDK) is in your
59+
`$PATH`.
60+
61+
- Enable developer mode on your device by visiting `Settings > About phone`
13362
and tapping the `Build number` field five times.
13463

135-
2. Enable `USB debugging` in `Settings > Developer options`.
64+
- Enable `USB debugging` in `Settings > Developer options`.
13665

137-
3. Using a USB cable, plug your phone into your computer. If prompted on your
66+
- Using a USB cable, plug your phone into your computer. If prompted on your
13867
device, authorize your computer to access your device.
13968

14069
Running a Sky application
14170
-------------------------
14271

14372
The `sky` pub package includes a `sky_tool` script to assist in running
14473
Sky applications inside the `SkyDemo.apk` harness. The `sky_tool` script
145-
expects to be run from the root directory of your application pub package. To
146-
run one of the examples in this SDK, try:
74+
expects to be run from the root directory of your application's package (i.e.,
75+
the same directory that contains the `pubspec.yaml` file). To run your app,
76+
follow these instructions:
14777

148-
1. `cd example/stocks`
149-
150-
2. `pub get` to set up a copy of the sky package in the app directory.
151-
152-
3. `./packages/sky/sky_tool start` to start the dev server and upload your
78+
- `./packages/sky/sky_tool start` to start the dev server and upload your
15379
app to the device.
15480
(NOTE: add a `--install` flag to install `SkyDemo.apk` if it is not already
15581
installed on the device.)
15682

157-
4. Use `adb logcat` to view any errors or Dart `print()` output from the app.
83+
- Use `adb logcat` to view any errors or Dart `print()` output from the app.
15884
`adb logcat -s sky` can be used to filter only adb messages from
15985
`SkyDemo.apk`.
16086

161-
Measuring Performance
162-
---------------------
163-
164-
Sky has support for generating trace files compatible with
165-
[Chrome's about:tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool).
166-
167-
`packages/sky/sky_tool start_tracing` and `packages/sky/sky_tool stop_tracing`
168-
are the commands to use.
87+
Building a standalone APK
88+
-------------------------
16989

170-
Due to https://github.com/domokit/mojo/issues/127 tracing currently
171-
requires root access on the device.
90+
Although it is possible to build a standalone APK containing your application,
91+
doing so right now is difficult. If you're feeling brave, you can see how we
92+
build the `Stocks.apk` in [example/stocks](example/stocks). Eventually we plan
93+
to make this much easier and support platforms other than Android, but that work
94+
still in progress.
17295

17396
Debugging
17497
---------
17598

17699
Sky uses [Observatory](https://www.dartlang.org/tools/observatory/) for
177100
debugging and profiling. While running your Sky app using `sky_tool`, you can
178-
access Observatory by navigating your web browser to http://localhost:8181/.
179-
180-
Building a standalone MyApp
181-
---------------------------
182-
183-
Although it is possible to bundle the Sky Engine in your own app (instead of
184-
running your code inside SkyDemo.apk), right now doing so is difficult.
185-
186-
There is one example of doing so if you're feeling brave:
187-
https://github.com/domokit/sky_engine/tree/master/sky/sdk/example/stocks
188-
189-
Eventually we plan to make this much easier and support platforms other than
190-
Android, but that work is yet in progress.
191-
192-
Adding Services to MyApp
193-
------------------------
194-
195-
[Mojo IPC](https://github.com/domokit/mojo) is an inter-process-communication
196-
system designed to provide cross-thread, cross-process, and language-agnostic
197-
communication between applications. Sky uses Mojo IPC to make it possible
198-
to write UI code in Dart and yet depend on networking code, etc. written in
199-
another language. Services are replicable, meaning that Dart code
200-
written to use the `network_service` remains portable to any platform
201-
(iOS, Android, etc.) by simply providing a 'natively' written `network_service`.
202-
203-
Embedders of the Sky Engine and consumers of the Sky Framework can use this
204-
same mechanism to expose not only existing services like the
205-
[Keyboard](https://github.com/domokit/mojo/blob/master/mojo/services/keyboard/public/interfaces/keyboard.mojom)
206-
service to allow Sky Framework Dart code to interface with the underlying
207-
platform's Keyboard, but also to expose any additional non-Dart business logic
208-
to Sky/Dart UI code.
209-
210-
As an example, [SkyApplication](https://github.com/domokit/sky_engine/blob/master/sky/shell/org/domokit/sky/shell/SkyApplication.java)
211-
exposes a mojo `network_service` (required by Sky Engine C++ code)
212-
[SkyDemoApplication](https://github.com/domokit/sky_engine/blob/master/sky/apk/demo/org/domokit/sky/demo/SkyDemoApplication.java)
213-
additionally exposes `keyboard_service` and `sensor_service` for use by the Sky
214-
Framework from Dart.
101+
access Observatory by navigating your web browser to
102+
[http://localhost:8181/](http://localhost:8181/).

sky/tools/big_red_button.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def main():
8484
run(sky_engine_root, [
8585
'sky/tools/deploy_sdk.py',
8686
'--non-interactive',
87-
'--commit',
8887
sky_sdk_root
8988
])
9089
# tag for version?
@@ -104,4 +103,4 @@ def main():
104103

105104

106105
if __name__ == '__main__':
107-
sys.exit(main())
106+
sys.exit(main())

sky/tools/deploy_sdk.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def main():
8686
parser.add_argument('--build-dir', action='store', type=str,
8787
default=os.path.join(SRC_ROOT, DEFAULT_REL_BUILD_DIR))
8888
parser.add_argument('--non-interactive', action='store_true')
89-
parser.add_argument('--commit', action='store_true')
9089
args = parser.parse_args()
9190

9291
build_dir = os.path.abspath(args.build_dir)
@@ -95,8 +94,6 @@ def main():
9594
print 'Building SDK from %s into %s' % (build_dir, sdk_root)
9695
start_time = datetime.now()
9796

98-
should_commit = args.commit
99-
10097
def sdk_path(rel_path):
10198
return os.path.join(sdk_root, rel_path)
10299

@@ -120,22 +117,6 @@ def src_path(rel_path):
120117
subprocess.check_call([src_path('tools/licenses.py'), 'credits'],
121118
stdout=license_file)
122119

123-
if should_commit:
124-
# Kinda a hack to make a prettier build dir for the commit:
125-
script_path = os.path.relpath(os.path.abspath(__file__), SRC_ROOT)
126-
rel_build_dir = os.path.relpath(build_dir, SRC_ROOT)
127-
revision = git_revision()
128-
commit_url = "https://github.com/domokit/mojo/commit/%s" % revision
129-
pattern = """Autogenerated from %s
130-
Using %s and build output from %s.
131-
"""
132-
commit_message = pattern % (commit_url, script_path, rel_build_dir)
133-
subprocess.check_call(['git', 'add', '.'], cwd=sdk_root)
134-
subprocess.check_call([
135-
'git', 'commit',
136-
'-m', commit_message
137-
], cwd=sdk_root)
138-
139120
time_delta = datetime.now() - start_time
140121
print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds())
141122

0 commit comments

Comments
 (0)