make noop public
This commit is contained in:
parent
45d1470907
commit
6b8898c27b
5 changed files with 57 additions and 22 deletions
|
@ -39,12 +39,13 @@
|
|||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -79,7 +80,7 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
<!--
|
||||
<execution>
|
||||
<id>generate-test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
|
@ -90,7 +91,7 @@
|
|||
<arg value="compile"/>
|
||||
<arg value="-I"/>
|
||||
<arg value="src/main/schema/"/>
|
||||
<arg value="--src-prefix=src/test/schema/"/>
|
||||
<arg value="- -src-prefix=src/test/schema/"/>
|
||||
<arg value="-o../capnpc-java:src/test/generated"/>
|
||||
<arg value="src/test/schema/test.capnp"/>
|
||||
<arg value="src/test/schema/test-import.capnp"/>
|
||||
|
@ -101,9 +102,11 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
-->
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
|
@ -123,6 +126,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -198,6 +198,7 @@ private:
|
|||
SchemaLoader schemaLoader;
|
||||
std::unordered_set<uint64_t> usedImports;
|
||||
bool hasInterfaces = false;
|
||||
bool liteMode = false;
|
||||
|
||||
kj::StringTree javaFullName(Schema schema, kj::Maybe<InterfaceSchema::Method> 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<kj::StringTree> 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);
|
||||
|
|
23
gen
23
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-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/
|
||||
#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/
|
||||
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -12,6 +12,7 @@
|
|||
<module>compiler</module>
|
||||
<module>examples</module>
|
||||
<module>benchmark</module>
|
||||
<module>compiler-tests</module>
|
||||
</modules>
|
||||
<licenses>
|
||||
<license>
|
||||
|
|
|
@ -44,6 +44,12 @@
|
|||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
|
Loading…
Reference in a new issue