This repository was archived by the owner on Feb 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathbuild.gradle
83 lines (71 loc) · 2.53 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath deps.tools.vfs
classpath deps.tools.httpclient
classpath deps.tools.swaggerPlugin
}
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'org.ysb33r.vfs'
apply plugin: 'org.hidetake.swagger.generator'
apply plugin: 'eclipse'
apply from: rootProject.file('gradle/convention.gradle')
apply from: rootProject.file('gradle/dependencies.gradle')
apply from: rootProject.file('gradle/publish-jar.gradle')
repositories {
jcenter()
}
dependencies {
swaggerCodegen deps.swagger.v2.cli
compile deps.swagger.v2.annotations
implementation deps.codegen.feignCore
implementation deps.codegen.feignJackson
implementation deps.codegen.feignLogging
implementation deps.codegen.feignForm
implementation deps.codegen.jacksonJsr310
implementation deps.codegen.oltuOauth2
testImplementation deps.test.spockCore
testRuntime deps.test.cglibNodep
testRuntime deps.test.objenesis
}
def spec = file("${project.getProjectDir()}/resources/st-api.yml")
def swaggerConfig = file("${project.getProjectDir()}/resources/config.json")
def swaggerOutput = file("${project.getBuildDir().path}/gen")
// Define Java code generation tasks
// For models-only generation, use 'jersey2' as it has no default serializer
swaggerSources {
apis {
inputFile = spec
code {
language = 'java'
configFile = swaggerConfig
outputDir = swaggerOutput
components = ['models', 'apis', 'supportingFiles']
dependsOn validation
}
}
}
// Disallow CheckStyle from analyzing generated classes by setting
// the source to the non-generated directories
checkstyleMain.source = "${project.getProjectDir()}/src/main/java"
// Insert generated code into the sourceSets
sourceSets.main.java.srcDir "${swaggerSources.apis.code.outputDir}/src/main/java"
sourceSets.main.resources.srcDir "${swaggerSources.apis.code.outputDir}/src/main/resources"
// Generate classes prior to compileJava
compileJava.dependsOn swaggerSources.apis.code
// Automatically generate models when IntelliJ loads the project
ideaModule.dependsOn generateSwaggerCode
task githubJavadoc(type: Javadoc, dependsOn: generateSwaggerCode) {
source = sourceSets.main.allJava
destinationDir = rootProject.file('docs/smartthings-client/javadoc')
options.addBooleanOption("notimestamp", true)
}