From 70c39d802c28425a974257abc22702159254612d Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Thu, 6 Jun 2013 00:11:13 -0600 Subject: [PATCH 1/6] add default output folder for processing-java command, same as in the PDE --- app/src/processing/mode/java/Commander.java | 52 +++++++++++++++------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index fdf55848a..0878fa453 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -104,6 +104,7 @@ public class Commander implements RunnerListener { String pdePath = null; // path to the .pde file String outputPath = null; File outputFolder = null; + boolean outputSet = false; boolean force = false; // replace that no good output folder // String preferencesPath = null; int platform = PApplet.platform; // default to this platform @@ -181,6 +182,7 @@ public class Commander implements RunnerListener { } else if (arg.startsWith(outputArg)) { outputPath = arg.substring(outputArg.length()); + outputSet = true; } else if (arg.equals(forceArg)) { force = true; @@ -202,22 +204,38 @@ public class Commander implements RunnerListener { System.exit(0); } - if (outputPath == null) { + if (outputPath == null && outputSet) { complainAndQuit("An output path must be specified.", true); } - outputFolder = new File(outputPath); - if (outputFolder.exists()) { - if (force) { - Base.removeDir(outputFolder); - } else { - complainAndQuit("The output folder already exists. " + - "Use --force to remove it.", false); + if(outputSet){ + outputFolder = new File(outputPath); + if (outputFolder.exists()) { + if (force) { + Base.removeDir(outputFolder); + } else { + complainAndQuit("The output folder already exists. " + + "Use --force to remove it.", false); + } } - } + }/*else{ + System.out.println("try to make temp folder..."); + try { + System.out.println(sketch.getName()); + File buildFolder = Base.createTempFolder(sketch.getName(), "temp", null); + outputFolder = buildFolder; + } catch (IOException e) { + Base.showWarning("Build folder bad", + "Could not find a place to build the sketch.", e); + } + //outputFolder = sketch.makeTempFolder(); + System.out.println("made temp folder"); + }*/ - if (!outputFolder.mkdirs()) { - complainAndQuit("Could not create the output folder.", false); + if (outputSet){ + if(!outputFolder.mkdirs()) { + complainAndQuit("Could not create the output folder.", false); + } } // // run static initialization that grabs all the prefs @@ -232,8 +250,10 @@ public class Commander implements RunnerListener { if (sketchPath == null) { complainAndQuit("No sketch path specified.", true); - } else if (outputPath.equals(sketchPath)) { - complainAndQuit("The sketch path and output path cannot be identical.", false); + } else if (outputSet){ + if(outputPath.equals(sketchPath)) { + complainAndQuit("The sketch path and output path cannot be identical.", false); + } // } else if (!pdePath.toLowerCase().endsWith(".pde")) { // complainAndQuit("Sketch path must point to the main .pde file.", false); @@ -248,6 +268,10 @@ public class Commander implements RunnerListener { "processing.mode.java.JavaMode").getMode(); try { sketch = new Sketch(pdePath, javaMode); + + if(!outputSet) + outputFolder = sketch.makeTempFolder(); + if (task == BUILD || task == RUN || task == PRESENT) { JavaBuild build = new JavaBuild(sketch); File srcFolder = new File(outputFolder, "source"); @@ -391,4 +415,4 @@ public class Commander implements RunnerListener { public boolean isHalted() { return false; } -} \ No newline at end of file +} From b6a496d745e6aac2c7b557a96c76284744a549e6 Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Thu, 6 Jun 2013 00:18:29 -0600 Subject: [PATCH 2/6] clean up added code --- app/src/processing/mode/java/Commander.java | 37 +++++++-------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index 0878fa453..94c3f1819 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -181,8 +181,8 @@ public class Commander implements RunnerListener { // preferencesPath = arg.substring(preferencesArg.length()); } else if (arg.startsWith(outputArg)) { - outputPath = arg.substring(outputArg.length()); outputSet = true; + outputPath = arg.substring(outputArg.length()); } else if (arg.equals(forceArg)) { force = true; @@ -204,35 +204,21 @@ public class Commander implements RunnerListener { System.exit(0); } - if (outputPath == null && outputSet) { - complainAndQuit("An output path must be specified.", true); - } - - if(outputSet){ + if (outputSet) { + if (outputPath == null) { + complainAndQuit("An output path must be specified.", true); + } + outputFolder = new File(outputPath); if (outputFolder.exists()) { if (force) { Base.removeDir(outputFolder); } else { complainAndQuit("The output folder already exists. " + - "Use --force to remove it.", false); + "Use --force to remove it.", false); } } - }/*else{ - System.out.println("try to make temp folder..."); - try { - System.out.println(sketch.getName()); - File buildFolder = Base.createTempFolder(sketch.getName(), "temp", null); - outputFolder = buildFolder; - } catch (IOException e) { - Base.showWarning("Build folder bad", - "Could not find a place to build the sketch.", e); - } - //outputFolder = sketch.makeTempFolder(); - System.out.println("made temp folder"); - }*/ - - if (outputSet){ + if(!outputFolder.mkdirs()) { complainAndQuit("Could not create the output folder.", false); } @@ -250,8 +236,8 @@ public class Commander implements RunnerListener { if (sketchPath == null) { complainAndQuit("No sketch path specified.", true); - } else if (outputSet){ - if(outputPath.equals(sketchPath)) { + } else if (outputSet) { + if (outputPath.equals(sketchPath)) { complainAndQuit("The sketch path and output path cannot be identical.", false); } @@ -269,8 +255,9 @@ public class Commander implements RunnerListener { try { sketch = new Sketch(pdePath, javaMode); - if(!outputSet) + if (!outputSet) { outputFolder = sketch.makeTempFolder(); + } if (task == BUILD || task == RUN || task == PRESENT) { JavaBuild build = new JavaBuild(sketch); From 3ec33f99e4d6f3f408267d30702a571d2298d6b3 Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Fri, 7 Jun 2013 14:06:06 -0600 Subject: [PATCH 3/6] fix logical error for actually setting build folder --- app/src/processing/mode/java/Commander.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index 94c3f1819..4d36864a5 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -219,7 +219,7 @@ public class Commander implements RunnerListener { } } - if(!outputFolder.mkdirs()) { + if (!outputFolder.mkdirs()) { complainAndQuit("Could not create the output folder.", false); } } @@ -236,15 +236,17 @@ public class Commander implements RunnerListener { if (sketchPath == null) { complainAndQuit("No sketch path specified.", true); - } else if (outputSet) { - if (outputPath.equals(sketchPath)) { - complainAndQuit("The sketch path and output path cannot be identical.", false); - } - // } else if (!pdePath.toLowerCase().endsWith(".pde")) { // complainAndQuit("Sketch path must point to the main .pde file.", false); } else { + + if (outputSet) { + if (outputPath.equals(sketchPath)) { + complainAndQuit("The sketch path and output path cannot be identical.", false); + } + } + boolean success = false; // JavaMode javaMode = From 0255c6acad25fe0f44246e5d00ea1c58c7a1a429 Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Sun, 9 Jun 2013 00:42:46 -0600 Subject: [PATCH 4/6] add comment to new processing-java variable for default output folder --- app/src/processing/mode/java/Commander.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index 4d36864a5..bda76f0fa 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -104,7 +104,7 @@ public class Commander implements RunnerListener { String pdePath = null; // path to the .pde file String outputPath = null; File outputFolder = null; - boolean outputSet = false; + boolean outputSet = false; // set an output folder boolean force = false; // replace that no good output folder // String preferencesPath = null; int platform = PApplet.platform; // default to this platform From 56f8700168b76bd08cfb1cc98a23ce579023099d Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Sun, 9 Jun 2013 00:44:12 -0600 Subject: [PATCH 5/6] update processing-java documentation since output is no longer required --- app/src/processing/mode/java/Commander.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index bda76f0fa..55c63c351 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -363,7 +363,7 @@ public class Commander implements RunnerListener { out.println("--help Show this help text. Congratulations."); out.println(); out.println("--sketch= Specify the sketch folder (required)"); - out.println("--output= Specify the output folder (required and"); + out.println("--output= Specify the output folder (optional and"); out.println(" cannot be the same as the sketch folder.)"); out.println(); out.println("--force The sketch will not build if the output"); From b6ce33c79a85ec12e34360db15b2bc576edd5c0c Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Wed, 22 Jan 2014 15:27:16 -0700 Subject: [PATCH 6/6] fix merge issues with 2.1.1 --- app/src/processing/mode/java/Commander.java | 26 +++++---------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/app/src/processing/mode/java/Commander.java b/app/src/processing/mode/java/Commander.java index 0fe68c48c..a6405eee3 100644 --- a/app/src/processing/mode/java/Commander.java +++ b/app/src/processing/mode/java/Commander.java @@ -196,12 +196,11 @@ public class Commander implements RunnerListener { System.exit(0); } -<<<<<<< HEAD if (outputSet) { if (outputPath == null) { complainAndQuit("An output path must be specified.", true); } - + outputFolder = new File(outputPath); if (outputFolder.exists()) { if (force) { @@ -211,22 +210,9 @@ public class Commander implements RunnerListener { "Use --force to remove it.", false); } } - + if (!outputFolder.mkdirs()) { complainAndQuit("Could not create the output folder.", false); -======= - if (outputPath == null) { - complainAndQuit("An output path must be specified.", true); - } - - outputFolder = new File(outputPath); - if (outputFolder.exists()) { - if (force) { - Base.removeDir(outputFolder); - } else { - complainAndQuit("The output folder already exists. " + - "Use --force to remove it.", false); ->>>>>>> remotes/upstream/master } } @@ -246,13 +232,13 @@ public class Commander implements RunnerListener { // complainAndQuit("Sketch path must point to the main .pde file.", false); } else { - + if (outputSet) { if (outputPath.equals(sketchPath)) { complainAndQuit("The sketch path and output path cannot be identical.", false); } } - + boolean success = false; // JavaMode javaMode = @@ -262,11 +248,11 @@ public class Commander implements RunnerListener { "processing.mode.java.JavaMode").getMode(); try { sketch = new Sketch(pdePath, javaMode); - + if (!outputSet) { outputFolder = sketch.makeTempFolder(); } - + if (task == BUILD || task == RUN || task == PRESENT) { JavaBuild build = new JavaBuild(sketch); File srcFolder = new File(outputFolder, "source");