Skip to content

Commit c784e1c

Browse files
rpoiselRainer Poisel
authored and
Rainer Poisel
committed
Dumping executed commands; build-script improvmenets
1 parent 779a4d7 commit c784e1c

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
bin/
22
dist/
3+
*.swp

Diff for: make.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
#!/usr/bin/env bash
22

33
if [[ -z "$INSTALLDIR" ]]; then
4-
INSTALLDIR="$HOME/Documents/Arduino"
4+
if [[ -z "$TAG" ]]; then
5+
TAG=1.6.12
6+
fi
7+
INSTALLDIR="$HOME/Arduino-$TAG/build/linux/work"
8+
fi
9+
if [[ -L "$INSTALLDIR" ]]; then
10+
INSTALLDIR=$INSTALLDIR/
511
fi
612
echo "INSTALLDIR: $INSTALLDIR"
713

8-
pde_path=`find ../../../ -name pde.jar`
9-
core_path=`find ../../../ -name arduino-core.jar`
10-
lib_path=`find ../../../ -name commons-codec-1.7.jar`
14+
pde_path=`find ${INSTALLDIR} -name pde.jar`
15+
core_path=`find ${INSTALLDIR} -name arduino-core.jar`
16+
lib_path=`find ${INSTALLDIR} -name commons-codec-1.7.jar`
1117
if [[ -z "$core_path" || -z "$pde_path" ]]; then
1218
echo "Some java libraries have not been built yet (did you run ant build?)"
13-
return 1
19+
exit 1
1420
fi
1521
echo "pde_path: $pde_path"
1622
echo "core_path: $core_path"

Diff for: src/ESP8266FS.java

+23-3
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ private void createAndUpload(){
284284
System.out.println("[SPIFFS] block : "+spiBlock);
285285

286286
try {
287-
if(listenOnProcess(new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", (spiEnd - spiStart)+"", imagePath}) != 0){
287+
String[] buildCmd = new String[]{toolPath, "-c", dataPath, "-p", spiPage+"", "-b", spiBlock+"", "-s", (spiEnd - spiStart)+"", imagePath};
288+
dumpCommand(buildCmd, "build.verbose");
289+
if(listenOnProcess(buildCmd) != 0){
288290
System.err.println();
289291
editor.statusError("SPIFFS Create Failed!");
290292
return;
@@ -298,6 +300,7 @@ private void createAndUpload(){
298300
editor.statusNotice("SPIFFS Uploading Image...");
299301
System.out.println("[SPIFFS] upload : "+imagePath);
300302

303+
String[] uploadCmd;
301304
if(isNetwork){
302305
String pythonCmd;
303306
if(PreferencesData.get("runtime.os").contentEquals("windows"))
@@ -307,18 +310,35 @@ private void createAndUpload(){
307310

308311
System.out.println("[SPIFFS] IP : "+serialPort);
309312
System.out.println();
310-
sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath});
313+
uploadCmd = new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath};
311314
} else {
312315
System.out.println("[SPIFFS] address: "+uploadAddress);
313316
System.out.println("[SPIFFS] reset : "+resetMethod);
314317
System.out.println("[SPIFFS] port : "+serialPort);
315318
System.out.println("[SPIFFS] speed : "+uploadSpeed);
316319
System.out.println();
317-
sysExec(new String[]{esptool.getAbsolutePath(), "-cd", resetMethod, "-cb", uploadSpeed, "-cp", serialPort, "-ca", uploadAddress, "-cf", imagePath});
320+
uploadCmd = new String[]{esptool.getAbsolutePath(), "-cd", resetMethod, "-cb", uploadSpeed, "-cp", serialPort, "-ca", uploadAddress, "-cf", imagePath};
318321
}
322+
dumpCommand(uploadCmd, "upload.verbose");
323+
sysExec(uploadCmd);
319324
}
320325

321326
public void run() {
322327
createAndUpload();
323328
}
329+
330+
private void dumpCommand(String[] fragments, String preference) {
331+
if (!PreferencesData.getBoolean(preference)) {
332+
return;
333+
}
334+
335+
StringBuffer commandBuf = new StringBuffer(128);
336+
for (int cnt = 0; cnt < fragments.length; cnt++) {
337+
commandBuf.append(fragments[cnt]);
338+
if (cnt < fragments.length - 1) {
339+
commandBuf.append(" ");
340+
}
341+
}
342+
System.out.println(commandBuf.toString());
343+
}
324344
}

0 commit comments

Comments
 (0)