Skip to content

Commit c816e0b

Browse files
committed
Apply conventions plugin
1 parent 1753fcf commit c816e0b

7 files changed

Lines changed: 26 additions & 41 deletions

File tree

api/build.gradle.kts

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id("java-library")
3-
id("maven-publish")
3+
alias(libs.plugins.conventions.publishing)
44
}
55

66
repositories {
@@ -26,28 +26,9 @@ tasks {
2626
}
2727
}
2828

29-
java {
30-
withJavadocJar()
31-
withSourcesJar()
32-
}
33-
34-
publishing {
35-
repositories {
36-
maven {
37-
val releasesUrl = "https://repo.earthmc.net/releases"
38-
val snapshotsUrl = "https://repo.earthmc.net/snapshots"
39-
url = uri(if (project.version.toString().endsWith("-SNAPSHOT")) snapshotsUrl else releasesUrl)
40-
41-
name = "earthmc"
42-
credentials(PasswordCredentials::class)
43-
}
44-
}
45-
46-
publications {
47-
create<MavenPublication>("library") {
48-
from(components.getByName("java"))
49-
50-
artifactId = "mycelium-api"
51-
}
29+
earthmc {
30+
publishing {
31+
public = true
32+
artifactId = "mycelium-api"
5233
}
5334
}

build.gradle.kts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
2-
id("java")
32
id("com.gradleup.shadow") version "9.1.0" apply false
3+
alias(libs.plugins.conventions.java) apply false
4+
alias(libs.plugins.conventions.publishing) apply false
45
}
56

67
allprojects {
@@ -10,15 +11,8 @@ allprojects {
1011
mavenCentral()
1112
maven("https://repo.papermc.io/repository/maven-public/")
1213
}
14+
}
1315

14-
tasks {
15-
compileJava {
16-
options.encoding = Charsets.UTF_8.name()
17-
options.release.set(21)
18-
}
19-
20-
processResources {
21-
filteringCharset = Charsets.UTF_8.name()
22-
}
23-
}
16+
subprojects {
17+
apply(plugin = "net.earthmc.conventions.java")
2418
}

gradle/libs.versions.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[versions]
2+
earthmc-conventions = "1.0.2"
3+
14
[libraries]
25
jspecify = { group = "org.jspecify", name = "jspecify", version = "1.0.0" }
36
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version = "26.0.2" }
@@ -10,3 +13,7 @@ velocity-api = { group = "com.velocitypowered", name = "velocity-api", version =
1013
paper-api = { group = "io.papermc.paper", name = "paper-api", "version" = "1.21.8-R0.1-SNAPSHOT" }
1114

1215
gson = { group = "com.google.code.gson", name = "gson", version = "2.12.1" }
16+
17+
[plugins]
18+
conventions-java = { id = "net.earthmc.conventions.java", version.ref = "earthmc-conventions" }
19+
conventions-publishing = { id = "net.earthmc.conventions.publishing", version.ref = "earthmc-conventions" }

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
maven("https://repo.earthmc.net/public")
5+
}
6+
}
7+
18
rootProject.name = "Mycelium"
29

310
include("api", "client", "examples", "platform:velocity", "platform:paper")

0 commit comments

Comments
 (0)