-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
198 lines (162 loc) · 6.12 KB
/
build.gradle
File metadata and controls
198 lines (162 loc) · 6.12 KB
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
import team.yi.tools.semanticgitlog.VersionStrategy
plugins {
id "io.freefair.lombok" version "8.4"
id 'java-library'
id 'maven-publish'
id 'signing'
id 'team.yi.semantic-gitlog' version '0.6.5'
}
group = 'team.yi.tools'
description = 'A toolkit for parsing or check `Conventional Commits`.'
version = '0.5.27'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
api 'org.apache.commons:commons-lang3:3.17.0'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
api 'org.slf4j:slf4j-simple:2.0.16'
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.3'
}
lombok {
version = "1.18.30"
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
// https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.MavenPublication.html
pom {
name = project.name
description = project.description
url = 'https://github.com/semantic-gitlog/semantic-commit'
inceptionYear = '2020'
scm {
url = 'https://github.com/semantic-gitlog/semantic-commit'
connection = 'scm:git:git@github.com:semantic-gitlog/semantic-commit.git'
developerConnection = 'scm:git:git@github.com:semantic-gitlog/semantic-commit.git'
}
licenses {
license {
name = "MIT"
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
organization {
name = "Yi.Team"
url = 'https://yi.team/'
}
developers {
developer {
name = "ymind"
email = 'ymind@yi.team'
url = 'https://yi.team/'
organization = 'Yi.Team'
organizationUrl = 'https://yi.team/'
}
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/semantic-gitlog/semantic-commit/issues'
}
ciManagement {
system = 'GitHub'
url = 'https://github.com/semantic-gitlog/semantic-commit/actions'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("OSSRH_USERNAME") ?: "${project.properties["OSSRH_USERNAME"]}"
password = System.getenv("OSSRH_TOKEN") ?: "${project.properties["OSSRH_TOKEN"]}"
}
}
}
}
signing {
project.ext.set("signing.keyId", System.getenv("OSSRH_GPG_SECRET_ID") ?: "${project.properties["OSSRH_GPG_SECRET_ID"]}")
project.ext.set("signing.secretKeyRingFile", System.getenv("OSSRH_GPG_SECRET_KEY") ?: "${project.properties["OSSRH_GPG_SECRET_KEY"]}")
project.ext.set("signing.password", System.getenv("OSSRH_GPG_SECRET_PASSWORD") ?: "${project.properties["OSSRH_GPG_SECRET_PASSWORD"]}")
sign(publishing.publications.getByName("mavenJava"))
}
// ./gradlew setNewVersion -P newVersion=2.1.3
task setNewVersion {
println version
if (project.hasProperty('newVersion')) {
println "Set Project to new Version $newVersion"
String s = buildFile.getText().replaceFirst("version = '$version'", "version = '$newVersion'")
buildFile.setText(s)
}
}
changelog {
toRef = "master"
strategy = VersionStrategy.strict
jsonFile = file("${project.rootDir}/CHANGELOG.json")
fileSets = [
{
template = file("${project.rootDir}/config/gitlog/CHANGELOG.md.mustache")
target = file("${project.rootDir}/CHANGELOG.md")
},
{
template = file("${project.rootDir}/config/gitlog/CHANGELOG.zh-cn.md.mustache")
target = file("${project.rootDir}/CHANGELOG.zh-cn.md")
}
]
commitLocales = [
"en" : file("${project.rootDir}/config/gitlog/commit-locales.md"),
"zh-cn": file("${project.rootDir}/config/gitlog/commit-locales.zh-cn.md")
]
scopeProfiles = [
"en" : file("${project.rootDir}/config/gitlog/commit-scopes.md"),
"zh-cn": file("${project.rootDir}/config/gitlog/commit-scopes.zh-cn.md")
]
issueUrlTemplate = "https://github.com/semantic-gitlog/semantic-commit/issues/:issueId"
commitUrlTemplate = "https://github.com/semantic-gitlog/semantic-commit/commit/:commitId"
mentionUrlTemplate = "https://github.com/:username"
outputs.upToDateWhen { false }
}
derive {
toRef = "master"
derivedVersionMark = "NEXT_VERSION:=="
strategy = VersionStrategy.strict
commitLocales = [
"en" : file("${project.rootDir}/config/gitlog/commit-locales.md"),
"zh-cn": file("${project.rootDir}/config/gitlog/commit-locales.zh-cn.md")
]
scopeProfiles = [
"en" : file("${project.rootDir}/config/gitlog/commit-scopes.md"),
"zh-cn": file("${project.rootDir}/config/gitlog/commit-scopes.zh-cn.md")
]
outputs.upToDateWhen { false }
}