-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
126 lines (105 loc) · 3.73 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
allprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
group = 'io.hanbings.flows'
// 正式版本号在 publish 设置块中
version = '@{{COMMIT_SHORT_SHA}}-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
// https://mvnrepository.com/artifact/org.jetbrains/annotations
compileOnly 'org.jetbrains:annotations:23.1.0'
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
test {
useJUnitPlatform()
}
compileJava {
options.encoding = 'UTF-8'
}
compileTestJava {
options.encoding = 'UTF-8'
}
javadoc {
options.addBooleanOption('html5', true)
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding('utf-8')
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier.convention('sources')
archiveClassifier.set('sources')
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier.convention('javadocs')
archiveClassifier.set('javadocs')
}
publishing {
repositories {
maven {
// 处理 Release 情况下发布的包
if (project.version.toString().contains('COMMIT_SHORT_SHA')) {
// 如果 version 字符串没有被替换则表明正在 Release 发布或本地发布
// 进行重新替换版本号
version = '1.0.0'
}
url = uri((project.findProperty("repository_root_url") ?: System.getenv("REPOSITORY_ROOT_URL"))
+ (project.version.toString().endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'))
credentials {
username = project.findProperty("repository_user") ?: System.getenv("REPOSITORY_USER")
password = project.findProperty("repository_token") ?: System.getenv("REPOSITORY_TOKEN")
}
}
}
publications {
mavenJava(MavenPublication) {
artifact(jar)
artifact(sourcesJar)
artifact(javadocJar)
}
}
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
}
}
apply plugin: "com.github.johnrengelman.shadow"
task collect(type: Copy) {
destinationDir = file('build/libs')
subprojects.each { p -> from p.file('build/libs') }
}
dependencies {
subprojects.each { p -> implementation create(p) }
subprojects.stream()
.filter(p -> p.name != "flows-common")
.each { p ->
{
p.dependencies {
// common
implementation project(":flows-common")
// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation 'com.google.code.gson:gson:2.10'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
implementation("com.fasterxml.jackson.core:jackson-annotations:2.14.1")
}
}
}
}