Skip to content

Commit 96c4576

Browse files
author
Federico Fissore
committed
Added --preserve-temp-files command line option
1 parent 3465fcf commit 96c4576

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

app/src/processing/app/Base.java

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ protected void onProgress(Progress progress) {
404404
// Set verbosity for command line build
405405
Preferences.set("build.verbose", "" + parser.isDoVerboseBuild());
406406
Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload());
407+
Preferences.set("runtime.preserve.temp.files", Boolean.toString(parser.isPreserveTempFiles()));
407408

408409
// Make sure these verbosity preferences are only for the
409410
// current session

arduino-core/src/cc/arduino/files/DeleteFilesOnShutdown.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.arduino.files;
22

3+
import processing.app.PreferencesData;
34
import processing.app.helpers.FileUtils;
45

56
import java.io.File;
@@ -27,6 +28,10 @@ public synchronized void addFile(File file) {
2728

2829
@Override
2930
public void run() {
31+
boolean preserveTempFiles = PreferencesData.getBoolean("runtime.preserve.temp.files");
32+
if (preserveTempFiles) {
33+
return;
34+
}
3035
List<File> copyOfFiles;
3136
synchronized (this) {
3237
copyOfFiles = new LinkedList<File>(files);

arduino-core/src/processing/app/helpers/CommandlineParser.java

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private enum ACTION {
3636
private boolean doVerboseBuild = false;
3737
private boolean doVerboseUpload = false;
3838
private boolean doUseProgrammer = false;
39+
private boolean preserveTempFiles;
3940
private boolean noUploadPort = false;
4041
private boolean forceSavePrefs = false;
4142
private String getPref;
@@ -105,6 +106,12 @@ private void parseArguments(String[] args) {
105106
action = ACTION.NOOP;
106107
continue;
107108
}
109+
if (args[i].equals("--preserve-temp-files")) {
110+
preserveTempFiles = true;
111+
if (action == ACTION.GUI)
112+
action = ACTION.NOOP;
113+
continue;
114+
}
108115
if (args[i].equals("--verbose-build")) {
109116
doVerboseBuild = true;
110117
if (action == ACTION.GUI)
@@ -330,4 +337,8 @@ public String getBoardToInstall() {
330337
public String getLibraryToInstall() {
331338
return libraryToInstall;
332339
}
340+
341+
public boolean isPreserveTempFiles() {
342+
return preserveTempFiles;
343+
}
333344
}

build/shared/manpage.adoc

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SYNOPSIS
2525
--------
2626
*arduino* ['FILE.ino'...]
2727

28-
*arduino* [*--verify*|*--upload*] [*--board* __package__:__arch__:__board__[:__parameters__]] [*--port* __portname__] [*--pref* __name__=__value__] [*-v*|*--verbose*] [__FILE.ino__]
28+
*arduino* [*--verify*|*--upload*] [*--board* __package__:__arch__:__board__[:__parameters__]] [*--port* __portname__] [*--pref* __name__=__value__] [*-v*|*--verbose*] [--preserve-temp-files] [__FILE.ino__]
2929

3030
*arduino* [*--get-pref* __preference__]
3131

@@ -117,6 +117,10 @@ OPTIONS
117117
verbose mode during build is *disabled* regardless of the current
118118
preferences.
119119

120+
*--preserve-temp-files*::
121+
Keep temporary files (preprocessed sketch, object files...) after termination.
122+
If omitted, temporary files are deleted.
123+
120124
{empty}::
121125
This option is only valid together with *--verify* or
122126
*--upload*.

0 commit comments

Comments
 (0)