Skip to content

Commit

Permalink
Switch deployment to the central repository
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyFault committed Sep 4, 2021
1 parent f036980 commit c18b0f9
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
java
`java-library`
`maven-publish`
signing

alias(libs.plugins.shadow)
alias(libs.plugins.licenser)
Expand All @@ -21,7 +22,11 @@ val versionsuffix: String? by project
if (versionsuffix != null) {
versuffix = "-$versionsuffix"
}
version = ver + versuffix
version = if (!project.hasProperty("release")) {
ver + versuffix
} else {
ver
}

allprojects {
group = "com.plotsquared"
Expand Down Expand Up @@ -59,22 +64,11 @@ subprojects {
plugin<MavenPublishPlugin>()
plugin<ShadowPlugin>()
plugin<Licenser>()
plugin<SigningPlugin>()

plugin<EclipsePlugin>()
plugin<IdeaPlugin>()
}

tasks {
// This is to create the target dir under the root project with all jars.
val assembleTargetDir = create<Copy>("assembleTargetDirectory") {
destinationDir = rootDir.resolve("target")
into(destinationDir)
from(withType<Jar>())
}
named("build") {
dependsOn(assembleTargetDir)
}
}
}

val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name)
Expand All @@ -88,7 +82,6 @@ allprojects {
plugins.withId("java") {
the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(16))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
}
}

Expand All @@ -103,6 +96,13 @@ allprojects {
withJavadocJar()
}

signing {
if (!version.toString().endsWith("-SNAPSHOT")) {
signing.isRequired
sign(publishing.publications)
}
}

publishing {
publications {
create<MavenPublication>("maven") {
Expand All @@ -111,6 +111,11 @@ allprojects {
from(components["java"])

pom {

name.set(project.name + " " + project.version)
description.set("PlotSquared is a land and world management plugin for Minecraft.")
url.set("https://github.com/IntellectualSites/PlotSquared")

licenses {
license {
name.set("GNU General Public License, Version 3.0")
Expand Down Expand Up @@ -143,6 +148,11 @@ allprojects {
connection.set("scm:https://[email protected]/IntellectualSites/PlotSquared.git")
developerConnection.set("scm:git://github.com/IntellectualSites/PlotSquared.git")
}

issueManagement{
system.set("GitHub")
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
}
}
}
}
Expand All @@ -158,11 +168,11 @@ allprojects {
val nexusPassword: String? by project
if (nexusUsername != null && nexusPassword != null) {
maven {
val repositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
val releasesRepositoryUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepositoryUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = uri(
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
else repositoryUrl
else releasesRepositoryUrl
)

credentials {
Expand All @@ -179,7 +189,6 @@ allprojects {
tasks {
named<Delete>("clean") {
doFirst {
rootDir.resolve("target").deleteRecursively()
javadocDir.deleteRecursively()
}
}
Expand All @@ -201,7 +210,6 @@ allprojects {
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"
)
opt.destinationDirectory = javadocDir
}

jar {
Expand Down

0 comments on commit c18b0f9

Please sign in to comment.