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>
|
<version>4.13.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.capnproto</groupId>
|
<groupId>org.capnproto</groupId>
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>runtime</artifactId>
|
||||||
<version>0.1.6-SNAPSHOT</version>
|
<version>0.1.6-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -79,7 +80,7 @@
|
||||||
<goal>run</goal>
|
<goal>run</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
<!--
|
||||||
<execution>
|
<execution>
|
||||||
<id>generate-test-sources</id>
|
<id>generate-test-sources</id>
|
||||||
<phase>generate-test-sources</phase>
|
<phase>generate-test-sources</phase>
|
||||||
|
@ -101,9 +102,11 @@
|
||||||
<goal>run</goal>
|
<goal>run</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
-->
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!--
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
@ -123,6 +126,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
-->
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -198,6 +198,7 @@ private:
|
||||||
SchemaLoader schemaLoader;
|
SchemaLoader schemaLoader;
|
||||||
std::unordered_set<uint64_t> usedImports;
|
std::unordered_set<uint64_t> usedImports;
|
||||||
bool hasInterfaces = false;
|
bool hasInterfaces = false;
|
||||||
|
bool liteMode = false;
|
||||||
|
|
||||||
kj::StringTree javaFullName(Schema schema, kj::Maybe<InterfaceSchema::Method> method = nullptr) {
|
kj::StringTree javaFullName(Schema schema, kj::Maybe<InterfaceSchema::Method> method = nullptr) {
|
||||||
auto node = schema.getProto();
|
auto node = schema.getProto();
|
||||||
|
@ -912,8 +913,13 @@ private:
|
||||||
spaces(indent), " }\n",
|
spaces(indent), " }\n",
|
||||||
"\n"),
|
"\n"),
|
||||||
|
|
||||||
// TODO pipelineMethodDecls
|
(hasDiscriminantValue(proto) || liteMode)
|
||||||
kj::strTree()
|
? 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) {
|
} else if (kind == FieldKind::INTERFACE) {
|
||||||
|
if (liteMode) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
auto factoryArg = makeFactoryArg(field.getType());
|
auto factoryArg = makeFactoryArg(field.getType());
|
||||||
auto clientType = typeName(field.getType(), kj::str("Client")).flatten();
|
auto clientType = typeName(field.getType(), kj::str("Client")).flatten();
|
||||||
auto serverType = typeName(field.getType(), kj::str("Server")).flatten();
|
auto serverType = typeName(field.getType(), kj::str("Server")).flatten();
|
||||||
|
@ -1258,7 +1267,7 @@ private:
|
||||||
spaces(indent), " }\n"),
|
spaces(indent), " }\n"),
|
||||||
|
|
||||||
// Pipeline accessors
|
// Pipeline accessors
|
||||||
(field.getType().asStruct().getProto().getIsGeneric()
|
((liteMode || field.getType().asStruct().getProto().getIsGeneric())
|
||||||
? kj::strTree() // No generics for you, sorry.
|
? kj::strTree() // No generics for you, sorry.
|
||||||
: kj::strTree(
|
: kj::strTree(
|
||||||
spaces(indent), " default ", pipelineType, " get", titleCase, "() {\n",
|
spaces(indent), " default ", pipelineType, " get", titleCase, "() {\n",
|
||||||
|
@ -1667,11 +1676,14 @@ private:
|
||||||
spaces(indent), " _NOT_IN_SCHEMA,\n",
|
spaces(indent), " _NOT_IN_SCHEMA,\n",
|
||||||
spaces(indent), " }\n"),
|
spaces(indent), " }\n"),
|
||||||
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
|
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
|
||||||
|
(liteMode ? kj::strTree()
|
||||||
|
: kj::strTree(
|
||||||
spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.Pipeline {\n",
|
spaces(indent), " public interface Pipeline", readerTypeParams, " extends org.capnproto.Pipeline {\n",
|
||||||
KJ_MAP(f, fieldTexts) {
|
KJ_MAP(f, fieldTexts) {
|
||||||
return kj::mv(f.pipelineMethodDecls);
|
return kj::mv(f.pipelineMethodDecls);
|
||||||
},
|
},
|
||||||
spaces(indent), " }\n",
|
spaces(indent), " }\n")
|
||||||
|
),
|
||||||
spaces(indent), "}\n"),
|
spaces(indent), "}\n"),
|
||||||
|
|
||||||
kj::strTree(),
|
kj::strTree(),
|
||||||
|
@ -1703,6 +1715,10 @@ private:
|
||||||
InterfaceText makeInterfaceText(kj::StringPtr scope, kj::StringPtr name, InterfaceSchema schema,
|
InterfaceText makeInterfaceText(kj::StringPtr scope, kj::StringPtr name, InterfaceSchema schema,
|
||||||
kj::Array<kj::StringTree> nestedTypeDecls, int indent) {
|
kj::Array<kj::StringTree> nestedTypeDecls, int indent) {
|
||||||
|
|
||||||
|
if (liteMode) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
auto sp = spaces(indent);
|
auto sp = spaces(indent);
|
||||||
auto fullName = kj::str(scope, name);
|
auto fullName = kj::str(scope, name);
|
||||||
auto methods = KJ_MAP(m, schema.getMethods()) {
|
auto methods = KJ_MAP(m, schema.getMethods()) {
|
||||||
|
@ -2499,6 +2515,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
kj::MainBuilder::Validity run() {
|
kj::MainBuilder::Validity run() {
|
||||||
|
|
||||||
|
if (context.getProgramName().endsWith("lite")) {
|
||||||
|
liteMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
ReaderOptions options;
|
ReaderOptions options;
|
||||||
options.traversalLimitInWords = 1 << 30; // Don't limit.
|
options.traversalLimitInWords = 1 << 30; // Don't limit.
|
||||||
StreamFdMessageReader reader(STDIN_FILENO, options);
|
StreamFdMessageReader reader(STDIN_FILENO, options);
|
||||||
|
|
23
gen
23
gen
|
@ -5,21 +5,24 @@ set -eux
|
||||||
export PATH=/usr/local/bin:/usr/bin:/bin
|
export PATH=/usr/local/bin:/usr/bin:/bin
|
||||||
|
|
||||||
make CXX=g++-8 capnpc-java
|
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/ -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/ -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
|
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/ -oc++ ./runtime/src/test/schema/demo.capnp
|
||||||
capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./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/
|
#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/ -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/ -oc++ ./runtime/src/test/schema/generics.capnp
|
||||||
capnp compile -I./compiler/src/main/schema/ -o./capnpc-java ./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/
|
#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
|
#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/
|
#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>compiler</module>
|
||||||
<module>examples</module>
|
<module>examples</module>
|
||||||
<module>benchmark</module>
|
<module>benchmark</module>
|
||||||
|
<module>compiler-tests</module>
|
||||||
</modules>
|
</modules>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
|
|
|
@ -44,6 +44,12 @@
|
||||||
<version>4.13.1</version>
|
<version>4.13.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.capnproto</groupId>
|
||||||
|
<artifactId>compiler</artifactId>
|
||||||
|
<version>0.1.6-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
|
Loading…
Reference in a new issue