-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle
208 lines (169 loc) · 5.41 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
plugins {
id 'java-library'
id 'checkstyle'
id 'distribution'
id 'com.github.spotbugs' version '6.0.22'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'com.formkiq.gradle.graalvm-native-plugin' version '1.6.0'
id 'de.undercouch.download' version '5.6.0'
id 'org.openapi.generator' version '7.10.0'
}
def moduleName = "formkiq-core"
def getCmd() {
String os = System.getProperty("os.name").toLowerCase()
return os.contains("win") ? "cmd" : "bash"
}
def getCmdParam() {
String os = System.getProperty("os.name").toLowerCase()
return os.contains("win") ? "/c" : "-c"
}
repositories { mavenCentral() }
allprojects {
version = '1.17.0'
ext.awsCognitoVersion = '1.5.7'
group = 'com.formkiq.stacks'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'java-library'
apply plugin: 'checkstyle'
apply plugin: 'com.github.spotbugs'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.formkiq.gradle.graalvm-native-plugin'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
spotless {
java {
eclipse().configFile project.rootProject.file("spotless.eclipseformat.xml")
licenseHeaderFile project.rootProject.file("LICENSE")
}
}
checkstyle {
toolVersion = '10.12.1'
configFile file("config/checkstyle/checkstyle.xml")
configProperties = [project_loc: "${projectDir}"]
maxWarnings = 0
maxErrors = 0
}
spotlessJavaCheck.dependsOn 'spotlessJavaApply'
}
subprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
compileJava.dependsOn 'spotlessCheck'
tasks.withType(Test) {
systemProperties['testregion'] = project.getProperty('testregion')
systemProperties['testprofile'] = project.getProperty('testprofile')
systemProperties['testappenvironment'] = project.getProperty('testappenvironment')
systemProperties['testchatgptapikey'] = project.getProperty('testchatgptapikey')
systemProperties['testeventbridgename'] = project.getProperty('testeventbridgename')
}
spotbugs {
excludeFilter = file("$rootDir/config/gradle/spotbugs-exclude.xml")
}
spotbugsMain {
reports {
html {
enabled = true
}
}
}
spotbugsTest {
reports {
html {
enabled = true
}
}
}
}
description = "FormKiQ Core"
apply plugin: 'distribution'
task buildDistribution(type: Copy) {
dependsOn subprojects.build
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
outputs.upToDateWhen {false}
from 'console/build/distributions'
from 'lambda-api-graalvm/build/distributions'
from 'lambda-s3-graalvm/build/distributions'
from 'lambda-typesense/build/distributions'
from 'lambda-ocr-tesseract/build/distributions'
from 'module-email-notify/build/distributions'
from 'websocket-api/build/distributions'
from 'lambda-apikey-authorizer/build/distributions'
into "${buildDir}/modules"
}
task downloadAwsCognito(type: Download) {
src "https://github.com/formkiq/aws-cognito/releases/download/v${awsCognitoVersion}/aws-cognito-v${awsCognitoVersion}.zip"
dest buildDir
overwrite false
}
/*
task downloadAwsCognito(type: Copy) {
from file("$buildDir/../../../aws-cognito/build/aws-cognito-v${awsCognitoVersion}.zip")
into file("${buildDir}")
}*/
task unzipAwsCognito(type: Copy) {
dependsOn downloadAwsCognito
def zipFile = file("${buildDir}/aws-cognito-v${awsCognitoVersion}.zip")
def outputDir = file("${buildDir}/modules/cognito")
from zipTree(zipFile)
into outputDir
}
task buildTemplate {
dependsOn buildDistribution, unzipAwsCognito
outputs.upToDateWhen { false }
doLast {
copy {
from layout.buildDirectory.dir("${buildDir}/../src/main/resources/cloudformation")
include "*"
into "${buildDir}/modules"
}
exec {
commandLine getCmd(), getCmdParam(), "ytt --data-value version=${project.version} -f ${buildDir}/modules/template.yaml --output-files ${buildDir}/modules"
}
}
}
distZip.dependsOn buildTemplate
tasks.distTar.enabled = false
distributions {
main {
contents {
from(".") {
include "INSTALL.md"
include "LICENSE"
}
from("${buildDir}/modules") {
include "**/**"
}
into '/'
}
}
}
task validateOpenApiJwtSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
inputSpec = "$rootDir/docs/openapi/openapi-jwt.yaml".toString()
recommend = true
}
task validateOpenApiIamSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
inputSpec = "$rootDir/docs/openapi/openapi-iam.yaml".toString()
recommend = true
}
task validateOpenApiKeySpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
inputSpec = "$rootDir/docs/openapi/openapi-key.yaml".toString()
recommend = true
}
task validateOpenApiSpecs(dependsOn: ['validateOpenApiJwtSpec', 'validateOpenApiIamSpec', 'validateOpenApiKeySpec'])
openApiGenerate {
generatorName.set("spring")
inputSpec.set("$rootDir/docs/openapi/openapi-jwt.yaml")
outputDir.set("$buildDir/generated")
apiPackage.set("com.formkiq.springboot.api")
invokerPackage.set("com.formkiq.springboot.invoker")
modelPackage.set("com.formkiq.springboot.model")
}