Skip to content

Commit

Permalink
Updated sample-maven and sample-gradle modules
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechhabarta committed Jan 7, 2018
1 parent 39f4b73 commit 370bb97
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 55 deletions.
48 changes: 22 additions & 26 deletions sample-gradle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,56 @@

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: "kotlin"
apply plugin: "scala"

apply plugin: 'kotlin'
apply plugin: 'scala'
apply plugin: 'cz.habarta.typescript-generator'


version = '1.0'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '2.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
jcenter()
}

dependencies {
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.6.3'
compile 'org.codehaus.groovy:groovy-all:2.4.12'
compile 'org.scala-lang:scala-library:2.11.8'
compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.2'
compile 'org.codehaus.groovy:groovy-all:2.4.13'
compile 'org.scala-lang:scala-library:2.12.4'
}

buildscript {
ext.kotlin_version = '1.2.10'

repositories {
mavenLocal()
jcenter()
}

dependencies {
classpath group: 'cz.habarta.typescript-generator', name: 'typescript-generator-gradle-plugin', version: '1.+'

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'cz.habarta.typescript-generator:typescript-generator-gradle-plugin:2.+'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10'
classpath 'com.fasterxml.jackson.module:jackson-module-scala_2.12:2.9.2'
}
}

generateTypeScript {
outputFile = 'build/sample.d.ts'
classes = [
'cz.habarta.typescript.generator.sample.Person',
'cz.habarta.typescript.generator.sample.PersonGroovy',
'cz.habarta.typescript.generator.sample.PersonKt',
'cz.habarta.typescript.generator.sample.PersonScala',
]
jsonLibrary = 'jackson2'
outputKind = 'global'
namespace = 'GradleSample'
outputKind = 'module'
excludeClasses = [
GroovyObject.name
'groovy.lang.GroovyObject',
'java.io.Serializable',
'scala.Equals',
'scala.Product',
'scala.Serializable',
]
jackson2Modules = [
'com.fasterxml.jackson.module.scala.DefaultScalaModule'
]
// declarePropertiesAsOptional = false
// removeTypeNameSuffix = 'Json'
// mapDate = 'asNumber'
}

// Modify the gradle version here then execute ./gradlew wrapper to change the gradle version
task wrapper(type: Wrapper) {
gradleVersion = '4.4.1'
}
build.dependsOn generateTypeScript
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
package cz.habarta.typescript.generator.sample

class PersonGroovy {

public String name
public int age
public boolean hasChildren
public List<String> tags
public Map<String, String> emails

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

import java.util.*;


public class Person {

public String name;
public int age;
public boolean hasChildren;
public List<String> tags;
public Map<String, String> emails;

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package cz.habarta.typescript.generator.sample

data class PersonKt (
Expand All @@ -6,4 +7,4 @@ data class PersonKt (
val hasChildren: Boolean,
val tags: List<String>,
val emails: Map<String, String>
)
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package cz.habarta.typescript.generator.sample;

package cz.habarta.typescript.generator.sample;

abstract class PersonScala {
var name: String
}
case class PersonScala (
name: String,
age: Int,
hasChildren: Boolean,
tags: java.util.List[String],
emails: java.util.Map[String, String]
)
28 changes: 15 additions & 13 deletions sample-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,36 @@

<groupId>cz.habarta.typescript-generator</groupId>
<artifactId>sample-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sample-maven</name>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate5</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.6.Final</version>
<version>2.9.3</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>cz.habarta.typescript-generator</groupId>
<artifactId>typescript-generator-maven-plugin</artifactId>
<version>1.25.322</version>
<version>2.0.400</version>
<executions>
<execution>
<id>generate</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@

import java.util.*;


public class Person {

public String name;
public int age;
public boolean hasChildren;
public List<String> tags;
public Map<String, String> emails;

@javax.persistence.Transient
public String excluded;

}

0 comments on commit 370bb97

Please sign in to comment.