Skip to content

Commit 604a62d

Browse files
committed
Refactor gradle to make it more organised
1 parent f7a82c9 commit 604a62d

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

build.gradle

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ compileJava {
1717
targetCompatibility = JavaVersion.VERSION_17
1818
}
1919

20+
compileKotlin {
21+
// We're not using Kotlin in the plugin itself, just tests!
22+
enabled = false
23+
}
24+
2025
compileTestJava {
2126
sourceCompatibility = JavaVersion.VERSION_21
2227
targetCompatibility = JavaVersion.VERSION_21
@@ -73,10 +78,6 @@ dependencies {
7378
// TODO update to correct version once we have it published
7479
implementation 'org.mvplugins.multiverse.core:multiverse-core:5.0.0-SNAPSHOT'
7580

76-
// hk2 for annotation processing only
77-
compileOnly('org.glassfish.hk2:hk2-api:3.0.3') {
78-
exclude group: '*', module: '*'
79-
}
8081

8182
// Config
8283
api 'com.dumptruckman.minecraft:JsonConfiguration:1.2-SNAPSHOT'
@@ -103,7 +104,10 @@ dependencies {
103104
testImplementation 'com.natpryce:hamkrest:1.8.0.1'
104105
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0'
105106

106-
// Annotation Processors
107+
// hk2 for annotation processing only
108+
compileOnly('org.glassfish.hk2:hk2-api:3.0.3') {
109+
exclude group: '*', module: '*'
110+
}
107111
annotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
108112
testAnnotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
109113
}
@@ -128,43 +132,17 @@ tasks.withType(Javadoc).configureEach {
128132
options.encoding = 'UTF-8'
129133
}
130134

131-
132135
configurations {
133136
[apiElements, runtimeElements].each {
134137
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
135138
it.outgoing.artifact(shadowJar)
136139
}
137140
}
138141

139-
140-
publishing {
141-
publications {
142-
maven(MavenPublication) {
143-
from components.java
144-
}
145-
}
146-
repositories {
147-
maven {
148-
name = "GitHubPackages"
149-
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Inventories"
150-
credentials {
151-
username = System.getenv("GITHUB_ACTOR")
152-
password = System.getenv("GITHUB_TOKEN")
153-
}
154-
}
155-
}
156-
}
157-
158-
159-
compileKotlin {
160-
// We're not using Kotlin in the plugin itself, just tests!
161-
enabled = false
162-
}
163142
configurations.findAll { !it.name.startsWith('test') }.each {
164143
it.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
165144
}
166145

167-
168146
processResources {
169147
def props = [version: "${project.version}"]
170148
inputs.properties props
@@ -178,20 +156,17 @@ processResources {
178156
outputs.upToDateWhen { false }
179157
}
180158

181-
182159
checkstyle {
183160
toolVersion = '6.1.1'
184161
configFile file('config/mv_checks.xml')
185162
ignoreFailures = true
186163
}
187164

188-
189165
javadoc {
190166
source = sourceSets.main.allJava
191167
classpath = configurations.compileClasspath
192168
}
193169

194-
195170
project.configurations.api.canBeResolved = true
196171

197172
shadowJar {
@@ -220,3 +195,21 @@ shadowJar {
220195

221196
build.dependsOn shadowJar
222197
jar.enabled = false
198+
199+
publishing {
200+
publications {
201+
maven(MavenPublication) {
202+
from components.java
203+
}
204+
}
205+
repositories {
206+
maven {
207+
name = "GitHubPackages"
208+
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Inventories"
209+
credentials {
210+
username = System.getenv("GITHUB_ACTOR")
211+
password = System.getenv("GITHUB_TOKEN")
212+
}
213+
}
214+
}
215+
}

0 commit comments

Comments
 (0)