Skip to content

Commit bb4fd2d

Browse files
author
Tim Blasi
committed
build(gulp): simplify Dart transformer tasks
Now that `modules_dart` contains only `transform` code, simplify its `gulp` rules.
1 parent fd5cd84 commit bb4fd2d

File tree

1 file changed

+1
-49
lines changed

1 file changed

+1
-49
lines changed

gulpfile.js

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -886,68 +886,20 @@ gulp.task('test.typings', ['!pre.test.typings'], function() {
886886
// These packages need no transpilation. All code is copied over to `dist`
887887
// unmodified and directory structure is preserved.
888888
//
889-
// This task also fixes relative `dependency_overrides` paths in `pubspec.yaml`
890-
// files.
891-
//
892889
// This task is expected to be run after build/tree.dart
893890
gulp.task('build/pure-packages.dart', function() {
894891
var through2 = require('through2');
895892
var yaml = require('js-yaml');
896893
var originalPrefix = '../../dist/dart/';
897894

898-
var transformStream = gulp
895+
return gulp
899896
.src([
900897
'modules_dart/transform/**/*',
901898
'!modules_dart/transform/**/*.proto',
902899
'!modules_dart/transform/pubspec.yaml',
903900
'!modules_dart/transform/**/packages{,/**}',
904901
])
905902
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2')));
906-
907-
var moveStream = gulp.src([
908-
'modules_dart/**/*.dart',
909-
'modules_dart/**/pubspec.yaml',
910-
'!modules_dart/transform/**',
911-
'!modules_dart/**/packages{,/**}'
912-
])
913-
.pipe(through2.obj(function(file, enc, done) {
914-
if (/pubspec.yaml$/.test(file.path)) {
915-
// Pure packages specify dependency_overrides relative to
916-
// `modules_dart`, so they have to walk up and into `dist`.
917-
//
918-
// Example:
919-
//
920-
// dependency_overrides:
921-
// angular2:
922-
// path: ../../dist/dart/angular2
923-
//
924-
// When we copy a pure package into `dist` the relative path
925-
// must be updated. The code below replaces paths accordingly.
926-
// So the example above is turned into:
927-
//
928-
// dependency_overrides:
929-
// angular2:
930-
// path: ../angular2
931-
//
932-
var pubspec = yaml.safeLoad(file.contents.toString());
933-
var overrides = pubspec.dependency_overrides;
934-
if (overrides) {
935-
Object.keys(overrides).forEach(function(pkg) {
936-
var overridePath = overrides[pkg].path;
937-
if ((new RegExp('^' + originalPrefix)).test(overridePath)) {
938-
overrides[pkg].path = overridePath.replace(originalPrefix, '../');
939-
}
940-
});
941-
file.contents = new Buffer(yaml.safeDump(pubspec));
942-
}
943-
}
944-
this.push(file);
945-
done();
946-
}))
947-
.pipe(gulp.dest(CONFIG.dest.dart));
948-
949-
950-
return merge2(transformStream, moveStream);
951903
});
952904

953905
// Builds all Dart packages, but does not compile them

0 commit comments

Comments
 (0)