chore: add dartdoc compliance checks to build

Closes #3582
This commit is contained in:
Yegor Jbanov 2015-08-06 15:07:33 -07:00 committed by Yegor
parent 5a405011de
commit 280d8f3148
5 changed files with 58 additions and 6 deletions

View File

@ -25,6 +25,7 @@ var pubget = require('./tools/build/pubget');
var linknodemodules = require('./tools/build/linknodemodules');
var pubbuild = require('./tools/build/pubbuild');
var dartanalyzer = require('./tools/build/dartanalyzer');
var dartapidocs = require('./tools/build/dartapidocs');
var jsserve = require('./tools/build/jsserve');
var pubserve = require('./tools/build/pubserve');
var karma = require('karma');
@ -250,6 +251,11 @@ gulp.task('build/analyze.ddc.dart', dartanalyzer(gulp, gulpPlugins, {
use_ddc: true
}));
gulp.task('build/check.apidocs.dart', dartapidocs(gulp, gulpPlugins, {
dest: CONFIG.dest.dart,
command: DART_SDK.DARTDOCGEN
}));
// ------------
// pubbuild
// WARNING: this task is very slow (~15m as of July 2015)
@ -843,6 +849,7 @@ gulp.task('build.dart', function(done) {
'build/packages.dart',
'build/pubspec.dart',
'build/analyze.dart',
'build/check.apidocs.dart',
'build.dart.material.css',
sequenceComplete(done)
);

View File

@ -23,7 +23,6 @@ export {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
export {ElementRef} from 'angular2/src/core/compiler/element_ref';
export {TemplateRef} from 'angular2/src/core/compiler/template_ref';
export {RenderElementRef} from 'angular2/src/render/api';
export {ViewRef, HostViewRef, ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
export {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';

View File

@ -4,27 +4,27 @@ import 'package:angular2/src/change_detection/change_detection.dart';
import 'package:angular2/di.dart';
import './test_lib.dart';
@proxy()
@proxy
class SpyChangeDetector extends SpyObject implements ChangeDetector {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy()
@proxy
class SpyProtoChangeDetector extends SpyObject implements ProtoChangeDetector {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy()
@proxy
class SpyPipe extends SpyObject implements Pipe {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy()
@proxy
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy()
@proxy
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
noSuchMethod(m) => super.noSuchMethod(m);
}

View File

@ -8,6 +8,7 @@ module.exports.detect = function(gulp) {
if (process.platform === 'win32') {
DART_SDK = {
ANALYZER: 'dartanalyzer.bat',
DARTDOCGEN: 'dartdocgen.bat',
DARTFMT: 'dartfmt.bat',
PUB: 'pub.bat',
VM: 'dart.exe'
@ -15,6 +16,7 @@ module.exports.detect = function(gulp) {
} else {
DART_SDK = {
ANALYZER: 'dartanalyzer',
DARTDOCGEN: 'dartdocgen',
DARTFMT: 'dartfmt',
PUB: 'pub',
VM: 'dart'

View File

@ -0,0 +1,44 @@
var Q = require('q');
var readline = require('readline');
var spawn = require('child_process').spawn;
var util = require('./util');
module.exports = function(gulp, plugins, config) {
return function() {
return util.forEachSubDirSequential(config.dest, function(dir) {
var defer = Q.defer();
var done = defer.makeNodeResolver();
var supportedModules = [
'dist/dart/angular2',
// TODO: blocked by https://github.com/angular/angular/issues/3518
// 'dist/dart/angular2_material',
'dist/dart/benchpress'
];
if (supportedModules.indexOf(dir) === -1) {
done();
} else {
console.log('INFO: running dartdocgen for ', dir);
var stream = spawn(config.command, ['.'], {
stdio: [process.stdin, process.stdout, process.stderr],
cwd: dir
});
stream.on('exit', function(code) {
if (code !== 0) {
done('ERROR: dartdocgen exited with non-zero status ' + code);
} else {
done();
}
});
stream.on('error', function(e) {
done('ERROR: dartdocgen reported error: ' + e);
});
}
return defer.promise;
});
};
};