build(): Add a dartanalyzer run to Travis. It is required.

This commit is contained in:
Hans Larsen
2016-02-11 12:33:48 -08:00
parent 93fc4ff67b
commit 9b4b9e7cf4
9 changed files with 37 additions and 26 deletions
@@ -41,3 +41,4 @@ Here's a list of gotchas to keep in mind when writing TypeScript code that will
* **Default values need to be constants.** This mean that code like `function myFunction(arg1: string = callToSomething()) {}` will not compile.
* **The const keyword must have a const value.** Because of that, we cannot do `const x = a + b;` even if the value of `x`, `a` and `b` will not change.
* **Lambdas need to abide to the type required.** Meaning that if a function requires a function that takes one argument, the lambda cannot be `() => {}`. Use `_` for temporary parameters. This is notable in Promises.
* **Dynamic return values fat arrows can't return non-primitive types without casting.** For example, a fat arrow that return a promise (or Future) generates a warning if using directly, like so: `promiseA.then(() => promiseB)`. In this case simply using a block works as expected; `promiseA.then(() => { return promiseB; })`.
+1 -1
View File
@@ -51,7 +51,7 @@
"strip-ansi": "^3.0.0",
"symlink-or-copy": "^1.0.1",
"ts-node": "^0.5.5",
"ts2dart": "^0.7.24",
"ts2dart": "^0.7.25",
"tslint": "^3.2.2",
"typescript": "^1.7.5",
"which": "^1.2.4"
+1 -2
View File
@@ -18,8 +18,7 @@ is_dart && pub install
wait_for_tunnel
if is_dart; then
# npm run dartanalyzer
echo 'TODO(hans): Implement dartanalyzer'
npm run dartanalyzer
else
karma start test/karma.conf.js --single-run --no-auto-watch --reporters='dots'
fi
+7 -2
View File
@@ -5,8 +5,13 @@ import {detect} from '../../tools/build/dart';
const command = detect()['ANALYZER'];
analyze('dist/dart', command, true)
.then(() => {
.then((err) => {
if (err) {
throw err;
}
console.log('Done.');
}, (err) => {
})
.catch((err) => {
console.error('Error:', err);
process.exit(1);
});
@@ -1,4 +1,12 @@
import {beforeEach, ddescribe, expect, inject, it, TestComponentBuilder} from 'angular2/testing';
import {inject, TestComponentBuilder} from 'angular2/testing';
import {
it,
iit,
describe,
ddescribe,
expect,
beforeEach,
} from '../../core/facade/testing';
import {Component, DebugElement} from 'angular2/core';
import {By} from 'angular2/platform/browser'
import {MdProgressCircle} from './progress_circle';
@@ -8,6 +8,7 @@ import {
ViewEncapsulation,
} from 'angular2/core';
import {isPresent, CONST} from 'angular2/src/facade/lang';
import {Math} from 'angular2/src/facade/math';
import {OneOf} from '../../core/annotations/one-of';
@@ -42,12 +43,9 @@ export class MdProgressCircle {
* Input:number, defaults to 0.
* value_ is bound to the host as the attribute aria-valuenow.
*/
@HostBinding('attr.aria-valuenow')
@Input('value')
value_: number = 0;
@HostBinding('attr.aria-valuenow')
get _value() {
return this.value_;
}
/**
* Mode of the progress circle
@@ -55,13 +53,10 @@ export class MdProgressCircle {
* Input must be one of the values from ProgressMode, defaults to 'determinate'.
* mode is bound to the host as the attribute host.
*/
@HostBinding('attr.mode')
@Input()
@OneOf([ProgressMode.DETERMINATE, ProgressMode.INDETERMINATE])
mode: string;
@HostBinding('attr.mode')
get _mode() {
return this.mode;
}
/**
@@ -119,5 +114,8 @@ export class MdProgressCircle {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdSpinner extends MdProgressCircle {
mode: string = ProgressMode.INDETERMINATE;
constructor() {
super();
this.mode = ProgressMode.INDETERMINATE;
}
}
+4 -4
View File
@@ -138,8 +138,8 @@ export function main() {
.then((_: any) => {
expect(called).toBe(false);
})
.then((_: any) => promise)
.then((_: any) => expect(called).toBe(true))
.then((_: any) => { return promise; })
.then((_: any) => { expect(called).toBe(true); })
.then((_: any) => {
// Close it now.
called = false;
@@ -151,8 +151,8 @@ export function main() {
.then((_: any) => {
expect(called).toBe(false);
})
.then((_: any) => promise)
.then((_: any) => expect(called).toBe(true))
.then((_: any) => { return promise; })
.then((_: any) => { expect(called).toBe(true); })
.then((_: any) => { done(); });
}, 8000);
+6 -6
View File
@@ -3,7 +3,7 @@ import {CardDemo} from './card/card-demo';
import {ButtonDemo} from './button/button-demo';
import {SidenavDemo} from './sidenav/sidenav-demo';
import {ProgressCircleDemo} from './progress-circle/progress-circle-demo';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {Route, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {Dir} from '../directives/dir/dir';
import {MdButton} from '../components/button/button';
@@ -22,10 +22,10 @@ export class Home {}
pipes: []
})
@RouteConfig([
{path: '/', name: 'Home', component: Home, useAsDefault: true},
{path: '/button', name: 'ButtonDemo', component: ButtonDemo},
{path: '/card', name: 'CardDemo', component: CardDemo},
{path: '/sidenav', name: 'SidenavDemo', component: SidenavDemo},
{path: '/progress-circle', name: 'ProgressCircleDemo', component: ProgressCircleDemo},
new Route({path: '/', name: 'Home', component: Home, useAsDefault: true}),
new Route({path: '/button', name: 'ButtonDemo', component: ButtonDemo}),
new Route({path: '/card', name: 'CardDemo', component: CardDemo}),
new Route({path: '/sidenav', name: 'SidenavDemo', component: SidenavDemo}),
new Route({path: '/progress-circle', name: 'ProgressCircleDemo', component: ProgressCircleDemo}),
])
export class DemoApp { }
+1 -1
View File
@@ -23,7 +23,7 @@ const tempFile = '_analyzer.dart';
* @param command The command to use for dartanalyzer.
* @param use_ddc Enable strong static type checking (see https://goo.gl/DqcBsw).
*/
export function analyze(dir: string, command: string, use_ddc: boolean = false): Promise<void> {
export function analyze(dir: string, command: string, use_ddc: boolean = false): Promise<any> {
var travisFoldEnd = travisFoldStart(`dartanalyzer-${use_ddc ? 'ddc' : ''}-${dir}`);
var pubspecContents = fs.readFileSync(path.join(dir, 'pubspec.yaml'));