@@ -5,11 +5,11 @@ import * as tracers from './specs/tracers';
55import * as randomizers from './specs/randomizers' ;
66
77class Commanders {
8- constructor ( { name, srcDir, buildDir, buildCommand } ) {
8+ constructor ( { name, srcDir, buildDir, buildCommands } ) {
99 this . name = name ;
1010 this . srcDir = srcDir ;
1111 this . buildDir = buildDir ;
12- this . buildCommand = buildCommand ;
12+ this . buildCommands = buildCommands ;
1313 }
1414
1515 get cwd ( ) {
@@ -47,7 +47,7 @@ class Commanders {
4747 build ( ) {
4848 fs . removeSync ( this . buildPath ) ;
4949 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 } ) ;
5151 buildProcess . stdout . pipe ( process . stdout ) ;
5252 buildProcess . stderr . pipe ( process . stderr ) ;
5353 buildProcess . on ( 'exit' , code => {
@@ -64,26 +64,41 @@ export const cppCommander = new Commanders({
6464 name : 'cpp' ,
6565 srcDir : 'src' ,
6666 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+ ] ,
6875} ) ;
6976
7077export const docsCommander = new Commanders ( {
7178 name : 'docs' ,
7279 srcDir : 'src' ,
7380 buildDir : 'build' ,
74- buildCommand : 'mkdir -p build && cp src/* build' ,
81+ buildCommands : [
82+ 'mkdir -p build' ,
83+ 'cp src/* build' ,
84+ ] ,
7585} ) ;
7686
7787export const javaCommander = new Commanders ( {
7888 name : 'java' ,
7989 srcDir : 'src/main/java/org/algorithm_visualizer/tracers' ,
8090 buildDir : 'build/libs' ,
81- buildCommand : './gradlew shadowJar' ,
91+ buildCommands : [
92+ './gradlew shadowJar' ,
93+ ] ,
8294} ) ;
8395
8496export const jsCommander = new Commanders ( {
8597 name : 'js' ,
8698 srcDir : 'src' ,
8799 buildDir : 'build' ,
88- buildCommand : 'npm install && npm run build' ,
100+ buildCommands : [
101+ 'npm install' ,
102+ 'npm run build' ,
103+ ] ,
89104} ) ;
0 commit comments