diff --git a/compiler/src/main/cpp/capnpc-java.c++ b/compiler/src/main/cpp/capnpc-java.c++ index ff4488f..b9a44ce 100644 --- a/compiler/src/main/cpp/capnpc-java.c++ +++ b/compiler/src/main/cpp/capnpc-java.c++ @@ -1633,7 +1633,9 @@ private: // KJ_MAP(n, namespaceParts) { return kj::strTree("namespace ", n, " {\n"); }, "\n", "public class ", outerClassName, " {\n", KJ_MAP(n, nodeTexts) { return kj::mv(n.outerTypeDef); }, - KJ_MAP(n, namespaceParts) { return kj::strTree("}\n"); }, "\n") + //KJ_MAP(n, namespaceParts) { return kj::strTree("}\n"); }, + "}\n", + "\n") }; } diff --git a/compiler/src/test/schema/test.capnp b/compiler/src/test/schema/test.capnp new file mode 100644 index 0000000..301d98f --- /dev/null +++ b/compiler/src/test/schema/test.capnp @@ -0,0 +1,27 @@ +@0xd6eccba9557a7f51; + +using Java = import "/java_support/java.capnp"; +$Java.package("org.capnproto.test"); + +enum TestEnum { + foo @0; + bar @1; + baz @2; + qux @3; + quux @4; + corge @5; + grault @6; + garply @7; +} + +struct TestOutOfOrder { + foo @3 :Text; + bar @2 :Text; + baz @8 :Text; + qux @0 :Text; + quux @6 :Text; + corge @4 :Text; + grault @1 :Text; + garply @7 :Text; + waldo @5 :Text; +} \ No newline at end of file diff --git a/project/build.scala b/project/build.scala index 00020aa..f335e50 100644 --- a/project/build.scala +++ b/project/build.scala @@ -16,6 +16,9 @@ object Build extends sbt.Build { base = file("compiler") ).settings(makeCppTask) .settings(compile <<= compile in Compile dependsOn makeCpp) + .settings(compileTestSchemaTask) +// .settings(test <<= test in Test dependsOn compileTestSchema) +// .settings(unmanagedSourceDirectories in Test += sourceDirectory.value / "test" / "generated") lazy val runtime = project( @@ -44,13 +47,19 @@ object Build extends sbt.Build { Seq(libraryDependencies ++= Shared.testDeps) ).configs(IntegrationTest) + val compileTestSchema = taskKey[Unit]("Run capnpc-java on test schema") + val compileTestSchemaTask = compileTestSchema := { + val result = "capnp compile -I compiler/src/main/cpp/ --src-prefix=compiler/src/test/schema/ -o./capnpc-java:compiler/src/test/generated compiler/src/test/schema/test.capnp".!! + println(s"**** CodeGen for test.capnp started\n$result\n**** CodeGen complete."); + } + val makeCpp = taskKey[Unit]("Run make against the C++ code to create the Java code generator") val makeCppTask = makeCpp := { val makeResult = "make capnpc-java".!! println(s"**** C++ Build Started\n$makeResult\n**** C++ Build Complete") } - val makeExamples = taskKey[Unit]("Run capnp-java compiler against the addressbook schema") + val makeExamples = taskKey[Unit]("Run capnpc-java compiler against the addressbook schema") val makeExamplesTask = makeExamples := { Thread.sleep(1000) val makeResult = "make addressbook".!! diff --git a/runtime/src/test/scala/org/capnproto/LayoutTest.scala b/runtime/src/test/scala/org/capnproto/LayoutTest.scala index 896afbb..164e7c3 100644 --- a/runtime/src/test/scala/org/capnproto/LayoutTest.scala +++ b/runtime/src/test/scala/org/capnproto/LayoutTest.scala @@ -2,7 +2,7 @@ package org.capnproto; import org.scalatest.FunSuite -class ExampleSuite extends FunSuite { +class LayoutSuite extends FunSuite { test("SimpleRawDataStruct") { val data : Array[Byte] =