Skip to content

Commit b5a7dcf

Browse files
committed
Initial commit with library template
0 parents  commit b5a7dcf

19 files changed

+1781
-0
lines changed

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
The following describes how to set up a Processing Library project in Eclipse and build it successfully, and to make your Library ready for distribution.
2+
3+
## Import to Eclipse
4+
5+
There are two options to import the template project into Eclipse: using a Git [fork](https://help.github.com/articles/fork-a-repo) or using a downloaded package. If you are not familiar with Git or GitHub, you should opt for the downloaded package.
6+
7+
### Option A: GitHub
8+
9+
1. Fork the template repository to use as a starting point.
10+
* Navigate to https://github.com/processing/processing-library-template in your browser.
11+
* Click the "Fork" button in the top-right of the page.
12+
* Once your fork is ready, open the new repository's "Settings" by clicking the link in the menu bar on the right.
13+
* Change the repository name to the name of your Library and save your changes.
14+
* NOTE: GitHub only allows you to fork a project once. If you need to create multiple forks, you can follow these [instructions](http://adrianshort.org/2011/11/08/create-multiple-forks-of-a-github-repo/).
15+
1. Clone your new repository to your Eclipse workspace.
16+
* Open Eclipse and select the File → Import... menu item.
17+
* Select Git → Projects from Git, and click "Next >".
18+
* Select "URI" and click "Next >".
19+
* Enter your repository's clone URL in the "URI" field. The remaining fields in the "Location" and "Connection" groups will get automatically filled in.
20+
* Enter your GitHub credentials in the "Authentication" group, and click "Next >".
21+
* Select the `master` branch on the next screen, and click "Next >".
22+
* The default settings on the "Local Configuration" screen should work fine, click "Next >".
23+
* Make sure "Import existing projects" is selected, and click "Next >".
24+
* Eclipse should find and select the `processing-library-template` automatically, click "Finish".
25+
1. Rename your Eclipse project.
26+
* In the Package Explorer, right-click (ctrl-click) on the folder icon of the `processing-library-template` project, and select Refactor → Rename... from the menu that pops up.
27+
* Give the project the name of your Library, and click "OK".
28+
29+
### Option B: Downloaded Package
30+
31+
1. Download the latest Eclipse template from [here](https://github.com/processing/processing-library-template/releases). **Don't unzip the ZIP file yet.**
32+
1. Create a new Java project in Eclipse.
33+
* From the menubar choose File → New → Java Project.
34+
* Give the project the name of your Library.
35+
* Click "Finish".
36+
1. Import the template source files.
37+
* Right-click (ctrl-click) onto the folder icon of your newly created project in the Package Explorer and select "Import..." from the menu that pops up.
38+
* Select General → Archive File, and click "Next >".
39+
* Navigate to the ZIP file you downloaded earlier in step 1, and click "Finish".
40+
41+
## Set Up and Compile
42+
43+
1. Add Processing to the project build path.
44+
* Open your project's "Properties" window.
45+
* Under "Java Build Path", select the "Libraries" tab and then "Add External JARs...".
46+
* Locate and add Processing's `core.jar` to your build path. It is recommended that a copy of `core.jar` is located in your Eclipse workspace in a `libs` folder. If the `libs` folder does not exist yet, create it. Read the [section below](#AddingJARs) regarding where to find the `core.jar` file.
47+
* Confirm the setup with "OK".
48+
1. Edit the Library properties.
49+
* Open the `resources` folder inside of your Java project and double-click the `build.properties` file. You should see its contents in the Eclipse editor.
50+
* Edit the properties file, making changes to items 1-4 so that the values and paths are properly set for your project to compile. A path can be relative or absolute.
51+
* Make changes to items under 5. These are metadata used in the automatically generated HTML, README, and properties documents.
52+
1. Compile your Library using Ant.
53+
* From the menu bar, choose Window → Show View → Ant. A tab with the title "Ant" will pop up on the right side of your Eclipse editor.
54+
* Drag the `resources/build.xml` file in there, and a new item "ProcessingLibs" will appear.
55+
* Press the "Play" button inside the "Ant" tab.
56+
1. BUILD SUCCESSFUL. The Library template will start to compile, control messages will appear in the console window, warnings can be ignored. When finished it should say BUILD SUCCESSFUL. Congratulations, you are set and you can start writing your own Library by making changes to the source code in folder `src`.
57+
1. BUILD FAILED. In case the compile process fails, check the output in the console which will give you a closer idea of what went wrong. Errors may have been caused by
58+
* Incorrect path settings in the `build.properties` file.
59+
* Error "Javadoc failed". if you are on Windows, make sure you are using a JDK instead of a JRE in order to be able to create the Javadoc for your Library. JRE does not come with the Javadoc application, but it is required to create Libraries from this template.
60+
61+
After having compiled and built your project successfully, you should be able to find your Library in Processing's sketchbook folder, examples will be listed in Processing's sketchbook menu. Files that have been created for the distribution of the Library are located in your Eclipse's `workspace/yourProject/distribution` folder. In there you will also find the `web` folder which contains the documentation, a ZIP file for downloading your Library, a folder with examples as well as the `index.html` and CSS file.
62+
63+
To distribute your Library please refer to the [Library Guidelines](https://github.com/processing/processing/wiki/Library-Guidelines).
64+
65+
## Source code
66+
67+
If you want to share your Library's source code, we recommend using an online repository available for free at [GitHub](https://github.com/).
68+
69+
## <a name='AddingJARs'/>Adding core.jar and other .jar files to your classpath</a>
70+
71+
The `core.jar` file contains the core classes of Processing and has to be part of your classpath when building a Library. On Windows and Linux, this file is located in the Processing distribution folder inside a folder named `lib`. On Mac OS X, right-click the Processing.app and use "Show Package Contents" to see the guts. The `core.jar` file is inside Contents → Resources → Java. For further information about the classes in `core.jar`, you can see the source [here](http://code.google.com/p/processing/source/browse/trunk/processing#processing/core) and the developer documentation [here](http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/index.html).
72+
73+
If you created a `libs` folder as described above, put the libraries you need to add to your classpath in there. In the "Properties" of your Java project, navigate to Java Build Path → Libraries, and click "Add External JARs...". Select the `.jar` files from the `libs` folder that are required for compiling your project. Adjust the `build.xml` file accordingly.
74+
75+
The `libs` folder is recommended but not a requirement, nevertheless you need to specify where your `.jar` files are located in your system in order to add them to the classpath.
76+
77+
In case a Library depends on system libraries, put these dependencies next to the `.jar` file. For example, Processing's `opengl.jar` Library depends on JOGL hence the DLLs (for Windows) or jnilibs (for OS X) have to be located next to the `opengl.jar` file.
78+
79+
## What is the difference between JDK and JRE?
80+
81+
JDK stands for Java Development Kit whereas JRE stands for Java Runtime Environment. For developers it is recommended to work with a JDK instead of a JRE since more Java development related applications such as Javadoc are included. Javadoc is a requirement to properly compile and document a Processing Library as described on the guidelines page.
82+
83+
You can have both a JDK and a JRE installed on your system. In Eclipse you need to specify which one you want to use.
84+
85+
## The JRE System Library
86+
87+
This primarily affects Windows and Linux users (because the full JDK is installed by default on Mac OS X). It is recommended that you use the JDK instead of a JRE. The JDK can be downloaded from [Oracle's download site](http://www.oracle.com/technetwork/java/javase/downloads/index.html). Also see the [Java Platform Installation page](http://www.oracle.com/technetwork/java/javase/index-137561.html), which contains useful information.
88+
89+
To change the JRE used to compile your Java project:
90+
91+
1. Open the properties of your project from the menu Project → Properties. Select "Java Build Path" and in its submenu, click on the "Libraries" tab.
92+
1. A list of JARs and class folders in the build path will show up. In this list you can find the JRE System Library that is used to compile your code. Remove this JRE System library.
93+
1. Click "Add Library...". In the popup window, choose "JRE System Library" and press "Next".
94+
1. Select an alternate JRE from the pull-down menu or click and modify the "Installed JREs". Confirm with "Finish" and "OK".
95+
96+
## Compiling with Ant and javadoc
97+
98+
Ant is a Java-based build tool. For [more information](http://ant.apache.org/faq.html#what-is-ant) visit the [Ant web site](http://ant.apache.org/). Ant uses a file named `build.xml` to store build settings for a project.
99+
100+
Javadoc is an application that creates an HTML-based API documentation of Java code. You can check for its existence by typing `javadoc` on the command line. On Mac OS X, it is installed by default. On Windows and Linux, installing the JDK will also install the Javadoc tool.
1.17 KB
Binary file not shown.

data/README

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
the data folder:
2+
If your Library is using files like images, sound files,
3+
any data file, etc., put them into the data folder.
4+
When coding your Library you can use processing's internal loading
5+
functions like loadImage(), loadStrings(), etc. to load files
6+
located inside the data folder into your Library.
7+

examples/Hello/Hello.pde

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import template.library.*;
2+
3+
HelloLibrary hello;
4+
5+
void setup() {
6+
size(400,400);
7+
smooth();
8+
9+
hello = new HelloLibrary(this);
10+
11+
PFont font = createFont("",40);
12+
textFont(font);
13+
}
14+
15+
void draw() {
16+
background(0);
17+
fill(255);
18+
text(hello.sayHello(), 40, 200);
19+
}

examples/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add examples for your Library here.

lib/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The lib folder:
2+
In case your Library requires 3rd party libraries, which need to be
3+
added to the distribution, put them into the lib folder.
4+
These 3rd party libraries will be added to your distribution and are
5+
located next to your Library's jar file.
6+
This does not apply to .jar files that are considered core processing libraries.

license.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
A template to build a Library for the Processing programming environment.
2+
3+
Part of the Processing project - http://processing.org
4+
5+
Copyright 2011-2015 Elie Zananiri
6+
Copyright 2008-2011 Andreas Shlegel
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.

resources/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## How to install ##library.name##
2+
3+
### Install with the Contribution Manager
4+
5+
Add contributed Libraries by selecting the menu item _Sketch__Import Library...__Add Library..._ This will open the Contribution Manager, where you can browse for ##library.name##, or any other Library you want to install.
6+
7+
Not all available Libraries have been converted to show up in this menu. If a Library isn't there, it will need to be installed manually by following the instructions below.
8+
9+
### Manual Install
10+
11+
Contributed Libraries may be downloaded separately and manually placed within the `libraries` folder of your Processing sketchbook. To find (and change) the Processing sketchbook location on your computer, open the Preferences window from the Processing application (PDE) and look for the "Sketchbook location" item at the top.
12+
13+
By default the following locations are used for your sketchbook folder:
14+
* For Mac users, the sketchbook folder is located inside `~/Documents/Processing`
15+
* For Windows users, the sketchbook folder is located inside `My Documents/Processing`
16+
17+
Download ##library.name## from ##library.url##
18+
19+
Unzip and copy the contributed Library's folder into the `libraries` folder in the Processing sketchbook. You will need to create this `libraries` folder if it does not exist.
20+
21+
The folder structure for Library ##library.name## should be as follows:
22+
23+
```
24+
Processing
25+
libraries
26+
##library.name##
27+
examples
28+
library
29+
##library.name##.jar
30+
reference
31+
src
32+
```
33+
34+
Some folders like `examples` or `src` might be missing. After Library ##library.name## has been successfully installed, restart the Processing application.
35+
36+
### Troubleshooting
37+
38+
If you're having trouble, have a look at the [Processing Wiki](https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library) for more information, or contact the author [##author.name##](##author.url##).

resources/build.properties

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Create a Library for the Processing open source programming language and
2+
# environment (http://processing.org/)
3+
#
4+
# Customize the build properties to make the ant-build-process work for your
5+
# environment. How? Please read the comments below.
6+
#
7+
# The default properties are set for OS X. Please refer to comments for Windows
8+
# settings.
9+
10+
11+
# Where is your Processing sketchbook located?
12+
# If you are not sure, check the sketchbook location in your Processing
13+
# application preferences.
14+
# ${user.home} points the compiler to your home directory.
15+
# For windows the default path to your sketchbook would be
16+
# ${user.home}/My Documents/Processing (make adjustments below)
17+
18+
#sketchbook.location=${user.home}/My Documents/Processing
19+
sketchbook.location=${user.home}/Documents/Processing
20+
21+
22+
# Where are the jar files located that are required for compiling your Library
23+
# such as e.g. core.jar?
24+
# By default the local classpath location points to folder libs inside Eclipse's
25+
# workspace (by default found in your home directory).
26+
# For Windows, the default path would be
27+
# ${user.home}/Documents/workspace/libs (make adjustments below)
28+
# For OS X,the following path will direct you into Processing's application
29+
# package, in case you put Processing inside your Applications folder.
30+
31+
#classpath.local.location=${user.home}/Documents/workspace/libs
32+
classpath.local.location=/Applications/Processing.app/Contents/Java/core/library
33+
34+
35+
# Add all jar files that are required for compiling your project to the local
36+
# and project classpath. Use a comma as delimiter. These jar files must be
37+
# inside your classpath.local.location folder.
38+
39+
classpath.local.include=core.jar
40+
41+
42+
# Add processing's libraries folder to the classpath.
43+
# If you don't need to include the libraries folder to your classpath, comment
44+
# out the following line.
45+
46+
classpath.libraries.location=${sketchbook.location}/libraries
47+
48+
49+
# Set the java version that should be used to compile your Library.
50+
51+
java.target.version=1.7
52+
53+
54+
# Set the description of the Ant build.xml file.
55+
56+
ant.description=Processing Library Ant build file.
57+
58+
59+
# Give your Library a name. The name must not contain spaces or special
60+
# characters.
61+
62+
project.name=YourLibrary
63+
64+
65+
# The name as the user will see it. This can contain spaces and special
66+
# characters.
67+
68+
project.prettyName=Your Library
69+
70+
71+
# Use 'normal' or 'fast' as value for project.compile.
72+
# 'fast' will only compile the project into your sketchbook.
73+
# 'normal' will compile the distribution including the javadoc-reference and all
74+
# web-files (the compile process here takes longer).
75+
# All files compiled with project.compile=normal are stored in the distribution
76+
# folder.
77+
78+
project.compile=normal
79+
80+
81+
# Set your name and URL, used for the web page and properties file.
82+
83+
author.name=Your Name
84+
author.url=http://yoururl.com
85+
86+
87+
# Set the web page for your Library.
88+
# This is NOT a direct link to where to download it.
89+
90+
library.url=http://yourlibraryname.com
91+
92+
93+
# Set the category (or categories) of your Library from the following list:
94+
# "3D" "Animation" "Compilations" "Data"
95+
# "Fabrication" "Geometry" "GUI" "Hardware"
96+
# "I/O" "Language" "Math" "Simulation"
97+
# "Sound" "Utilities" "Typography" "Video & Vision"
98+
#
99+
# If a value other than those listed is used, your Library will listed as
100+
# "Other". Many categories must be comma-separated.
101+
102+
library.categories=Other
103+
104+
105+
# A short sentence (or fragment) to summarize the Library's function. This will
106+
# be shown from inside the PDE when the Library is being installed. Avoid
107+
# repeating the name of your Library here. Also, avoid saying anything redundant
108+
# like mentioning that it's a Library. This should start with a capitalized
109+
# letter, and end with a period.
110+
111+
library.sentence=A collection of utilities for solving this and that problem.
112+
113+
114+
# Additional information suitable for the Processing website. The value of
115+
# 'sentence' always will be prepended, so you should start by writing the
116+
# second sentence here. If your Library only works on certain operating systems,
117+
# mention it here.
118+
119+
library.paragraph=
120+
121+
122+
# Set the source code repository for your project.
123+
# Recommendations for storing your source code online are GitHub or Google Code.
124+
125+
source.host=GitHub
126+
source.url=https://github.com/YourName/YourProject
127+
source.repository=https://github.com/YourName/YourProject.git
128+
129+
130+
# The current version of your Library.
131+
# This number must be parsable as an int. It increments once with each release.
132+
# This is used to compare different versions of the same Library, and check if
133+
# an update is available.
134+
135+
library.version=1
136+
137+
138+
# The version as the user will see it.
139+
140+
library.prettyVersion=1.0.0
141+
142+
143+
# The min and max revision of Processing compatible with your Library.
144+
# Note that these fields use the revision and not the version of Processing,
145+
# parsable as an int. For example, the revision number for 2.2.1 is 227.
146+
# You can find the revision numbers in the change log: https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt
147+
# Only use maxRevision (or minRevision), when your Library is known to
148+
# break in a later (or earlier) release. Otherwise, use the default value 0.
149+
150+
compatible.minRevision=0
151+
compatible.maxRevision=0
152+
153+
154+
# The platforms and Processing version that the Library has been tested
155+
# against. This information is only used in the generated webpage.
156+
157+
tested.platform=osx,windows
158+
tested.processingVersion=3.0
159+
160+
161+
# Additional information for the generated webpage.
162+
163+
library.copyright=(c) 2015
164+
library.dependencies=?
165+
library.keywords=?
166+
167+
168+
# Include javadoc references into your project's javadocs.
169+
170+
javadoc.java.href=http://docs.oracle.com/javase/7/docs/api/
171+
javadoc.processing.href=http://processing.org/reference/javadoc/core/

0 commit comments

Comments
 (0)