You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wave-commits@incubator.apache.org by wi...@apache.org on 2016/05/11 11:32:47 UTC
[1/6] incubator-wave git commit: don't use additional temp directory
if that isn't necessary
Repository: incubator-wave
Updated Branches:
refs/heads/master ed4feb701 -> b29549612
don't use additional temp directory if that isn't necessary
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/2c075c64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/2c075c64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/2c075c64
Branch: refs/heads/master
Commit: 2c075c6474ac36c7b3d7b92780da13e12cf0c89c
Parents: 3644593
Author: Andreas 'count' Kotes <co...@flatline.de>
Authored: Tue Feb 2 16:39:19 2016 +0100
Committer: Andreas 'count' Kotes <co...@flatline.de>
Committed: Tue Feb 2 16:39:19 2016 +0100
----------------------------------------------------------------------
pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/2c075c64/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
----------------------------------------------------------------------
diff --git a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
index 499ebc5..7dafc70 100644
--- a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
+++ b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
@@ -76,7 +76,7 @@ public final class PstFileDescriptor {
if (path.endsWith(".class")) {
clazz = fromPathToClass(path);
} else if (path.endsWith(".java")) {
- clazz = fromPathToJava(path);
+ clazz = fromPathToJava(path, intermediateJavaDir);
} else if (path.endsWith(".proto")) {
clazz = fromPathToProto(path, intermediateJavaDir, protoPath);
} else {
@@ -134,9 +134,9 @@ public final class PstFileDescriptor {
return path.replace(File.separatorChar, '.').substring(0, path.length() - ".class".length());
}
- private Class<?> fromPathToJava(String pathToJava) {
+ private Class<?> fromPathToJava(String pathToJava, File intermediateJavaDir) {
try {
- File dir = Files.createTempDir();
+ File dir = intermediateJavaDir;
String[] javacCommand = new String[] {
"javac", pathToJava, "-d", dir.getAbsolutePath(), "-verbose",
"-cp", determineClasspath(pathToJava) + ":" + determineSystemClasspath()
@@ -267,7 +267,7 @@ public final class PstFileDescriptor {
System.err.println("ERROR: couldn't find result of protoc in " + intermediateJavaDir);
return null;
}
- return fromPathToJava(maybeJavaFilePath);
+ return fromPathToJava(maybeJavaFilePath, intermediateJavaDir);
}
} catch (Exception e) {
System.err.println("WARNING: exception while processing " + pathToProto + ": "
[2/6] incubator-wave git commit: support newer JDKs
Posted by wi...@apache.org.
support newer JDKs
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/3077484d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/3077484d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/3077484d
Branch: refs/heads/master
Commit: 3077484def8badb73c166c7081f2c46712359e2b
Parents: 2c075c6
Author: Andreas 'count' Kotes <co...@flatline.de>
Authored: Tue Feb 2 17:09:24 2016 +0100
Committer: Andreas 'count' Kotes <co...@flatline.de>
Committed: Tue Feb 2 17:09:24 2016 +0100
----------------------------------------------------------------------
.../main/java/org/apache/wave/pst/PstFileDescriptor.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3077484d/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
----------------------------------------------------------------------
diff --git a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
index 7dafc70..abdc544 100644
--- a/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
+++ b/pst/src/main/java/org/apache/wave/pst/PstFileDescriptor.java
@@ -155,7 +155,14 @@ public final class PstFileDescriptor {
return null;
} else {
// Compiled the file! Now to determine where javac put it.
- Pattern pattern = Pattern.compile("\\[wrote ([^\\]]*)\\]");
+ Pattern pattern;
+ if (Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) <= 6) {
+ // JDK 6 or lower
+ pattern = Pattern.compile("\\[wrote ([^\\]]*)\\]");
+ } else {
+ // JDK 7 or higher
+ pattern = Pattern.compile("\\[wrote RegularFileObject\\[([^\\]]*)\\]\\]");
+ }
String pathToClass = null;
for (String line : stdErr) {
Matcher lineMatcher = pattern.matcher(line);
[6/6] incubator-wave git commit: Merge
https://github.com/berlincount/incubator-wave
Posted by wi...@apache.org.
Merge https://github.com/berlincount/incubator-wave
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/b2954961
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/b2954961
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/b2954961
Branch: refs/heads/master
Commit: b29549612c00392c4e55349bbe389e65c62e760b
Parents: ed4feb7 d06a8af
Author: wisebaldone <eh...@gmail.com>
Authored: Wed May 11 21:32:21 2016 +1000
Committer: wisebaldone <eh...@gmail.com>
Committed: Wed May 11 21:32:21 2016 +1000
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/6] incubator-wave git commit: add example code and some
documentation
Posted by wi...@apache.org.
add example code and some documentation
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/7847a841
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/7847a841
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/7847a841
Branch: refs/heads/master
Commit: 7847a841dd6fbacb7a2d413ec3fe5b7fd4e916cc
Parents: d5f2f78
Author: Andreas 'count' Kotes <co...@flatline.de>
Authored: Tue Feb 2 19:08:00 2016 +0100
Committer: Andreas 'count' Kotes <co...@flatline.de>
Committed: Tue Feb 2 19:08:00 2016 +0100
----------------------------------------------------------------------
pst/README.md | 58 ++++++++++++++++++++++++++++++++++++++++++
pst/example/.gitignore | 1 +
pst/example/beans.st | 52 +++++++++++++++++++++++++++++++++++++
pst/example/example.proto | 14 ++++++++++
pst/example/example.st | 26 +++++++++++++++++++
5 files changed, 151 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7847a841/pst/README.md
----------------------------------------------------------------------
diff --git a/pst/README.md b/pst/README.md
new file mode 100644
index 0000000..b006f84
--- /dev/null
+++ b/pst/README.md
@@ -0,0 +1,58 @@
+
+# PST - Protocol Buffers String Templating
+
+## Abstract
+
+PST allows to quickly generate Java Sourcecode from Protocol Buffer
+specifications by automating the process of boiler-plating, compilation and
+field definition via templates.
+
+## Building
+
+Generally, PST is an integral part of the Apache Wave build process, and not
+called directly. If you want to build it, you can run
+
+ `gradle build`
+
+but it'll usually will be built for your.
+
+## Standalone use
+
+If you want to test PST directly, you'll need to build a standalone version
+with
+
+ `gradle shadowJar`
+
+which allows you check out the example via
+
+ `java -jar build/libs/wave-pst-0.1.jar -d example -f example/example.proto example/example.st`
+
+which will result in example/com/example/Person.java being created from the
+Protobuf definition of the Person schema in example/example.proto.
+
+The boilerplate code will be coming from example/example.st, which references
+example/broto.st, providing the per-field code definitions.
+
+## Way of working
+
+PST generates the corresponding java code using the following steps:
+
+* protoc is called to create Java code from example/example.proto
+* the resulting Example.java is compiled using javac
+* each Message definition found in the Protocol Buffer file is matched against
+ example/example.st
+* the resulting Java code is passed through a styler to make it more human-readable
+
+## Use within Apache Wave
+
+Apache Wave is using proto2 Protocol Buffers as documented in
+https://developers.google.com/protocol-buffers/docs/proto .. the task
+generateMessages in wave/build.gradle is responsible for combining String
+Templates as per http://www.stringtemplate.org/ to Java Classes.
+
+A quick introduction to String Templates can be found under
+https://theantlrguy.atlassian.net/wiki/display/ST/Five+minute+Introduction
+
+execve("/usr/bin/java", ["java", "-jar", "build/libs/wave-pst-0.1.jar", "-d", "example", "-f", "example/example.proto", "example/example.st"], [/* 32 vars */]) = 0
+[pid 12254] execve("/usr/bin/protoc", ["protoc", "example/example.proto", "-I.", "--java_out", "/tmp/1454436070071-0"], [/* 34 vars */]) = 0
+[pid 12259] execve("/usr/bin/javac", ["javac", "/tmp/1454436070071-0/com/example/Example.java", "-d", "/tmp/1454436070071-0", "-verbose", "-cp", "//tmp/1454436070071-0/:/home/count/repos/github-berlincount-incubator-wave/pst/build/libs/wave-pst-0.1.jar"], [/* 34 vars */]) = 0
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7847a841/pst/example/.gitignore
----------------------------------------------------------------------
diff --git a/pst/example/.gitignore b/pst/example/.gitignore
new file mode 100644
index 0000000..6de13f0
--- /dev/null
+++ b/pst/example/.gitignore
@@ -0,0 +1 @@
+com
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7847a841/pst/example/beans.st
----------------------------------------------------------------------
diff --git a/pst/example/beans.st b/pst/example/beans.st
new file mode 100644
index 0000000..5e2235b
--- /dev/null
+++ b/pst/example/beans.st
@@ -0,0 +1,52 @@
+/* Example field template in the Public Domain */
+
+$if (f.optional)$
+
+ /** Returns whether $f.name$ has been set. */
+ boolean has$f.capName$();
+
+ /** Clears the value of $f.name$. */
+ void clear$f.capName$();
+
+$endif$
+
+$if (f.repeated)$
+
+ /** Returns $f.name$, or null if hasn't been set. */
+ $if (f.message)$
+ List<? extends $f.javaType$> $f.getter$();
+ $else$
+ List<$f.boxedJavaType$> $f.getter$();
+ $endif$
+
+ /** Adds an element to $f.name$. */
+ void add$f.capName$($f.javaType$ value);
+
+ /** Adds a list of elements to $f.name$. */
+ $if (f.message)$
+ void addAll$f.capName$(List<? extends $f.javaType$> $f.name$);
+ $else$
+ void addAll$f.capName$(List<$f.boxedJavaType$> $f.name$);
+ $endif$
+
+ /** Returns the nth element of $f.name$. */
+ $f.javaType$ $f.getter$(int n);
+
+ /** Sets the nth element of $f.name$. */
+ void $f.setter$(int n, $f.javaType$ value);
+
+ /** Returns the length of $f.name$. */
+ int $f.getter$Size();
+
+ /** Clears $f.name$. */
+ void clear$f.capName$();
+
+$else$
+
+ /** Returns $f.name$, or null if hasn't been set. */
+ $f.javaType$ $f.getter$();
+
+ /** Sets $f.name$. */
+ void $f.setter$($f.javaType$ $f.name$);
+
+$endif$
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7847a841/pst/example/example.proto
----------------------------------------------------------------------
diff --git a/pst/example/example.proto b/pst/example/example.proto
new file mode 100644
index 0000000..a9601f2
--- /dev/null
+++ b/pst/example/example.proto
@@ -0,0 +1,14 @@
+// Example protobuffer definition in the Public Domain.
+
+syntax = "proto2";
+
+option java_package = "com.example";
+option java_outer_classname = "Example";
+
+package example;
+
+message Person {
+ required string name = 1;
+ required int32 id = 2; // Unique ID number for this person.
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7847a841/pst/example/example.st
----------------------------------------------------------------------
diff --git a/pst/example/example.st b/pst/example/example.st
new file mode 100644
index 0000000..2d98329
--- /dev/null
+++ b/pst/example/example.st
@@ -0,0 +1,26 @@
+/* Example Protobuffer Class template in the Public Domain */
+
+public interface $m.javaType$ {
+
+ $m.nestedEnums: {e|$enum(e=e)$}$
+ $m.nestedMessages: {nested|$interface(m=nested)$}$
+
+ ///** Does a deep copy from model. */
+ void copyFrom($m.javaType$ model);
+
+ /**
+ * Tests if this model is equal to another object.
+ * "Equal" is recursively defined as:
+ * <ul>
+ * <li>both objects implement this interface,</li>
+ * <li>all corresponding primitive fields of both objects have the same value, and</li>
+ * <li>all corresponding nested-model fields of both objects are "equal".</li>
+ * </ul>
+ *
+ * This is a coarser equivalence than provided by the equals() methods. Two
+ * objects may not be equal() to each other, but may be isEqualTo() each other.
+ */
+ boolean isEqualTo(Object o);
+
+ $m.fields: {f|$beans(f=f)$}$
+}
[5/6] incubator-wave git commit: remove gruft
Posted by wi...@apache.org.
remove gruft
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/d06a8afe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/d06a8afe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/d06a8afe
Branch: refs/heads/master
Commit: d06a8afe33921cf780066c869d2bea45daa19ed1
Parents: 7847a84
Author: Andreas 'count' Kotes <co...@flatline.de>
Authored: Tue Feb 2 19:09:01 2016 +0100
Committer: Andreas 'count' Kotes <co...@flatline.de>
Committed: Tue Feb 2 19:09:01 2016 +0100
----------------------------------------------------------------------
pst/README.md | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/d06a8afe/pst/README.md
----------------------------------------------------------------------
diff --git a/pst/README.md b/pst/README.md
index b006f84..93e6084 100644
--- a/pst/README.md
+++ b/pst/README.md
@@ -52,7 +52,3 @@ Templates as per http://www.stringtemplate.org/ to Java Classes.
A quick introduction to String Templates can be found under
https://theantlrguy.atlassian.net/wiki/display/ST/Five+minute+Introduction
-
-execve("/usr/bin/java", ["java", "-jar", "build/libs/wave-pst-0.1.jar", "-d", "example", "-f", "example/example.proto", "example/example.st"], [/* 32 vars */]) = 0
-[pid 12254] execve("/usr/bin/protoc", ["protoc", "example/example.proto", "-I.", "--java_out", "/tmp/1454436070071-0"], [/* 34 vars */]) = 0
-[pid 12259] execve("/usr/bin/javac", ["javac", "/tmp/1454436070071-0/com/example/Example.java", "-d", "/tmp/1454436070071-0", "-verbose", "-cp", "//tmp/1454436070071-0/:/home/count/repos/github-berlincount-incubator-wave/pst/build/libs/wave-pst-0.1.jar"], [/* 34 vars */]) = 0
[3/6] incubator-wave git commit: ignore backup files
Posted by wi...@apache.org.
ignore backup files
Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/d5f2f783
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/d5f2f783
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/d5f2f783
Branch: refs/heads/master
Commit: d5f2f78338e16ab3aae5594ba5b84fb7f37ed6fc
Parents: 3077484
Author: Andreas 'count' Kotes <co...@flatline.de>
Authored: Tue Feb 2 17:34:50 2016 +0100
Committer: Andreas 'count' Kotes <co...@flatline.de>
Committed: Tue Feb 2 17:34:50 2016 +0100
----------------------------------------------------------------------
.gitignore | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/d5f2f783/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b3db961..267def7 100755
--- a/.gitignore
+++ b/.gitignore
@@ -57,4 +57,5 @@ wave/config/wave.conf
### Vagrant
.vagrant/
-
+### Backup files
+*~