Skip to content

Loading…

Generated #4

Merged
merged 2 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
1 scrooge-generator/src/main/resources/javagen/consts.java
@@ -5,6 +5,7 @@
import java.util.Map;
import java.util.Set;
+@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "{{date}}")
public final class Constants {
{{#constants}}
{{docstring}}
View
1 scrooge-generator/src/main/resources/javagen/enum.java
@@ -1,6 +1,7 @@
package {{package}};
{{docstring}}
+@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "{{date}}")
public enum {{EnumName}} {
{{#values}}
{{valuedocstring}}
View
1 scrooge-generator/src/main/resources/javagen/service.java
@@ -46,6 +46,7 @@
{{/withOstrichServer}}
{{docstring}}
+@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "{{date}}")
public class {{ServiceName}} {
public interface Iface {{syncExtends}}{
{{#syncFunctions}}
View
1 scrooge-generator/src/main/resources/javagen/struct.java
@@ -17,6 +17,7 @@
import java.util.HashSet;
{{docstring}}
+@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "{{date}}")
public {{/public}}{{^public}}static {{/public}}class {{StructName}}{{#isException}} extends Exception{{/isException}} implements ThriftStruct {
private static final TStruct STRUCT = new TStruct("{{StructNameForWire}}");
{{#fields}}
View
1 scrooge-generator/src/main/resources/javagen/union.java
@@ -17,6 +17,7 @@
import java.util.HashSet;
{{docstring}}
+@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "{{date}}")
public {{/public}}{{^public}}static {{/public}}class {{StructName}} implements ThriftStruct {
private static final TStruct STRUCT = new TStruct("{{StructNameForWire}}");
{{#fields}}
View
1 scrooge-generator/src/main/resources/scalagen/consts.scala
@@ -1,5 +1,6 @@
package {{package}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler"), date = "{{date}}")
object Constants {
{{#constants}}
{{docstring}}
View
2 scrooge-generator/src/main/resources/scalagen/enum.scala
@@ -3,6 +3,7 @@ package {{package}}
import com.twitter.scrooge.ThriftEnum
{{docstring}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler"), date = "{{date}}")
case object {{EnumName}} {
{{#values}}
{{valuedocstring}}
@@ -50,4 +51,5 @@ case object {{EnumName}} {
{{docstring}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler"), date = "{{date}}")
sealed trait {{EnumName}} extends ThriftEnum with Serializable
View
1 scrooge-generator/src/main/resources/scalagen/service.scala
@@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicReference
{{/withOstrichServer}}
{{docstring}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler"), date = "{{date}}")
object {{ServiceName}} {
trait Iface {{syncExtends}}{
{{#syncFunctions}}
View
2 scrooge-generator/src/main/resources/scalagen/union.scala
@@ -11,9 +11,11 @@ import scala.collection.mutable
import scala.collection.{Map, Set}
{{/public}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge"), date = "{{date}}")
sealed trait {{StructName}} extends {{parentType}}
{{docstring}}
+@javax.annotation.Generated(value = Array("com.twitter.scrooge"), date = "{{date}}")
object {{StructName}} extends ThriftStructCodec[{{StructName}}] {
val Union = new TStruct("{{StructNameForWire}}")
{{#fields}}
View
5 scrooge-generator/src/main/scala/com/twitter/scrooge/Compiler.scala
@@ -20,6 +20,8 @@ import scala.collection.mutable
import java.io.{File, FileWriter}
import com.twitter.scrooge.backend.{Generator, ServiceOption}
import com.twitter.scrooge.frontend.{ThriftParser, Importer}
+import org.apache.commons.lang.time.FastDateFormat
+import java.util.Date
object Language extends Enumeration {
type Language = Value
@@ -42,6 +44,7 @@ class Compiler {
var dryRun: Boolean = false
var language: Language = Scala
var defaultNamespace: String = "thrift"
+ val now: String = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date())
def run() {
// if --gen-file-map is specified, prepare the map file.
@@ -65,7 +68,7 @@ class Compiler {
if (verbose) println("+ Compiling %s".format(inputFile))
val resolvedDoc = TypeResolver()(doc0)
- val generator = Generator(language, resolvedDoc.resolver.includeMap, defaultNamespace)
+ val generator = Generator(language, resolvedDoc.resolver.includeMap, defaultNamespace, now)
val generatedFiles = generator(
resolvedDoc.document,
flags.toSet,
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/ConstsTemplate.scala
@@ -19,6 +19,7 @@ trait ConstsTemplate {
"value" -> genConstant(c.value),
"docstring" -> codify(c.docstring.getOrElse(""))
)
- })
+ }),
+ "date" -> codify(generationDate)
)
}
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/EnumTemplate.scala
@@ -22,6 +22,7 @@ trait EnumTemplate {
"nameLowerCase" -> genID(value.sid.toLowerCase),
"value" -> codify(value.value.toString)
)
- })
+ }),
+ "date" -> codify(generationDate)
)
}
View
8 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/Generator.scala
@@ -36,10 +36,11 @@ object Generator {
def apply(
lan: Language,
includeMap: Map[String, ResolvedDocument],
- defaultNamespace: String
+ defaultNamespace: String,
+ generationDate: String
): Generator = lan match {
- case Scala => new ScalaGenerator(includeMap, defaultNamespace)
- case Java => new JavaGenerator(includeMap, defaultNamespace)
+ case Scala => new ScalaGenerator(includeMap, defaultNamespace, generationDate)
+ case Java => new JavaGenerator(includeMap, defaultNamespace, generationDate)
}
}
@@ -53,6 +54,7 @@ abstract class Generator
*/
val includeMap: Map[String, ResolvedDocument]
val defaultNamespace: String
+ val generationDate: String
/******************** helper functions ************************/
private[this] def namespacedFolder(destFolder: File, namespace: String, dryRun: Boolean) = {
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/JavaGenerator.scala
@@ -22,7 +22,8 @@ import com.twitter.scrooge.mustache.Dictionary._
class JavaGenerator(
val includeMap: Map[String, ResolvedDocument],
- val defaultNamespace: String
+ val defaultNamespace: String,
+ val generationDate: String
) extends Generator
{
val fileExtension = ".java"
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/ScalaGenerator.scala
@@ -22,7 +22,8 @@ import com.twitter.scrooge.mustache.Dictionary._
class ScalaGenerator(
val includeMap: Map[String, ResolvedDocument],
- val defaultNamespace: String
+ val defaultNamespace: String,
+ val generationDate: String
) extends Generator
{
val fileExtension = ".scala"
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/ServiceTemplate.scala
@@ -202,7 +202,8 @@ trait ServiceTemplate {
"withFinagleService" -> v(s.options contains WithFinagleService),
"withOstrichServer" -> v(s.options contains WithOstrichServer),
"withFinagle" -> v((s.options contains WithFinagleClient)
- || (s.options contains WithFinagleService))
+ || (s.options contains WithFinagleService)),
+ "date" -> codify(generationDate)
)
}
}
View
3 scrooge-generator/src/main/scala/com/twitter/scrooge/backend/StructTemplate.scala
@@ -264,7 +264,8 @@ trait StructTemplate {
"arity1" -> v((if (arity == 1) fieldDictionaries.take(1) else Nil)),
"arityN" -> v(arity > 1 && arity <= 22),
"withProxy" -> v(struct.isInstanceOf[Struct]),
- "withFinagleClient" -> v(serviceOptions contains WithFinagleClient)
+ "withFinagleClient" -> v(serviceOptions contains WithFinagleClient),
+ "date" -> codify(generationDate)
)
}
}
Something went wrong with that request. Please try again.