chore(dart/transform): Create targets for serving transformed Dart code
- Allow pub (build|serve) to specify mode - Update pubbuild.js & pubserve.js to allow the caller to provide a `mode` value. - Update settings to allow the di benchmark to be transformed to run statically.
This commit is contained in:
parent
1a99090b45
commit
42c0171b40
27
gulpfile.js
27
gulpfile.js
|
@ -183,7 +183,7 @@ var CONFIG = {
|
|||
},
|
||||
dart: {
|
||||
src: [
|
||||
'modules/**/*.md', '!modules/**/*.js.md', 'modules/**/*.png',
|
||||
'modules/**/*.md', '!modules/**/*.js.md', 'modules/**/*.png', 'modules/**/*.html',
|
||||
'modules/**/*.dart', 'modules/*/pubspec.yaml', 'modules/**/*.css', '!modules/**/e2e_test/**'
|
||||
],
|
||||
pipes: {
|
||||
|
@ -608,6 +608,24 @@ gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, {
|
|||
path: CONFIG.dest.dart + '/benchmarks_external'
|
||||
}));
|
||||
|
||||
gulp.task('serve/examples.dart.static', pubserve(gulp, gulpPlugins, {
|
||||
command: DART_SDK.PUB,
|
||||
mode: 'ngstatic',
|
||||
path: CONFIG.dest.dart + '/examples'
|
||||
}));
|
||||
|
||||
gulp.task('serve/benchmarks.dart.static', pubserve(gulp, gulpPlugins, {
|
||||
command: DART_SDK.PUB,
|
||||
mode: 'ngstatic',
|
||||
path: CONFIG.dest.dart + '/benchmarks'
|
||||
}));
|
||||
|
||||
gulp.task('serve/benchmarks_external.dart.static', pubserve(gulp, gulpPlugins, {
|
||||
command: DART_SDK.PUB,
|
||||
mode: 'ngstatic',
|
||||
path: CONFIG.dest.dart + '/benchmarks_external'
|
||||
}));
|
||||
|
||||
// --------------
|
||||
// doc generation
|
||||
var Dgeni = require('dgeni');
|
||||
|
@ -758,12 +776,6 @@ gulp.task('test.transpiler.unittest', function (done) {
|
|||
}))
|
||||
});
|
||||
|
||||
// Copy test resources to dist
|
||||
gulp.task('tests/transform.dart', function() {
|
||||
return gulp.src('modules/angular2/test/transform/**')
|
||||
.pipe(gulp.dest('dist/dart/angular2/test/transform'));
|
||||
});
|
||||
|
||||
|
||||
|
||||
// -----------------
|
||||
|
@ -773,7 +785,6 @@ gulp.task('tests/transform.dart', function() {
|
|||
gulp.task('build/packages.dart', function(done) {
|
||||
runSequence(
|
||||
['build/transpile.dart.ts2dart', 'build/transpile.dart', 'build/html.dart', 'build/copy.dart', 'build/multicopy.dart'],
|
||||
'tests/transform.dart',
|
||||
// the two format steps don't need to be sequential, but we have seen flakiness in
|
||||
// dartstyle:format with connecting to localhost.
|
||||
'build/format.dart.ts2dart',
|
||||
|
|
|
@ -15,6 +15,8 @@ dependency_overrides:
|
|||
angular2:
|
||||
path: ../angular2
|
||||
transformers:
|
||||
- angular2:
|
||||
entry_point: web/src/di/di_benchmark.dart
|
||||
- $dart2js:
|
||||
minify: false
|
||||
commandLineOptions: ['--dump-info', '--trust-type-annotations', '--trust-primitives']
|
||||
|
|
|
@ -1,36 +1,13 @@
|
|||
import {Injector, Key} from "angular2/di";
|
||||
import {Injectable, Injector, Key} from "angular2/di";
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {getIntParameter, bindAction, microBenchmark} from 'angular2/src/test_lib/benchmark_util';
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
|
||||
var count = 0;
|
||||
|
||||
function setupReflector() {
|
||||
reflector.registerType(A, {
|
||||
'factory': () => new A(),
|
||||
'parameters': [],
|
||||
'annotations' : []
|
||||
});
|
||||
reflector.registerType(B, {
|
||||
'factory': (a) => new B(a),
|
||||
'parameters': [[A]],
|
||||
'annotations' : []
|
||||
});
|
||||
reflector.registerType(C, {
|
||||
'factory': (b) => new C(b),
|
||||
'parameters': [[B]],
|
||||
'annotations' : []
|
||||
});
|
||||
reflector.registerType(D, {
|
||||
'factory': (c,b) => new D(c,b),
|
||||
'parameters': [[C],[B]],
|
||||
'annotations' : []
|
||||
});
|
||||
reflector.registerType(E, {
|
||||
'factory': (d,c) => new E(d,c),
|
||||
'parameters': [[D],[C]],
|
||||
'annotations' : []
|
||||
});
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
}
|
||||
|
||||
export function main() {
|
||||
|
@ -97,31 +74,35 @@ export function main() {
|
|||
|
||||
|
||||
|
||||
|
||||
@Injectable()
|
||||
class A {
|
||||
constructor() {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class B {
|
||||
constructor(a:A) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class C {
|
||||
constructor(b:B) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class D {
|
||||
constructor(c:C, b:B) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class E {
|
||||
constructor(d:D, c:C) {
|
||||
count++;
|
||||
|
|
|
@ -17,7 +17,9 @@ module.exports = function(gulp, plugins, config) {
|
|||
}
|
||||
var folder = path.resolve(path.join(webFolders.shift(), '..'));
|
||||
var destFolder = path.resolve(path.join(config.dest, path.basename(folder)));
|
||||
return util.processToPromise(spawn(config.command, ['build', '-o', destFolder], {
|
||||
var pubMode = config.mode || 'release';
|
||||
var pubArgs = ['build', '--mode', pubMode, '-o', destFolder];
|
||||
return util.processToPromise(spawn(config.command, pubArgs, {
|
||||
stdio: 'inherit',
|
||||
cwd: folder
|
||||
})).then(function() {
|
||||
|
|
|
@ -3,7 +3,9 @@ var spawn = require('child_process').spawn;
|
|||
|
||||
module.exports = function(gulp, plugins, config, module) {
|
||||
return function() {
|
||||
return util.streamToPromise(spawn(config.command, ['serve'], {
|
||||
var pubMode = config.mode || 'debug';
|
||||
var pubArgs = ['serve', '--mode', pubMode];
|
||||
return util.streamToPromise(spawn(config.command, pubArgs, {
|
||||
cwd: config.path, stdio: 'inherit'
|
||||
}));
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue