@@ -10,11 +10,11 @@ const json = require('gulp-json-editor');
1010const buffer = require ( 'gulp-buffer' ) ;
1111const filter = require ( 'gulp-filter' ) ;
1212const es = require ( 'event-stream' ) ;
13- const util = require ( './lib/util' ) ;
14- const remote = require ( 'gulp-remote-src' ) ;
15- const zip = require ( 'gulp-vinyl-zip' ) ;
16-
13+ const vfs = require ( 'vinyl-fs' ) ;
1714const pkg = require ( '../package.json' ) ;
15+ const cp = require ( 'child_process' ) ;
16+ const fancyLog = require ( 'fancy-log' ) ;
17+ const ansiColors = require ( 'ansi-colors' ) ;
1818
1919gulp . task ( 'mixin' , function ( ) {
2020 const repo = process . env [ 'VSCODE_MIXIN_REPO' ] ;
@@ -31,38 +31,38 @@ gulp.task('mixin', function () {
3131 return ;
3232 }
3333
34- const url = `https://github.com/${ repo } /archive/${ pkg . distro } .zip` ;
35- const opts = { base : url } ;
36- const username = process . env [ 'VSCODE_MIXIN_USERNAME' ] ;
37- const password = process . env [ 'VSCODE_MIXIN_PASSWORD' ] ;
34+ const url = `https://github.com/${ repo } .git` ;
3835
39- if ( username || password ) {
40- opts . auth = { user : username || '' , pass : password || '' } ;
41- }
36+ cp . execSync ( `git config user.email "vscode@microsoft.com"` ) ;
37+ cp . execSync ( `git config user.name "VSCode"` ) ;
4238
43- console . log ( 'Mixing in sources from \'' + url + '\':' ) ;
39+ fancyLog ( ansiColors . blue ( '[mixin]' ) , 'Add distro remote' ) ;
40+ cp . execSync ( `git remote add distro ${ url } ` ) ;
4441
45- let all = remote ( '' , opts )
46- . pipe ( zip . src ( ) )
47- . pipe ( filter ( function ( f ) { return ! f . isDirectory ( ) ; } ) )
48- . pipe ( util . rebase ( 1 ) ) ;
42+ fancyLog ( ansiColors . blue ( '[mixin]' ) , 'Add fetch distro sources' ) ;
43+ cp . execSync ( `git fetch distro` ) ;
4944
50- if ( quality ) {
51- const productJsonFilter = filter ( 'product.json' , { restore : true } ) ;
52- const mixin = all
53- . pipe ( filter ( [ 'quality/' + quality + '/**' ] ) )
54- . pipe ( util . rebase ( 2 ) )
55- . pipe ( productJsonFilter )
56- . pipe ( buffer ( ) )
57- . pipe ( json ( o => Object . assign ( { } , require ( '../product.json' ) , o ) ) )
58- . pipe ( productJsonFilter . restore ) ;
45+ fancyLog ( ansiColors . blue ( '[mixin]' ) , `Merge ${ pkg . distro } from distro` ) ;
5946
60- all = es . merge ( mixin ) ;
47+ try {
48+ cp . execSync ( `git merge ${ pkg . distro } ` ) ;
49+ } catch ( err ) {
50+ fancyLog ( ansiColors . red ( '[mixin] ❌' ) , `Failed to merge ${ pkg . distro } from distro. Please proceed with manual merge to fix the build.` ) ;
51+ throw err ;
6152 }
6253
63- return all
54+ const productJsonFilter = filter ( 'product.json' , { restore : true } ) ;
55+
56+ fancyLog ( ansiColors . blue ( '[mixin]' ) , `Mixing in sources:` ) ;
57+ return vfs
58+ . src ( `quality/${ quality } /**` , { base : `quality/${ quality } ` } )
59+ . pipe ( filter ( function ( f ) { return ! f . isDirectory ( ) ; } ) )
60+ . pipe ( productJsonFilter )
61+ . pipe ( buffer ( ) )
62+ . pipe ( json ( o => Object . assign ( { } , require ( '../product.json' ) , o ) ) )
63+ . pipe ( productJsonFilter . restore )
6464 . pipe ( es . mapSync ( function ( f ) {
65- console . log ( f . relative ) ;
65+ fancyLog ( ansiColors . blue ( '[mixin]' ) , f . relative , ansiColors . green ( '✔︎' ) ) ;
6666 return f ;
6767 } ) )
6868 . pipe ( gulp . dest ( '.' ) ) ;
0 commit comments