Skip to content

Commit 32c1152

Browse files
committed
Input buildCommands as array
1 parent fda862d commit 32c1152

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

commanders.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as tracers from './specs/tracers';
55
import * as randomizers from './specs/randomizers';
66

77
class 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

7077
export 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

7787
export 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

8496
export 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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy