Skip to content

Commit

Permalink
Merge pull request #402 from dart-lang/callable-pages
Browse files Browse the repository at this point in the history
Callable pages
  • Loading branch information
sethladd committed Apr 16, 2015
2 parents 9f88216 + a062f4f commit c9a7fcb
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'src/model_utils.dart';
const String NAME = 'dartdoc';

// Update when pubspec version changes
const String VERSION = '0.0.1+4';
const String VERSION = '0.0.1+5';

/// Initialize and setup the generators
List<Generator> initGenerators(
Expand Down
4 changes: 4 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ packages:
description: intl
source: hosted
version: "0.12.2"
librato:
description: librato
source: hosted
version: "0.0.2+1"
logging:
description: logging
source: hosted
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dartdoc
version: 0.0.1+4
version: 0.0.1+5
author: Dart Team <misc@dartlang.org>
description: A documentation generator for Dart.
homepage: https://github.com/dart-lang/dartdoc
Expand All @@ -22,5 +22,6 @@ dependencies:
dev_dependencies:
grinder: '^0.6.0'
unittest: '^0.11.0'
librato: any
executables:
dartdoc: null
4 changes: 4 additions & 0 deletions test/fake_package/lib/fake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,7 @@ const greatAnnotation = 'great';

/// This is the greatest thing.
const greatestAnnotation = 'greatest';

/// This function has two parameters that are functions.
String functionWithFunctionParameters(int number, void thing(one, two),
String string, Future asyncThing(three, four, five, six, seven)) {}
37 changes: 35 additions & 2 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
// license that can be found in the LICENSE file.

import 'dart:io';
import 'dart:async' show Future;

import 'package:grinder/grinder.dart';
import 'package:path/path.dart' as path;
import 'package:dartdoc/src/io_utils.dart';
import 'package:librato/librato.dart';

final Directory DOC_DIR = new Directory('docs');

Expand Down Expand Up @@ -44,11 +46,13 @@ analyze(GrinderContext context) {
fatalWarnings: true);
}

buildSdkDocs(GrinderContext context) {
Future buildSdkDocs(GrinderContext context) async {
if (DOC_DIR.existsSync()) DOC_DIR.deleteSync(recursive: true);
context.log('building SDK docs');
try {
runDartScript(context, 'bin/dartdoc.dart', arguments: ['--sdk-docs']);
int sdkDocsGenTime = _runTimed(() {
runDartScript(context, 'bin/dartdoc.dart', arguments: ['--sdk-docs']);
});
var indexHtml = joinFile(DOC_DIR, ['index.html']);
if (!indexHtml.existsSync()) {
context.fail('no index.html found for SDK docs');
Expand All @@ -64,6 +68,8 @@ buildSdkDocs(GrinderContext context) {
if (!futureConstFile.existsSync()) {
context.fail('no Future.html found for dart:async Future constructor');
}

return _uploadStats(context, sdkDocsGenTime);
} catch (e) {
rethrow;
}
Expand Down Expand Up @@ -92,3 +98,30 @@ indexResources(GrinderContext context) {
buffer.write('\n];\n');
out.writeAsString(buffer.toString());
}

int _runTimed(callback()) {
var stopwatch = new Stopwatch()..start();
callback();
stopwatch.stop();
return stopwatch.elapsedMilliseconds;
}

Future _uploadStats(GrinderContext context, int sdkDocsGenTime) async {
Map env = Platform.environment;

if (env.containsKey('LIBRATO_USER') && env.containsKey('TRAVIS_COMMIT')) {
Librato librato = new Librato.fromEnvVars();
context.log('Uploading stats to ${librato.baseUrl}');
LibratoStat sdkDocsGenTimeStat =
new LibratoStat('sdk-docs-gen-time', sdkDocsGenTime);
await librato.postStats([sdkDocsGenTimeStat]);
String commit = env['TRAVIS_COMMIT'];
LibratoLink link = new LibratoLink(
'github', 'https://github.com/dart-lang/dart-pad/commit/${commit}');
LibratoAnnotation annotation = new LibratoAnnotation(commit,
description: 'Commit ${commit}', links: [link]);
return librato.createAnnotation('build_ui', annotation);
} else {
return true;
}
}

0 comments on commit c9a7fcb

Please sign in to comment.