THRIFT-5544: annotations_as_metadata java code gen param (#2553)
Add a java code generation parameter called "annotations_as_metadata" to
optionally include Thrift field annotations as metadata in the generated code.
diff --git a/lib/java/gradle/generateTestThrift.gradle b/lib/java/gradle/generateTestThrift.gradle
index b8a963d..e851547 100644
--- a/lib/java/gradle/generateTestThrift.gradle
+++ b/lib/java/gradle/generateTestThrift.gradle
@@ -86,6 +86,7 @@
thriftCompile(it, 'EnumContainersTest.thrift')
thriftCompile(it, 'JavaBinaryDefault.thrift')
thriftCompile(it, 'VoidMethExceptionsTest.thrift')
+ thriftCompile(it, 'AnnotationTest.thrift')
thriftCompile(it, 'partial/thrift_test_schema.thrift')
}
@@ -133,3 +134,12 @@
thriftCompile(it, 'UnsafeTypes.thrift', 'java:unsafe_binaries', genUnsafeSrc)
}
+
+task generateWithAnnotationMetadata(group: 'Build') {
+ description = 'Generate with annotation enabled and add to the default source'
+ generate.dependsOn it
+
+ ext.outputBuffer = new ByteArrayOutputStream()
+
+ thriftCompile(it, 'JavaAnnotationTest.thrift', 'java:annotations_as_metadata', genSrc)
+}