From 0283fc5c2dffa742b776f6c6233b3a1375c1f2ed Mon Sep 17 00:00:00 2001 From: Vaci Koblizek Date: Sat, 7 Nov 2020 16:56:01 +0000 Subject: [PATCH] add lite mode for compiler --- compiler/src/main/cpp/capnpc-java.c++ | 5 ++++- gen | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/src/main/cpp/capnpc-java.c++ b/compiler/src/main/cpp/capnpc-java.c++ index a279a74..0a77097 100644 --- a/compiler/src/main/cpp/capnpc-java.c++ +++ b/compiler/src/main/cpp/capnpc-java.c++ @@ -335,6 +335,9 @@ private: } } case schema::Type::INTERFACE: { + if (liteMode) { + return kj::strTree("org.capnproto.Capability.", suffix); + } auto interfaceSchema = type.asInterface(); if (interfaceSchema.getProto().getIsGeneric()) { auto typeArgs = getTypeArguments(interfaceSchema, interfaceSchema, kj::str(suffix)); @@ -2516,7 +2519,7 @@ private: kj::MainBuilder::Validity run() { - if (context.getProgramName().endsWith("lite")) { + if (::getenv("CAPNP_LITE") != nullptr) { liteMode = true; } diff --git a/gen b/gen index 3fd7d3d..dad800b 100755 --- a/gen +++ b/gen @@ -5,11 +5,10 @@ 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-lite ./runtime/src/test/schema/test.capnp +env CAPNP_LITE=1 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/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/