Skip to content

Commit afd593c

Browse files
resolved #12 - implemented gradle plugin, added sample-maven and sample-gradle
1 parent d7b99e2 commit afd593c

File tree

13 files changed

+251
-0
lines changed

13 files changed

+251
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ pom.xml.releaseBackup
44
pom.xml.versionsBackup
55
pom.xml.next
66
release.properties
7+
/sample-gradle/.gradle/
8+
/sample-gradle/.nb-gradle/
9+
/sample-gradle/build/

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<modules>
1414
<module>typescript-generator-core</module>
1515
<module>typescript-generator-maven-plugin</module>
16+
<module>typescript-generator-gradle-plugin</module>
1617
</modules>
1718

1819
<licenses>

sample-gradle/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
apply plugin: 'java'
3+
apply plugin: 'cz.habarta.typescript-generator'
4+
5+
6+
version = '1.0'
7+
sourceCompatibility = 1.7
8+
targetCompatibility = 1.7
9+
10+
repositories {
11+
mavenCentral()
12+
}
13+
dependencies {
14+
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.6.3'
15+
}
16+
17+
buildscript {
18+
repositories {
19+
// mavenCentral()
20+
mavenLocal()
21+
}
22+
dependencies {
23+
classpath group: 'cz.habarta.typescript-generator', name: 'typescript-generator-gradle-plugin', version: '1.2-SNAPSHOT'
24+
}
25+
}
26+
27+
generateTypeScript {
28+
outputFile = 'build/sample.d.ts'
29+
classes = [
30+
'cz.habarta.typescript.generator.sample.Person'
31+
]
32+
jsonLibrary = 'jackson2'
33+
namespace = 'Rest';
34+
// module = 'my-module'
35+
// declarePropertiesAsOptional = false
36+
// removeTypeNameSuffix = 'Json'
37+
// mapDate = 'asNumber'
38+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
package cz.habarta.typescript.generator.sample;
3+
4+
import java.util.*;
5+
6+
7+
public class Person {
8+
9+
public String name;
10+
public int age;
11+
public boolean hasChildren;
12+
public List<String> tags;
13+
public Map<String, String> emails;
14+
15+
}

sample-maven/pom.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>cz.habarta.typescript-generator</groupId>
6+
<artifactId>sample-maven</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
<name>sample-maven</name>
10+
11+
<dependencies>
12+
<dependency>
13+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
14+
<artifactId>jackson-jaxrs-json-provider</artifactId>
15+
<version>2.6.3</version>
16+
</dependency>
17+
</dependencies>
18+
19+
<build>
20+
<plugins>
21+
<plugin>
22+
<groupId>cz.habarta.typescript-generator</groupId>
23+
<artifactId>typescript-generator-maven-plugin</artifactId>
24+
<version>1.2-SNAPSHOT</version>
25+
<executions>
26+
<execution>
27+
<id>generate</id>
28+
<goals>
29+
<goal>generate</goal>
30+
</goals>
31+
<configuration>
32+
<classes>
33+
<class>cz.habarta.typescript.generator.sample.Person</class>
34+
</classes>
35+
<outputFile>target/sample.d.ts</outputFile>
36+
</configuration>
37+
</execution>
38+
</executions>
39+
</plugin>
40+
</plugins>
41+
</build>
42+
</project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
package cz.habarta.typescript.generator.sample;
3+
4+
import java.util.*;
5+
6+
7+
public class Person {
8+
9+
public String name;
10+
public int age;
11+
public boolean hasChildren;
12+
public List<String> tags;
13+
public Map<String, String> emails;
14+
15+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>cz.habarta.typescript-generator</groupId>
7+
<artifactId>typescript-generator</artifactId>
8+
<version>1.2-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>typescript-generator-gradle-plugin</artifactId>
12+
<packaging>jar</packaging>
13+
<name>typescript-generator-gradle-plugin</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.gradle</groupId>
18+
<artifactId>gradle-core</artifactId>
19+
<version>2.0</version>
20+
<scope>system</scope>
21+
<systemPath>${basedir}/gradle-lib/gradle-core-2.0.jar</systemPath>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.gradle</groupId>
25+
<artifactId>gradle-base-services</artifactId>
26+
<version>2.0</version>
27+
<scope>system</scope>
28+
<systemPath>${basedir}/gradle-lib/gradle-base-services-2.0.jar</systemPath>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.gradle</groupId>
32+
<artifactId>gradle-base-services-groovy</artifactId>
33+
<version>2.0</version>
34+
<scope>system</scope>
35+
<systemPath>${basedir}/gradle-lib/gradle-base-services-groovy-2.0.jar</systemPath>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.codehaus.groovy</groupId>
39+
<artifactId>groovy-all</artifactId>
40+
<version>2.4.4</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>cz.habarta.typescript-generator</groupId>
44+
<artifactId>typescript-generator-core</artifactId>
45+
<version>1.2-SNAPSHOT</version>
46+
</dependency>
47+
</dependencies>
48+
49+
<build>
50+
<plugins>
51+
</plugins>
52+
</build>
53+
54+
</project>

0 commit comments

Comments
 (0)