diff --git a/.gitignore b/.gitignore index 6f3894d06..1ba56a0e5 100755 --- a/.gitignore +++ b/.gitignore @@ -54,8 +54,8 @@ build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/** build/Xcode/FlatBuffers.xcodeproj/xcuserdata/** FlatBuffers.xcodeproj/ java/.idea -java/*.iml -java/target +*.iml +target **/*.pyc .idea build/VS2010/FlatBuffers.sdf diff --git a/java/flatbuffers/pom.xml b/java/flatbuffers/pom.xml new file mode 100644 index 000000000..7b6ea7933 --- /dev/null +++ b/java/flatbuffers/pom.xml @@ -0,0 +1,65 @@ + + + + com.google.flatbuffers + flatbuffers + 1.3.0-SNAPSHOT + + + 4.0.0 + flatbuffers-java + bundle + FlatBuffers Java API + + Memory Efficient Serialization Library + + + + + junit + junit + test + + + + ${basedir}/../.. + ${project.build.directory}/generated-test-sources/flatbuffers + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + org.codehaus.mojo + exec-maven-plugin + + + generate-test-sources + generate-test-sources + + exec + + + ${flatbuffers.root.dir}/flatc + + --java + -o + ${generated.test.sources.directory} + ${basedir}/src/test/fbs/test.fbs + + ${generated.test.sources.directory} + + + + + + + + diff --git a/java/com/google/flatbuffers/Constants.java b/java/flatbuffers/src/main/java/com/google/flatbuffers/Constants.java similarity index 100% rename from java/com/google/flatbuffers/Constants.java rename to java/flatbuffers/src/main/java/com/google/flatbuffers/Constants.java diff --git a/java/com/google/flatbuffers/FlatBufferBuilder.java b/java/flatbuffers/src/main/java/com/google/flatbuffers/FlatBufferBuilder.java similarity index 100% rename from java/com/google/flatbuffers/FlatBufferBuilder.java rename to java/flatbuffers/src/main/java/com/google/flatbuffers/FlatBufferBuilder.java diff --git a/java/com/google/flatbuffers/Struct.java b/java/flatbuffers/src/main/java/com/google/flatbuffers/Struct.java similarity index 100% rename from java/com/google/flatbuffers/Struct.java rename to java/flatbuffers/src/main/java/com/google/flatbuffers/Struct.java diff --git a/java/com/google/flatbuffers/Table.java b/java/flatbuffers/src/main/java/com/google/flatbuffers/Table.java similarity index 100% rename from java/com/google/flatbuffers/Table.java rename to java/flatbuffers/src/main/java/com/google/flatbuffers/Table.java diff --git a/java/flatbuffers/src/test/fbs/test.fbs b/java/flatbuffers/src/test/fbs/test.fbs new file mode 100644 index 000000000..695b94e43 --- /dev/null +++ b/java/flatbuffers/src/test/fbs/test.fbs @@ -0,0 +1,19 @@ +namespace com.google.flatbuffer.test; + +table MyTable +{ + foo:int; +} + +enum MyEnum:byte +{ + A, B, C +} + +struct MyStruct +{ + a:int; + b:int; +} + +root_type MyTable; \ No newline at end of file diff --git a/java/flatbuffers/src/test/java/com/google/flatbuffers/test/DummyTest.java b/java/flatbuffers/src/test/java/com/google/flatbuffers/test/DummyTest.java new file mode 100644 index 000000000..627050b5f --- /dev/null +++ b/java/flatbuffers/src/test/java/com/google/flatbuffers/test/DummyTest.java @@ -0,0 +1,25 @@ +package com.google.flatbuffers.test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.junit.Test; + +import com.google.flatbuffer.test.MyTable; +import com.google.flatbuffers.FlatBufferBuilder; + +/** + * Dummy Test to demo JUnit usage. + */ +public class DummyTest { + @Test + public void testDummy() { + FlatBufferBuilder builder = new FlatBufferBuilder(); + + int tableOffSet = MyTable.createMyTable(builder, 42); + MyTable.finishMyTableBuffer(builder, tableOffSet); + MyTable myTable = MyTable.getRootAsMyTable(builder.dataBuffer()); + + assertThat(myTable.foo(), is(42)); + } +} diff --git a/java/jmh/pom.xml b/java/jmh/pom.xml new file mode 100644 index 000000000..9be798421 --- /dev/null +++ b/java/jmh/pom.xml @@ -0,0 +1,77 @@ + + + + com.google.flatbuffers + flatbuffers + 1.3.0-SNAPSHOT + + + 4.0.0 + flatbuffers-jmh + jar + FlatBuffers JMH micro-benchmark + + Micro benchmark to help in technical design decisions. + + + + 1.12 + benchmarks + + + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + provided + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + ${uberjar.name} + + + org.openjdk.jmh.Main + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + + + diff --git a/java/pom.xml b/java/pom.xml index dd92b9d55..2297dbe37 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -1,13 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.google.flatbuffers - flatbuffers-java + flatbuffers 1.3.0-SNAPSHOT - jar - FlatBuffers Java API + pom + FlatBuffers Memory Efficient Serialization Library @@ -30,10 +30,47 @@ scm:git:https://github.com/google/flatbuffers.git - - + + + 3.0 + + + + + flatbuffers + jmh + + + + + + junit + junit + 4.12 + + + + - ./ + + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + + org.codehaus.mojo + exec-maven-plugin + 1.5.0 + + + org.apache.felix + maven-bundle-plugin + 3.0.1 + + + maven-compiler-plugin