Skip to content

Commit 280d8f3

Browse files
committed
chore: add dartdoc compliance checks to build
Closes angular#3582
1 parent 5a40501 commit 280d8f3

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
lines changed

gulpfile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var pubget = require('./tools/build/pubget');
2525
var linknodemodules = require('./tools/build/linknodemodules');
2626
var pubbuild = require('./tools/build/pubbuild');
2727
var dartanalyzer = require('./tools/build/dartanalyzer');
28+
var dartapidocs = require('./tools/build/dartapidocs');
2829
var jsserve = require('./tools/build/jsserve');
2930
var pubserve = require('./tools/build/pubserve');
3031
var karma = require('karma');
@@ -250,6 +251,11 @@ gulp.task('build/analyze.ddc.dart', dartanalyzer(gulp, gulpPlugins, {
250251
use_ddc: true
251252
}));
252253

254+
gulp.task('build/check.apidocs.dart', dartapidocs(gulp, gulpPlugins, {
255+
dest: CONFIG.dest.dart,
256+
command: DART_SDK.DARTDOCGEN
257+
}));
258+
253259
// ------------
254260
// pubbuild
255261
// WARNING: this task is very slow (~15m as of July 2015)
@@ -843,6 +849,7 @@ gulp.task('build.dart', function(done) {
843849
'build/packages.dart',
844850
'build/pubspec.dart',
845851
'build/analyze.dart',
852+
'build/check.apidocs.dart',
846853
'build.dart.material.css',
847854
sequenceComplete(done)
848855
);

modules/angular2/core.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
2323

2424
export {ElementRef} from 'angular2/src/core/compiler/element_ref';
2525
export {TemplateRef} from 'angular2/src/core/compiler/template_ref';
26-
export {RenderElementRef} from 'angular2/src/render/api';
2726
export {ViewRef, HostViewRef, ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
2827
export {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
2928
export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';

modules/angular2/src/test_lib/spies.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ import 'package:angular2/src/change_detection/change_detection.dart';
44
import 'package:angular2/di.dart';
55
import './test_lib.dart';
66

7-
@proxy()
7+
@proxy
88
class SpyChangeDetector extends SpyObject implements ChangeDetector {
99
noSuchMethod(m) => super.noSuchMethod(m);
1010
}
1111

12-
@proxy()
12+
@proxy
1313
class SpyProtoChangeDetector extends SpyObject implements ProtoChangeDetector {
1414
noSuchMethod(m) => super.noSuchMethod(m);
1515
}
1616

17-
@proxy()
17+
@proxy
1818
class SpyPipe extends SpyObject implements Pipe {
1919
noSuchMethod(m) => super.noSuchMethod(m);
2020
}
2121

22-
@proxy()
22+
@proxy
2323
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
2424
noSuchMethod(m) => super.noSuchMethod(m);
2525
}
2626

27-
@proxy()
27+
@proxy
2828
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
2929
noSuchMethod(m) => super.noSuchMethod(m);
3030
}

tools/build/dart.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ module.exports.detect = function(gulp) {
88
if (process.platform === 'win32') {
99
DART_SDK = {
1010
ANALYZER: 'dartanalyzer.bat',
11+
DARTDOCGEN: 'dartdocgen.bat',
1112
DARTFMT: 'dartfmt.bat',
1213
PUB: 'pub.bat',
1314
VM: 'dart.exe'
1415
};
1516
} else {
1617
DART_SDK = {
1718
ANALYZER: 'dartanalyzer',
19+
DARTDOCGEN: 'dartdocgen',
1820
DARTFMT: 'dartfmt',
1921
PUB: 'pub',
2022
VM: 'dart'

tools/build/dartapidocs.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
var Q = require('q');
2+
var readline = require('readline');
3+
var spawn = require('child_process').spawn;
4+
var util = require('./util');
5+
6+
module.exports = function(gulp, plugins, config) {
7+
return function() {
8+
return util.forEachSubDirSequential(config.dest, function(dir) {
9+
var defer = Q.defer();
10+
var done = defer.makeNodeResolver();
11+
12+
var supportedModules = [
13+
'dist/dart/angular2',
14+
// TODO: blocked by https://github.com/angular/angular/issues/3518
15+
// 'dist/dart/angular2_material',
16+
'dist/dart/benchpress'
17+
];
18+
19+
if (supportedModules.indexOf(dir) === -1) {
20+
done();
21+
} else {
22+
console.log('INFO: running dartdocgen for ', dir);
23+
24+
var stream = spawn(config.command, ['.'], {
25+
stdio: [process.stdin, process.stdout, process.stderr],
26+
cwd: dir
27+
});
28+
29+
stream.on('exit', function(code) {
30+
if (code !== 0) {
31+
done('ERROR: dartdocgen exited with non-zero status ' + code);
32+
} else {
33+
done();
34+
}
35+
});
36+
37+
stream.on('error', function(e) {
38+
done('ERROR: dartdocgen reported error: ' + e);
39+
});
40+
}
41+
return defer.promise;
42+
});
43+
};
44+
};

0 commit comments

Comments
 (0)