diff options
author | Florian Dold <florian.dold@gmail.com> | 2012-04-19 11:13:31 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2012-04-19 11:13:31 +0000 |
commit | 9c9674e7427f8be8579c6d0c9893ece0764a54a1 (patch) | |
tree | 226bcfce8b21a41fb575f1b08b710089d7997131 | |
parent | 2bb44365d98e82a4cd395d5ff7388877e58eaf82 (diff) | |
download | gnunet-java-ext-9c9674e7427f8be8579c6d0c9893ece0764a54a1.tar.gz gnunet-java-ext-9c9674e7427f8be8579c6d0c9893ece0764a54a1.zip |
extension template can now be built and run, added class path configuration
-rwxr-xr-x | bin/gnunet-ext | 10 | ||||
-rwxr-xr-x | extcfg.sh | 7 | ||||
-rw-r--r-- | src/org/gnunet/ext/MyExt.java | 13 | ||||
-rwxr-xr-x | tools/build | 23 |
4 files changed, 53 insertions, 0 deletions
diff --git a/bin/gnunet-ext b/bin/gnunet-ext new file mode 100755 index 0000000..5df452f --- /dev/null +++ b/bin/gnunet-ext | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Template for a gnunet-java extension. Modify to fit your needs. | ||
4 | |||
5 | BASEDIR=`dirname $0`/.. | ||
6 | |||
7 | source $BASEDIR/extcfg.sh | ||
8 | |||
9 | java -ea -cp "$BASEDIR/build/:$BASEDIR/lib/*:$GNUNET_JAVA_CLASSPATH:$GNUNET_JAVA_DEPS/*" org.gnunet.ext.MyExt "$@" | ||
10 | |||
diff --git a/extcfg.sh b/extcfg.sh new file mode 100755 index 0000000..c4cc4fb --- /dev/null +++ b/extcfg.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # location of either the gnunet-java build directory, or the gnunet-java-jar | ||
4 | GNUNET_JAVA_CLASSPATH= # e.g. /home/<your-name>/gnunet-java/gnunet-java.jar | ||
5 | |||
6 | # location of gnunet-java's lib directory | ||
7 | GNUNET_JAVA_CLASSPATH= # e.g. /home/<your-name>/gnunet-java/lib/ | ||
diff --git a/src/org/gnunet/ext/MyExt.java b/src/org/gnunet/ext/MyExt.java new file mode 100644 index 0000000..cae90c4 --- /dev/null +++ b/src/org/gnunet/ext/MyExt.java | |||
@@ -0,0 +1,13 @@ | |||
1 | package org.gnunet.ext; | ||
2 | |||
3 | import org.gnunet.util.*; | ||
4 | |||
5 | public class MyExt { | ||
6 | public static void main(String[] args) { | ||
7 | new Program(args) { | ||
8 | public void run() { | ||
9 | System.out.println("hi"); | ||
10 | } | ||
11 | }.start(); | ||
12 | } | ||
13 | } | ||
diff --git a/tools/build b/tools/build new file mode 100755 index 0000000..944d230 --- /dev/null +++ b/tools/build | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # environment variables: | ||
4 | # $JFLAGS: additional flags passed to the java compiler | ||
5 | |||
6 | BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/.. | ||
7 | |||
8 | |||
9 | source $BASEDIR/extcfg.sh | ||
10 | |||
11 | |||
12 | # collect all source files | ||
13 | SOURCES=`find "$BASEDIR/src/" "$BASEDIR/test/" -name "*.java"` | ||
14 | |||
15 | mkdir -p $BASEDIR/build | ||
16 | |||
17 | javac $JFLAGS -cp "$BASEDIR/build/:$BASEDIR/lib/*:$GNUNET_JAVA_CLASSPATH:$GNUNET_JAVA_DEPS" -d $BASEDIR/build/ $SOURCES | ||
18 | |||
19 | cd "$BASEDIR/src/" | ||
20 | |||
21 | # collect resources from src/ and copy to build/ | ||
22 | find "." \( -name "*.txt" -o -name "*.properties" \) \ | ||
23 | -exec cp --parents '{}' "../build" \; | ||