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
4510adding a [ pubspec.yaml] ( https://www.dartlang.org/tools/pub/pubspec.html ) :
4611
47- pubspec.yaml for your app:
4812``` yaml
4913name : your_app_name
5014dependencies :
5115 sky : any
5216` ` `
5317
5418Once 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
5620run the following :
5721
58- ` pub get && pub run sky:init` .
22+ - ` mkdir lib`
23+ - ` pub get && pub run sky:init`
5924
6025Currently 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
6429import 'package:sky/widgets/basic.dart';
6530
6631class 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
7845instance of the `HelloWorldApp`. The framework then calls the `build()`
7946function on `HelloWorldApp` to create a tree of widgets, some of which might
8047be 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
12954Currently Sky requires an Android device running the Lollipop (or newer) version
13055of 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
14069Running a Sky application
14170-------------------------
14271
14372The `sky` pub package includes a `sky_tool` script to assist in running
14473Sky 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
17396Debugging
17497---------
17598
17699Sky uses [Observatory](https://www.dartlang.org/tools/observatory/) for
177100debugging 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/).
0 commit comments