-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle
256 lines (220 loc) · 8.3 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id "base"
id 'maven-publish'
id "com.github.spotbugs" version "${githubSpotbugsVersion}"
id "com.github.johnrengelman.shadow" version "${githubJohnrengelmanShadowVersion}"
id "de.undercouch.download" version "${underCouchDownloadVersion}"
id "net.researchgate.release" version "${researchgateReleaseVersion}"
id 'org.javamodularity.moduleplugin' version "${javaModularityVersion}" apply false
}
apply plugin: 'java'
apply plugin: "com.github.spotbugs"
apply plugin: 'jacoco'
apply plugin: "org.javamodularity.moduleplugin"
ext.ballerinaLangVersion = project.ballerinaLangVersion
ext.testngVersion = project.testngVersion
ext.slf4jVersion = project.slf4jVersion
ext.stdlibIoVersion = project.stdlibIoVersion
ext.stdlibLogVersion = project.stdlibLogVersion
ext.stdlibMimeVersion = project.stdlibMimeVersion
ext.stdlibAuthVersion = project.stdlibAuthVersion
ext.stdlibCacheVersion = project.stdlibCacheVersion
ext.stdlibTimeVersion = project.stdlibTimeVersion
ext.stdlibCryptoVersion = project.stdlibCryptoVersion
ext.stdlibTaskVersion = project.stdlibTaskVersion
ext.stdlibFileVersion = project.stdlibFileVersion
ext.stdlibHttpVersion = project.stdlibHttpVersion
ext.stdlibUrlVersion = project.stdlibUrlVersion
ext.stdlibDataXmldataVersion = project.stdlibDataXmldataVersion
ext.puppycrawlCheckstyleVersion = project.puppycrawlCheckstyleVersion
def packageName = "asyncapi"
configurations {
balTools
}
allprojects {
group = 'io.ballerina'
version = project.version
apply plugin: 'checkstyle'
apply plugin: 'maven-publish'
repositories {
mavenLocal()
maven {
url = 'https://maven.pkg.github.com/ballerina-platform/*'
credentials {
username System.getenv("packageUser")
password System.getenv("packagePAT")
}
}
maven {
url = 'https://maven.wso2.org/nexus/content/repositories/releases/'
}
maven {
url = 'https://maven.wso2.org/nexus/content/groups/wso2-public/'
}
maven {
url = 'https://maven.wso2.org/nexus/content/repositories/orgballerinalang-1614'
}
maven {
url = 'https://repo.maven.apache.org/maven2'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
subprojects {
apply plugin: 'java'
dependencies {
implementation "io.apicurio:apicurio-data-models:${apiCurioVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonDataformatYamlVersion}"
implementation "commons-io:commons-io:${commonsIoVersion}"
implementation "org.ballerinalang:ballerina-lang:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-parser:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-cli:${ballerinaLangVersion}"
implementation "org.ballerinalang:formatter-core:${ballerinaLangVersion}"
implementation "org.ballerinalang:ballerina-tools-api:${ballerinaLangVersion}"
implementation "io.ballerina.stdlib:http-native:${stdlibHttpVersion}"
implementation "org.ballerinalang:language-server-commons:${ballerinaLangVersion}"
implementation "info.picocli:picocli:${picocliVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.0"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation "org.testng:testng:${testngVersion}"
}
}
ext {
snapshotVersion= '-SNAPSHOT'
timestampedVersionRegex = '.*-\\d{8}-\\d{6}-\\w.*\$'
}
test {
useTestNG() {
suites "src/test/resources/testng.xml"
}
}
def moduleVersion = project.version.replace("-SNAPSHOT", "")
release {
// Disable check snapshots temporarily
failOnPublishNeeded = false
versionPropertyFile = 'gradle.properties'
tagTemplate = 'v${version}'
git {
// To release from any branch
requireBranch = "release-${moduleVersion}"
pushToRemote = 'origin'
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task codeCoverageReport(type: JacocoReport) {
dependsOn = subprojects.test
executionData fileTree(project.rootDir.absolutePath).include("**/build/coverage-reports/*.exec")
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.required = true
html.required = true
csv.required = true
xml.destination(new File("${buildDir}/reports/jacoco/report.xml"))
html.destination(new File("${buildDir}/reports/jacoco/report.html"))
csv.destination(new File("${buildDir}/reports/jacoco/report.csv"))
}
onlyIf = {
true
}
}
shadowJar {
configurations = [project.configurations.runtimeClasspath]
dependencies {
include(dependency('com.github.jknack:handlebars'))
include(dependency('org.antlr:antlr4:4.5'))
include(dependency("io.apicurio:apicurio-data-models:${apiCurioVersion}"))
include(dependency('com.atlassian.commonmark:commonmark'))
include(dependency('com.atlassian.commonmark:commonmark-ext-gfm-tables'))
exclude('META-INF/*.SF')
exclude('META-INF/*.DSA')
exclude('META-INF/*.RSA')
}
}
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}
def artifactCacheParent = file("$project.projectDir/build/cache_parent/")
def artifactLibParent = file("$project.projectDir/build/lib_parent/")
def targetAsyncApiCliJar = file("$project.rootDir/asyncapi-cli/build/libs/asyncapi-cli-${project.version}.jar")
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}
task directoryBuild {
inputs.dir file(project.projectDir)
doNotTrackState("build needs to run every time")
doLast {
copy {
from targetAsyncApiCliJar
into file("$artifactLibParent/libs")
}
}
outputs.dir artifactCacheParent
outputs.dir artifactLibParent
}
task createArtifactZip(type: Zip) {
destinationDirectory = file("${buildDir}/distributions")
from directoryBuild
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact source: createArtifactZip, extension: 'zip'
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ballerina-platform/asyncapi-tools")
credentials {
username = System.getenv("packageUser")
password = System.getenv("packagePAT")
}
}
}
}
directoryBuild.dependsOn ":${packageName}-cli:build"
directoryBuild.dependsOn ":compileJava"
directoryBuild.dependsOn ":compileTestJava"
directoryBuild.dependsOn ":test"
directoryBuild.dependsOn ":jar"
directoryBuild.dependsOn ":checkstyleMain"
directoryBuild.dependsOn ":checkstyleTest"
directoryBuild.dependsOn ":spotbugsMain"
directoryBuild.dependsOn ":spotbugsTest"
directoryBuild.dependsOn ":native.handler:compileJava"
directoryBuild.dependsOn ":native.handler:compileTestJava"
directoryBuild.dependsOn ":native.handler:jar"
directoryBuild.dependsOn ":native.handler:checkstyleMain"
directoryBuild.dependsOn ":native.handler:checkstyleTest"
directoryBuild.dependsOn ":native.handler:test"
directoryBuild.dependsOn ":native.handler:java-wrapper:compileJava"
directoryBuild.dependsOn ":native.handler:java-wrapper:compileTestJava"
directoryBuild.dependsOn ":native.handler:java-wrapper:jar"
directoryBuild.dependsOn ":native.handler:java-wrapper:checkstyleMain"
directoryBuild.dependsOn ":native.handler:java-wrapper:checkstyleTest"
directoryBuild.dependsOn ":native.handler:java-wrapper:test"
directoryBuild.dependsOn ":native.handler:java-wrapper:processTestResources"
directoryBuild.dependsOn ":checkstyle:compileTestJava"
directoryBuild.dependsOn ":checkstyle:checkstyleMain"
directoryBuild.dependsOn ":checkstyle:checkstyleTest"
directoryBuild.dependsOn ":checkstyle:test"
directoryBuild.dependsOn ":checkstyle:processTestResources"
directoryBuild.dependsOn ":generatePomFileForMavenJavaPublication"
build.dependsOn directoryBuild
publish.dependsOn build