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

Commit 9b5ffa7

Browse files
committed
Merge pull request #457 from eseidelGoogle/docs
Add a few bits of documentation to package:sky
2 parents a2db58f + 50251ab commit 9b5ffa7

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

sky/packages/sky/lib/mojo/activity.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import 'package:sky_services/activity/activity.mojom.dart';
99

1010
export 'package:sky_services/activity/activity.mojom.dart' show Intent, ComponentName, StringExtra;
1111

12+
/// Dart wrapper around Activity mojo service available in Sky on Android.
13+
///
14+
/// Most clients will want to use these methods instead of the activity service
15+
/// directly.
16+
1217
const int NEW_DOCUMENT = 0x00080000;
1318
const int NEW_TASK = 0x10000000;
1419
const int MULTIPLE_TASK = 0x08000000;
@@ -24,15 +29,17 @@ final ActivityProxy _activity = _initActivity();
2429
Color _cachedPrimaryColor;
2530
String _cachedLabel;
2631

27-
32+
/// Ends the current activity.
2833
void finishCurrentActivity() {
2934
_activity.ptr.finishCurrentActivity();
3035
}
3136

37+
/// Asks the Android ActivityManager to start a new Intent-based Activity.
3238
void startActivity(Intent intent) {
3339
_activity.ptr.startActivity(intent);
3440
}
3541

42+
/// Sets the TaskDescription for the current Activity
3643
void updateTaskDescription(String label, Color color) {
3744
if (_cachedPrimaryColor == color && _cachedLabel == label)
3845
return;

sky/packages/sky/lib/widgets.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
/// Includes and re-exports all Sky widgets classes.
6+
57
export 'widgets/animated_component.dart';
68
export 'widgets/animated_container.dart';
79
export 'widgets/basic.dart';

sky/tools/skydoc.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
import os
88
import subprocess
99
import sys
10+
import webbrowser
11+
from skypy.url_mappings import URLMappings
1012

1113
SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
1214
SKY_ROOT = os.path.dirname(SKY_TOOLS_DIR)
1315
SRC_ROOT = os.path.dirname(SKY_ROOT)
1416
WORKBENCH_ROOT = os.path.join(SRC_ROOT, 'sky', 'packages', 'workbench')
1517

16-
from skypy.url_mappings import URLMappings
17-
18-
1918
DARTDOC = 'dartdoc'
2019

20+
2121
def main():
2222
try:
2323
subprocess.check_output([DARTDOC, '--version'])
@@ -27,20 +27,32 @@ def main():
2727

2828
parser = argparse.ArgumentParser(description='Sky Documentation Generator')
2929
parser.add_argument('build_dir', type=str, help='Path to build output')
30+
parser.add_argument('--open', action='store_true',
31+
help='Open docs after building.')
3032
args = parser.parse_args()
3133

3234
build_dir = os.path.abspath(args.build_dir)
3335

3436
sky_package = os.path.join(SRC_ROOT, 'sky/packages/sky')
3537
doc_dir = os.path.join(build_dir, 'gen/dart-pkg/sky/doc')
38+
39+
# dartdoc doesn't understand sdk_ext yet, so we still need url_mappings:
40+
# https://github.com/dart-lang/dartdoc/issues/763
3641
url_mappings = URLMappings(SRC_ROOT, build_dir)
3742

3843
analyzer_args = [
3944
DARTDOC,
4045
'--input', sky_package,
4146
'--output', doc_dir,
47+
# dartdoc appears to ignore --package-root:
48+
# https://github.com/dart-lang/dartdoc/issues/766
49+
'--package-root', os.path.join(WORKBENCH_ROOT, 'packages')
4250
] + url_mappings.as_args
4351
subprocess.check_call(analyzer_args)
4452

53+
if args.open:
54+
webbrowser.open(os.path.join(doc_dir, 'index.html'))
55+
56+
4557
if __name__ == '__main__':
4658
sys.exit(main())

0 commit comments

Comments
 (0)