@@ -5,20 +5,20 @@ const gulp = require('gulp');
55const cp = require ( 'child_process' ) ;
66const path = require ( 'path' ) ;
77const fs = require ( 'fs' ) ;
8- const serverDir = path . join ( __dirname , 'bazel-ls-eclipse' ) ;
9- const mvnCmd = path . join ( serverDir , mvnw ( ) ) ;
8+ const bazelEclipseDir = path . join ( __dirname , 'bazel-eclipse' ) ;
109
1110gulp . task ( 'build-plugin' , ( done ) => {
12-
13- if ( fs . existsSync ( mvnCmd ) ) {
14- cp . execSync ( 'git fetch origin' , { cwd : serverDir , stdio : [ 0 , 1 , 2 ] } ) ;
15- cp . execSync ( 'git pull origin --force' , { cwd : serverDir , stdio : [ 0 , 1 , 2 ] } ) ;
16- } else {
17- cp . execSync ( 'git clone https://github.com/salesforce/bazel-ls-eclipse.git' , { cwd : __dirname , stdio : [ 0 , 1 , 2 ] } ) ;
18- }
19-
20- cp . execSync ( `mvn clean package` , { cwd : serverDir , stdio : [ 0 , 1 , 2 ] } ) ;
21- done ( ) ;
11+ fs . readdirSync ( __dirname ) . forEach ( ( file , index ) => {
12+ if ( file . match ( '.*bazel-ls-vscode-.*\\.vsix' ) ) {
13+ fs . unlinkSync ( file ) ;
14+ }
15+ } ) ;
16+
17+ removeFolder ( bazelEclipseDir ) ;
18+
19+ cp . execSync ( 'git clone https://github.com/salesforce/bazel-eclipse.git' , { cwd : __dirname , stdio : [ 0 , 1 , 2 ] } ) ;
20+ cp . execSync ( `mvn clean package` , { cwd : bazelEclipseDir , stdio : [ 0 , 1 , 2 ] } ) ;
21+ done ( ) ;
2222} ) ;
2323
2424function isWin ( ) {
@@ -28,3 +28,17 @@ function isWin() {
2828function mvnw ( ) {
2929 return isWin ( ) ? 'mvnw.cmd' : './mvnw' ;
3030}
31+
32+ function removeFolder ( folder ) {
33+ if ( fs . existsSync ( folder ) ) {
34+ fs . readdirSync ( folder ) . forEach ( ( file , index ) => {
35+ var child = path . join ( folder , file ) ;
36+ if ( fs . statSync ( child ) . isDirectory ( ) ) {
37+ removeFolder ( child ) ;
38+ } else {
39+ fs . unlinkSync ( child ) ;
40+ }
41+ } ) ;
42+ fs . rmdirSync ( folder ) ;
43+ }
44+ }
0 commit comments