Added --preserve-temp-files command line option

This commit is contained in:
Federico Fissore 2015-04-15 11:00:01 +02:00
parent 3465fcf97b
commit 96c4576962
4 changed files with 22 additions and 1 deletions

View File

@ -404,6 +404,7 @@ public class Base {
// Set verbosity for command line build
Preferences.set("build.verbose", "" + parser.isDoVerboseBuild());
Preferences.set("upload.verbose", "" + parser.isDoVerboseUpload());
Preferences.set("runtime.preserve.temp.files", Boolean.toString(parser.isPreserveTempFiles()));
// Make sure these verbosity preferences are only for the
// current session

View File

@ -1,5 +1,6 @@
package cc.arduino.files;
import processing.app.PreferencesData;
import processing.app.helpers.FileUtils;
import java.io.File;
@ -27,6 +28,10 @@ public class DeleteFilesOnShutdown implements Runnable {
@Override
public void run() {
boolean preserveTempFiles = PreferencesData.getBoolean("runtime.preserve.temp.files");
if (preserveTempFiles) {
return;
}
List<File> copyOfFiles;
synchronized (this) {
copyOfFiles = new LinkedList<File>(files);

View File

@ -36,6 +36,7 @@ public class CommandlineParser {
private boolean doVerboseBuild = false;
private boolean doVerboseUpload = false;
private boolean doUseProgrammer = false;
private boolean preserveTempFiles;
private boolean noUploadPort = false;
private boolean forceSavePrefs = false;
private String getPref;
@ -105,6 +106,12 @@ public class CommandlineParser {
action = ACTION.NOOP;
continue;
}
if (args[i].equals("--preserve-temp-files")) {
preserveTempFiles = true;
if (action == ACTION.GUI)
action = ACTION.NOOP;
continue;
}
if (args[i].equals("--verbose-build")) {
doVerboseBuild = true;
if (action == ACTION.GUI)
@ -330,4 +337,8 @@ public class CommandlineParser {
public String getLibraryToInstall() {
return libraryToInstall;
}
public boolean isPreserveTempFiles() {
return preserveTempFiles;
}
}

View File

@ -25,7 +25,7 @@ SYNOPSIS
--------
*arduino* ['FILE.ino'...]
*arduino* [*--verify*|*--upload*] [*--board* __package__:__arch__:__board__[:__parameters__]] [*--port* __portname__] [*--pref* __name__=__value__] [*-v*|*--verbose*] [__FILE.ino__]
*arduino* [*--verify*|*--upload*] [*--board* __package__:__arch__:__board__[:__parameters__]] [*--port* __portname__] [*--pref* __name__=__value__] [*-v*|*--verbose*] [--preserve-temp-files] [__FILE.ino__]
*arduino* [*--get-pref* __preference__]
@ -117,6 +117,10 @@ OPTIONS
verbose mode during build is *disabled* regardless of the current
preferences.
*--preserve-temp-files*::
Keep temporary files (preprocessed sketch, object files...) after termination.
If omitted, temporary files are deleted.
{empty}::
This option is only valid together with *--verify* or
*--upload*.