-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
159 lines (131 loc) · 3.69 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
plugins {
id 'java'
alias libs.plugins.jooqgradle
alias libs.plugins.gitgradle
}
final git = versionDetails()
group 'space.nerdsin.plugins'
version "${git.lastTag.substring(1)}.r${git.commitDistance}"
archivesBaseName = "$pluginName"
final isCiBuilding = System.getenv().get('CI') == 'true'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileJar {}
compileClasspath.extendsFrom compileJar
runtimeClasspath.extendsFrom compileJar
}
jooq {
version = libs.versions.jooq
configurations {
main {
generationTool {
logging = org.jooq.meta.jaxb.Logging.WARN
jdbc {
driver = 'org.h2.Driver'
url = 'jdbc:h2:mem:'
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
strategy {
name = 'org.jooq.codegen.DefaultGeneratorStrategy'
}
//noinspection GroovyAssignabilityCheck
database {
name = 'org.jooq.meta.extensions.ddl.DDLDatabase'
properties {
//noinspection GroovyAssignabilityCheck
property {
key = 'scripts'
value = 'src/main/resources/db/h2/*'
}
//noinspection GroovyAssignabilityCheck
property {
key = 'sort'
value = 'semantic'
}
}
inputSchema = 'PUBLIC'
outputSchemaToDefault = true
}
generate {}
target {
packageName = 'space.nerdsin.plugins.codegen'
}
}
}
}
}
}
dependencies {
implementation libs.paperapi
compileOnly libs.lombok
annotationProcessor libs.lombok
compileJar libs.h2
compileJar libs.jooq
jooqGenerator libs.bundles.jooqgen
compileJar libs.flyway
compileJar libs.guice
compileJar libs.reflections
}
jar {
archiveBaseName = "$archivesBaseName-SLIM"
//noinspection GroovyAssignabilityCheck
manifest {
attributes("Class-Path": configurations.compileJar.collect { "libs/${it.getName()}" }.join(' '))
}
// finalizedBy task("copyLibs", type: Copy) {
// from configurations.compileJar
// into tasks.jar.destinationDirectory.dir("libs")
// }
finalizedBy task("tarLibs", type: Tar) {
archiveBaseName = "$archivesBaseName-libs"
archiveExtension = "tar.gz"
destinationDirectory = tasks.jar.destinationDirectory
compression = org.gradle.api.tasks.bundling.Compression.GZIP
from configurations.compileJar
}
}
task fatJar(type: Jar) {
archiveBaseName = "$archivesBaseName-FAT"
from {
duplicatesStrategy = DuplicatesStrategy.WARN
configurations.compileJar.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
artifacts {
archives fatJar
}
processResources {
filesMatching('**/plugin.yml') {
//noinspection UnnecessaryQualifiedReference
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
'name' : archivesBaseName,
'class' : pluginClass,
'version' : git.lastTag.substring(1),
'apiversion': pluginApiVersion
]);
}
filesMatching('**/config.yml') {
//noinspection UnnecessaryQualifiedReference
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
'database.filename': databaseFileName
]);
}
}
task createGitHubActionsVars() {
onlyIf { isCiBuilding }
doFirst {
println "::set-output name=slimjar::${jar.archiveFileName.get()}"
println "::set-output name=libstar::${tasks.tarLibs.archiveFileName.get()}"
println "::set-output name=fatjar::${fatJar.archiveFileName.get()}"
println "::set-output name=version::${project.version}"
}
}
build {
finalizedBy createGitHubActionsVars
}