diff --git a/compiler/pom.xml b/compiler/pom.xml
index 3af6c4d..df59fe6 100644
--- a/compiler/pom.xml
+++ b/compiler/pom.xml
@@ -39,12 +39,13 @@
4.13.1
test
-
+
@@ -79,7 +80,7 @@
run
-
+
+
diff --git a/compiler/src/main/cpp/capnpc-java.c++ b/compiler/src/main/cpp/capnpc-java.c++
index 551c422..a279a74 100644
--- a/compiler/src/main/cpp/capnpc-java.c++
+++ b/compiler/src/main/cpp/capnpc-java.c++
@@ -198,6 +198,7 @@ private:
SchemaLoader schemaLoader;
std::unordered_set usedImports;
bool hasInterfaces = false;
+ bool liteMode = false;
kj::StringTree javaFullName(Schema schema, kj::Maybe method = nullptr) {
auto node = schema.getProto();
@@ -912,8 +913,13 @@ private:
spaces(indent), " }\n",
"\n"),
- // TODO pipelineMethodDecls
- kj::strTree()
+ (hasDiscriminantValue(proto) || liteMode)
+ ? kj::strTree()
+ : kj::strTree(
+ spaces(indent), " default ", titleCase, ".Pipeline get", titleCase, "() {\n",
+ spaces(indent), " var pipeline = this.typelessPipeline().noop();\n",
+ spaces(indent), " return () -> pipeline;\n",
+ spaces(indent), " }\n")
};
}
}
@@ -1087,6 +1093,9 @@ private:
};
} else if (kind == FieldKind::INTERFACE) {
+ if (liteMode) {
+ return {};
+ }
auto factoryArg = makeFactoryArg(field.getType());
auto clientType = typeName(field.getType(), kj::str("Client")).flatten();
auto serverType = typeName(field.getType(), kj::str("Server")).flatten();
@@ -1258,7 +1267,7 @@ private:
spaces(indent), " }\n"),
// Pipeline accessors
- (field.getType().asStruct().getProto().getIsGeneric()
+ ((liteMode || field.getType().asStruct().getProto().getIsGeneric())
? kj::strTree() // No generics for you, sorry.
: kj::strTree(
spaces(indent), " default ", pipelineType, " get", titleCase, "() {\n",
@@ -1667,11 +1676,14 @@ private:
spaces(indent), " _NOT_IN_SCHEMA,\n",
spaces(indent), " }\n"),
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
- spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.Pipeline {\n",
- KJ_MAP(f, fieldTexts) {
- return kj::mv(f.pipelineMethodDecls);
- },
- spaces(indent), " }\n",
+ (liteMode ? kj::strTree()
+ : kj::strTree(
+ spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.Pipeline {\n",
+ KJ_MAP(f, fieldTexts) {
+ return kj::mv(f.pipelineMethodDecls);
+ },
+ spaces(indent), " }\n")
+ ),
spaces(indent), "}\n"),
kj::strTree(),
@@ -1703,6 +1715,10 @@ private:
InterfaceText makeInterfaceText(kj::StringPtr scope, kj::StringPtr name, InterfaceSchema schema,
kj::Array nestedTypeDecls, int indent) {
+ if (liteMode) {
+ return {};
+ }
+
auto sp = spaces(indent);
auto fullName = kj::str(scope, name);
auto methods = KJ_MAP(m, schema.getMethods()) {
@@ -2499,6 +2515,11 @@ private:
}
kj::MainBuilder::Validity run() {
+
+ if (context.getProgramName().endsWith("lite")) {
+ liteMode = true;
+ }
+
ReaderOptions options;
options.traversalLimitInWords = 1 << 30; // Don't limit.
StreamFdMessageReader reader(STDIN_FILENO, options);
diff --git a/gen b/gen
index 6fd2d73..3fd7d3d 100755
--- a/gen
+++ b/gen
@@ -5,21 +5,24 @@ set -eux
export PATH=/usr/local/bin:/usr/bin:/bin
make CXX=g++-8 capnpc-java
+cp capnpc-java capnpc-java-lite
capnp compile -I./compiler/src/main/schema/ -o/bin/cat ./runtime/src/test/schema/test.capnp > ./runtime/src/test/schema/test.raw
capnp compile -I./compiler/src/main/schema/ -oc++ ./runtime/src/test/schema/test.capnp
-capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/test.capnp
-cp ./runtime/src/test/schema/Test.java ./runtime/src/test/java/org/capnproto/test/
+capnp compile -I./compiler/src/main/schema/ -o./capnpc-java-lite ./runtime/src/test/schema/test.capnp
+cp ./runtime/src/test/schema/Test.java ./runtime/src/test/schema/TestLite.java
+capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/test.capnp
+#cp ./runtime/src/test/schema/Test.java ./runtime/src/test/java/org/capnproto/test/
-capnp compile -I./compiler/src/main/schema/ -oc++ ./runtime/src/test/schema/demo.capnp
-capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/demo.capnp
-cp ./runtime/src/test/schema/Demo.java ./runtime/src/test/java/org/capnproto/demo/
+#capnp compile -I./compiler/src/main/schema/ -oc++ ./runtime/src/test/schema/demo.capnp
+#capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/demo.capnp
+#cp ./runtime/src/test/schema/Demo.java ./runtime/src/test/java/org/capnproto/demo/
-capnp compile -I./compiler/src/main/schema/ -o/bin/cat ./runtime/src/test/schema/generics.capnp > ./runtime/src/test/schema/generics.raw
-capnp compile -I./compiler/src/main/schema/ -oc++ ./runtime/src/test/schema/generics.capnp
-capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/generics.capnp
-cp ./runtime/src/test/schema/TestGenerics.java ./runtime/src/test/java/org/capnproto/demo/
+#capnp compile -I./compiler/src/main/schema/ -o/bin/cat ./runtime/src/test/schema/generics.capnp > ./runtime/src/test/schema/generics.raw
+#capnp compile -I./compiler/src/main/schema/ -oc++ ./runtime/src/test/schema/generics.capnp
+#capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./runtime/src/test/schema/generics.capnp
+#cp ./runtime/src/test/schema/TestGenerics.java ./runtime/src/test/java/org/capnproto/demo/
-capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./examples/src/main/schema/addressbook.capnp
-cp ./examples/src/main/schema/Addressbook.java ./examples/src/main/java/org/capnproto/examples/
+#capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./examples/src/main/schema/addressbook.capnp
+#cp ./examples/src/main/schema/Addressbook.java ./examples/src/main/java/org/capnproto/examples/
diff --git a/pom.xml b/pom.xml
index 83fd696..e85c105 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,6 +12,7 @@
compiler
examples
benchmark
+ compiler-tests
diff --git a/runtime/pom.xml b/runtime/pom.xml
index 9d50d52..eb35163 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -44,6 +44,12 @@
4.13.1
test
+
+
+ org.capnproto
+ compiler
+ 0.1.6-SNAPSHOT
+