From 58d248e6d12cca12f40b7aac3ee584d47a5aba15 Mon Sep 17 00:00:00 2001 From: Yong Bakos Date: Wed, 7 Jun 2017 16:24:25 -0700 Subject: [PATCH 1/2] Add trailing line break to Sketch.java template. --- .../templates/new_java_ant_project/Sketch.java.template | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Commands/templates/new_java_ant_project/Sketch.java.template b/Commands/templates/new_java_ant_project/Sketch.java.template index 4ac1981..7e8d060 100644 --- a/Commands/templates/new_java_ant_project/Sketch.java.template +++ b/Commands/templates/new_java_ant_project/Sketch.java.template @@ -3,13 +3,13 @@ package $package_name; import processing.core.*; public class Sketch extends PApplet { - + public void setup() { - + } public void draw() { - + } -} \ No newline at end of file +} From 60410136a16a212410308015911b2c2a93c66b4c Mon Sep 17 00:00:00 2001 From: Yong Bakos Date: Wed, 7 Jun 2017 16:41:36 -0700 Subject: [PATCH 2/2] Ant project command: add lib directory. Create an empty lib directory when generating the project boilerplate. Add an ant task to add the lib jar classes to the final application jar. Update readme. --- .../new_java_ant_project/build.xml.template | 15 ++++++++++++--- Processing.py | 11 +++++++---- README.md | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Commands/templates/new_java_ant_project/build.xml.template b/Commands/templates/new_java_ant_project/build.xml.template index 1646ece..f078a02 100644 --- a/Commands/templates/new_java_ant_project/build.xml.template +++ b/Commands/templates/new_java_ant_project/build.xml.template @@ -3,6 +3,7 @@ + @@ -11,13 +12,20 @@ + + + - + + + + + - + @@ -34,7 +42,7 @@ - @@ -45,6 +53,7 @@ + diff --git a/Processing.py b/Processing.py index 1617a94..9a95dfd 100644 --- a/Processing.py +++ b/Processing.py @@ -18,7 +18,7 @@ def run(self): "com.foo.appname or simplepackagename", functools.partial(self.generate_project), None, None) - + def generate_project(self, package_name): generated_source_path = os.path.join(self.window.folders()[0], SOURCE_DIRECTORY_NAME, @@ -29,15 +29,18 @@ def generate_project(self, package_name): package_name) self.window.open_file(os.path.join(generated_source_path, SKETCH_FILE_NAME)) sublime.status_message(STATUS_MESSAGE) - + def create_project_directories(self, path): if not os.path.exists(path): os.makedirs(path) - + lib_directory = os.path.join(self.window.folders()[0], 'lib') + if not os.path.exists(lib_directory): + os.mkdir(lib_directory) + def generate_files_from_template(self, template_path, generated_source_path, package_name): self.generate_buildfile(template_path, package_name) self.generate_java_boilerplate(template_path, generated_source_path, package_name) - + def generate_buildfile(self, template_path, package_name): with open(os.path.join(template_path, BUILDFILE_TEMPLATE_NAME), 'r') as build_template: template = string.Template(build_template.read()) diff --git a/README.md b/README.md index 379ba44..82645e3 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Make sure that the variable `DEFAULT_PROCESSING_LIBRARY_PATH` within the file `P 5. Use **⌘B** to build and run your sketch. Out of the box, you should see a full screen app that displays the default 200x200px gray sketch, which is the Processing default. You can now implement `setup` and `draw`, add additional classes to your sketch, and run it with **⌘B**. Just be sure that _Ant_ is the active build system. +You can add library jars to the `lib` subdirectory and `ant` will bundle it up with your project's generated jar file. ## Getting Started with Sublime Text