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: {
|
dart: {
|
||||||
src: [
|
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/**'
|
'modules/**/*.dart', 'modules/*/pubspec.yaml', 'modules/**/*.css', '!modules/**/e2e_test/**'
|
||||||
],
|
],
|
||||||
pipes: {
|
pipes: {
|
||||||
@ -608,6 +608,24 @@ gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, {
|
|||||||
path: CONFIG.dest.dart + '/benchmarks_external'
|
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
|
// doc generation
|
||||||
var Dgeni = require('dgeni');
|
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) {
|
gulp.task('build/packages.dart', function(done) {
|
||||||
runSequence(
|
runSequence(
|
||||||
['build/transpile.dart.ts2dart', 'build/transpile.dart', 'build/html.dart', 'build/copy.dart', 'build/multicopy.dart'],
|
['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
|
// the two format steps don't need to be sequential, but we have seen flakiness in
|
||||||
// dartstyle:format with connecting to localhost.
|
// dartstyle:format with connecting to localhost.
|
||||||
'build/format.dart.ts2dart',
|
'build/format.dart.ts2dart',
|
||||||
|
@ -15,6 +15,8 @@ dependency_overrides:
|
|||||||
angular2:
|
angular2:
|
||||||
path: ../angular2
|
path: ../angular2
|
||||||
transformers:
|
transformers:
|
||||||
|
- angular2:
|
||||||
|
entry_point: web/src/di/di_benchmark.dart
|
||||||
- $dart2js:
|
- $dart2js:
|
||||||
minify: false
|
minify: false
|
||||||
commandLineOptions: ['--dump-info', '--trust-type-annotations', '--trust-primitives']
|
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 {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 {getIntParameter, bindAction, microBenchmark} from 'angular2/src/test_lib/benchmark_util';
|
||||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
function setupReflector() {
|
function setupReflector() {
|
||||||
reflector.registerType(A, {
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
'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' : []
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
@ -97,31 +74,35 @@ export function main() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class A {
|
class A {
|
||||||
constructor() {
|
constructor() {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class B {
|
class B {
|
||||||
constructor(a:A) {
|
constructor(a:A) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class C {
|
class C {
|
||||||
constructor(b:B) {
|
constructor(b:B) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class D {
|
class D {
|
||||||
constructor(c:C, b:B) {
|
constructor(c:C, b:B) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class E {
|
class E {
|
||||||
constructor(d:D, c:C) {
|
constructor(d:D, c:C) {
|
||||||
count++;
|
count++;
|
||||||
|
@ -17,7 +17,9 @@ module.exports = function(gulp, plugins, config) {
|
|||||||
}
|
}
|
||||||
var folder = path.resolve(path.join(webFolders.shift(), '..'));
|
var folder = path.resolve(path.join(webFolders.shift(), '..'));
|
||||||
var destFolder = path.resolve(path.join(config.dest, path.basename(folder)));
|
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',
|
stdio: 'inherit',
|
||||||
cwd: folder
|
cwd: folder
|
||||||
})).then(function() {
|
})).then(function() {
|
||||||
|
@ -3,7 +3,9 @@ var spawn = require('child_process').spawn;
|
|||||||
|
|
||||||
module.exports = function(gulp, plugins, config, module) {
|
module.exports = function(gulp, plugins, config, module) {
|
||||||
return function() {
|
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'
|
cwd: config.path, stdio: 'inherit'
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user