-
Notifications
You must be signed in to change notification settings - Fork 27.1k
feat(compiler): Wire offline compilation as a build step. #8098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c0d497
ca40ef5
8bf6ef6
c493d88
33e53c9
78946fe
7f2fb0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -452,22 +452,40 @@ gulp.task('serve.e2e.dart', ['build.js.cjs'], function(neverDone) { | |
| // ------------------ | ||
| // CI tests suites | ||
|
|
||
| function runKarma(configFile, done) { | ||
| function execProcess(name, args, done) { | ||
| var exec = require('child_process').exec; | ||
|
|
||
| var cmd = process.platform === 'win32' ? 'node_modules\\.bin\\karma run ' : | ||
| 'node node_modules/.bin/karma run '; | ||
| cmd += configFile; | ||
| exec(cmd, function(e, stdout) { | ||
| var cmd = process.platform === 'win32' ? 'node_modules\\.bin\\' + name + ' ' : | ||
| 'node node_modules/.bin/' + name + ' '; | ||
| cmd += args; | ||
| exec(cmd, done); | ||
| } | ||
| function runKarma(configFile, done) { | ||
| execProcess('karma', 'run ' + configFile, function(e, stdout) { | ||
| // ignore errors, we don't want to fail the build in the interactive (non-ci) mode | ||
| // karma server will print all test failures | ||
| done(); | ||
| }); | ||
| } | ||
|
|
||
| // Gulp-typescript doesn't work with typescript@next: | ||
| // https://github.com/ivogabe/gulp-typescript/issues/331 | ||
| function runTsc(project, done) { | ||
| execProcess('tsc', '-p ' + project, function(e, stdout, stderr) { | ||
| if (e) { | ||
| console.log(stdout); | ||
| console.error(stderr); | ||
| done(e); | ||
| } else { | ||
| done(); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| gulp.task('test.js', function(done) { | ||
| runSequence('test.unit.tools/ci', 'test.transpiler.unittest', 'test.unit.js/ci', | ||
| 'test.unit.cjs/ci', 'test.typings', 'check-public-api', sequenceComplete(done)); | ||
| runSequence('test.compiler_cli', 'test.unit.tools/ci', 'test.transpiler.unittest', | ||
| 'test.unit.js/ci', 'test.unit.cjs/ci', 'test.typings', 'check-public-api', | ||
| sequenceComplete(done)); | ||
| }); | ||
|
|
||
| gulp.task('test.dart', function(done) { | ||
|
|
@@ -768,7 +786,7 @@ gulp.task('!checkAndReport.payload.js', function() { | |
| { | ||
| failConditions: PAYLOAD_TESTS_CONFIG.ts[packaging].sizeLimits, | ||
| prefix: caseName + '_' + packaging | ||
| }) | ||
| }); | ||
| } | ||
|
|
||
| return PAYLOAD_TESTS_CONFIG.ts.cases.reduce(function(sizeReportingStreams, caseName) { | ||
|
|
@@ -1026,6 +1044,26 @@ gulp.task('!test.typings', | |
| gulp.task('test.typings', ['build.js.cjs'], | ||
| function(done) { runSequence('!test.typings', sequenceComplete(done)); }); | ||
|
|
||
| gulp.task('!build.compiler_cli', ['build.js.cjs'], | ||
| function(done) { runTsc('tools/compiler_cli/src', done); }); | ||
|
|
||
| gulp.task('!test.compiler_cli.codegen', function(done) { | ||
|
||
| try { | ||
| require('./dist/js/cjs/compiler_cli') | ||
|
||
| .main("tools/compiler_cli/test") | ||
| .then(function() { done(); }) | ||
| .catch(function(rej) { done(new Error(rej)); }); | ||
| } catch (err) { | ||
| done(err); | ||
| } | ||
| }); | ||
|
|
||
| // End-to-end test for compiler CLI. | ||
| // Calls the compiler using its command-line interface, then compiles the app with the codegen. | ||
| // TODO(alexeagle): wire up the playground tests with offline compilation, similar to dart. | ||
| gulp.task('test.compiler_cli', ['!build.compiler_cli'], | ||
| function(done) { runSequence('!test.compiler_cli.codegen', sequenceComplete(done)); }); | ||
|
|
||
| // ----------------- | ||
| // orchestrated targets | ||
|
|
||
|
|
@@ -1091,7 +1129,7 @@ gulp.task('!build.tools', function() { | |
| var sourcemaps = require('gulp-sourcemaps'); | ||
| var tsc = require('gulp-typescript'); | ||
|
|
||
| var stream = gulp.src(['tools/**/*.ts']) | ||
| var stream = gulp.src(['tools/**/*.ts', '!tools/compiler_cli/**']) | ||
| .pipe(sourcemaps.init()) | ||
| .pipe(tsc({ | ||
| target: 'ES5', | ||
|
|
@@ -1512,7 +1550,7 @@ gulp.on('task_start', (e) => { | |
| analytics.buildSuccess('gulp <startup>', process.uptime() * 1000); | ||
| } | ||
|
|
||
| analytics.buildStart('gulp ' + e.task) | ||
| analytics.buildStart('gulp ' + e.task); | ||
| }); | ||
| gulp.on('task_stop', (e) => {analytics.buildSuccess('gulp ' + e.task, e.duration * 1000)}); | ||
| gulp.on('task_err', (e) => {analytics.buildError('gulp ' + e.task, e.duration * 1000)}); | ||
| gulp.on('task_stop', (e) => { analytics.buildSuccess('gulp ' + e.task, e.duration * 1000); }); | ||
| gulp.on('task_err', (e) => { analytics.buildError('gulp ' + e.task, e.duration * 1000); }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does your PR still require typescript@next? If not, maybe use gulp-typescript?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I still use typescript@next to compile the compiler (it uses baseUrl/paths to resolve the 'angular2' imports)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, the issue referenced here is resolved, so it may be possible to use gulp-typescript instead.
(Not that it adds anything, I want the
tsconfig.jsonto express everything).Will try upgrading it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried newer gulp-typescript, it is still broken. Filed a new issue and referenced in this comment.
Note that I think we should stop using gulp-typescript and store our configuration in
tsconfig.jsoninstead. Maybe in a followup PR I'll remove it :)