forked from tomokinakamaru/silverchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
150 lines (128 loc) · 3.88 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
plugins {
id 'antlr'
id 'java'
id 'jacoco'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
id 'signing'
}
group 'silverchain'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
dependencies {
antlr "org.antlr:antlr4:4.13.2"
implementation 'info.picocli:picocli:4.7.6'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.26.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0'
testImplementation 'org.assertj:assertj-core:3.26.3'
}
generateGrammarSource {
arguments += ['-visitor', '-long-messages']
}
java {
withJavadocJar()
withSourcesJar()
}
processResources {
from ('gradle.properties') {
rename '.*', 'silverchain.properties'
}
}
shadowJar {
manifest {
attributes('Main-Class' : 'silverchain.Cli')
}
}
spotless {
java {
target 'src/*/java/**/*.java'
googleJavaFormat('1.16.0')
}
}
test {
useJUnitPlatform()
}
check {
dependsOn jacocoTestReport
}
jacoco {
toolVersion = '0.8.8'
}
jacocoTestReport {
reports {
xml.required = true
}
afterEvaluate {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['silverchain/parser/*.class'])
})
}
}
task testGeneratedJava(type: Exec) {
dependsOn 'test'
workingDir 'src/test/resources/java'
commandLine './gradlew', 'check', '--no-daemon'
}
check {
dependsOn testGeneratedJava
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
tasks.withType(AbstractPublishToMaven) { it.dependsOn check }
publishing {
repositories {
maven {
def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = isReleaseVersion ? releaseRepo : snapshotRepo
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
}
}
}
publications {
def mavenGroupId = 'io.github.tomokinakamaru.silverchain'
mavenJava(MavenPublication) {
pom {
groupId = mavenGroupId
name = mavenGroupId + ':' + project.name
description = 'Fluent API generator'
url = 'https://github.com/tomokinakamaru/silverchain/'
from components.java
licenses {
license {
name = 'MIT'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
name = 'Tomoki Nakamaru'
email = '[email protected]'
organization = 'Tomoki Nakamaru'
organizationUrl = 'https://github.com/tomokinakamaru/'
}
}
scm {
connection = 'scm:git:[email protected]:tomokinakamaru/silverchain.git'
developerConnection = 'scm:git:[email protected]:tomokinakamaru/silverchain.git'
url = 'https://github.com/tomokinakamaru/silverchain/'
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}