@@ -5,11 +5,11 @@ import * as tracers from './specs/tracers';
5
5
import * as randomizers from './specs/randomizers' ;
6
6
7
7
class Commanders {
8
- constructor ( { name, srcDir, buildDir, buildCommand } ) {
8
+ constructor ( { name, srcDir, buildDir, buildCommands } ) {
9
9
this . name = name ;
10
10
this . srcDir = srcDir ;
11
11
this . buildDir = buildDir ;
12
- this . buildCommand = buildCommand ;
12
+ this . buildCommands = buildCommands ;
13
13
}
14
14
15
15
get cwd ( ) {
@@ -47,7 +47,7 @@ class Commanders {
47
47
build ( ) {
48
48
fs . removeSync ( this . buildPath ) ;
49
49
fs . removeSync ( this . libPath ) ;
50
- const buildProcess = child_process . exec ( this . buildCommand , { cwd : this . cwd } ) ;
50
+ const buildProcess = child_process . exec ( this . buildCommands . join ( ' && ' ) , { cwd : this . cwd } ) ;
51
51
buildProcess . stdout . pipe ( process . stdout ) ;
52
52
buildProcess . stderr . pipe ( process . stderr ) ;
53
53
buildProcess . on ( 'exit' , code => {
@@ -64,26 +64,41 @@ export const cppCommander = new Commanders({
64
64
name : 'cpp' ,
65
65
srcDir : 'src' ,
66
66
buildDir : 'build/out' ,
67
- buildCommand : 'mkdir -p build && cd build && cmake .. && make && cd ../ && mkdir -p build/out/include && cp src/*.h build/out/include' ,
67
+ buildCommands : [
68
+ 'mkdir -p build' ,
69
+ 'cd build' ,
70
+ 'cmake ..' ,
71
+ 'make' ,
72
+ 'mkdir -p out/include' ,
73
+ 'cp ../src/*.h out/include' ,
74
+ ] ,
68
75
} ) ;
69
76
70
77
export const docsCommander = new Commanders ( {
71
78
name : 'docs' ,
72
79
srcDir : 'src' ,
73
80
buildDir : 'build' ,
74
- buildCommand : 'mkdir -p build && cp src/* build' ,
81
+ buildCommands : [
82
+ 'mkdir -p build' ,
83
+ 'cp src/* build' ,
84
+ ] ,
75
85
} ) ;
76
86
77
87
export const javaCommander = new Commanders ( {
78
88
name : 'java' ,
79
89
srcDir : 'src/main/java/org/algorithm_visualizer/tracers' ,
80
90
buildDir : 'build/libs' ,
81
- buildCommand : './gradlew shadowJar' ,
91
+ buildCommands : [
92
+ './gradlew shadowJar' ,
93
+ ] ,
82
94
} ) ;
83
95
84
96
export const jsCommander = new Commanders ( {
85
97
name : 'js' ,
86
98
srcDir : 'src' ,
87
99
buildDir : 'build' ,
88
- buildCommand : 'npm install && npm run build' ,
100
+ buildCommands : [
101
+ 'npm install' ,
102
+ 'npm run build' ,
103
+ ] ,
89
104
} ) ;
0 commit comments