Automatic deployment (#1298)

* Fixes #992

* Address asterisk imports

* Deploy sources jar & javador jar as well

* Merge branch 'main' into feature/main/automaticDeployment
This commit is contained in:
NotMyFault 2021-09-19 22:50:34 +02:00 committed by GitHub
parent aba147f787
commit 9d68cd8380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 172 additions and 25 deletions

View File

@ -932,8 +932,8 @@ ij_kotlin_method_call_chain_wrap = off
ij_kotlin_method_parameters_new_line_after_left_paren = false
ij_kotlin_method_parameters_right_paren_on_new_line = false
ij_kotlin_method_parameters_wrap = off
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_name_count_to_use_star_import = 500
ij_kotlin_name_count_to_use_star_import_for_members = 300
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true

View File

@ -17,9 +17,9 @@ import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getPlugin
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import javax.inject.Inject
@ -162,6 +162,81 @@ fun Project.applyLibrariesConfiguration() {
publications {
register<MavenPublication>("maven") {
from(libsComponent)
group = "com.fastasyncworldedit"
artifactId = "${rootProject.name}-Libs"
version = version
pom {
name.set("${rootProject.name}-Libs" + " " + project.version)
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
licenses {
license {
name.set("GNU General Public License, Version 3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
distribution.set("repo")
}
}
developers {
developer {
id.set("NotMyFault")
name.set("NotMyFault")
email.set("contact@notmyfault.dev")
organization.set("IntellectualSites")
}
developer {
id.set("SirYwell")
name.set("Hannes Greule")
organization.set("IntellectualSites")
}
developer {
id.set("dordsor21")
name.set("dordsor21")
organization.set("IntellectualSites")
}
}
scm {
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/FastAsyncWorldEdit.git")
developerConnection.set("scm:git://github.com/IntellectualSites/FastAsyncWorldEdit.git")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
}
}
}
}
repositories {
mavenLocal()
val nexusUsername: String? by project
val nexusPassword: String? by project
if (nexusUsername != null && nexusPassword != null) {
maven {
val releasesRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
/* Commenting this out for now - Fawe currently does not user semver or any sort of versioning that
differentiates between snapshots and releases, API & (past) deployment wise, this will come with a next major release.
url = uri(
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
else releasesRepositoryUrl
)
*/
url = uri(releasesRepositoryUrl)
credentials {
username = nexusUsername
password = nexusPassword
}
}
} else {
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
}
}
}

View File

@ -1,17 +1,24 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.attributes.java.TargetJvmVersion
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test
import org.gradle.external.javadoc.StandardJavadocDocletOptions
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
fun Project.applyPlatformAndCoreConfiguration() {
@ -84,35 +91,100 @@ fun Project.applyPlatformAndCoreConfiguration() {
}
}
tasks.register<Jar>("javadocJar") {
dependsOn("javadoc")
archiveClassifier.set(null as String?)
archiveFileName.set("${rootProject.name}-${project.description}-${project.version}-javadoc.${archiveExtension.getOrElse("jar")}")
from(tasks.getByName<Javadoc>("javadoc").destinationDir)
configure<JavaPluginExtension> {
disableAutoTargetJvm()
withJavadocJar()
}
tasks.named("assemble").configure {
dependsOn("javadocJar")
if (name in setOf("worldedit-core", "worldedit-bukkit", "worldedit-cli")) {
the<JavaPluginExtension>().withSourcesJar()
}
artifacts {
add("archives", tasks.named("jar"))
add("archives", tasks.named("javadocJar"))
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
if (name == "worldedit-core" || name == "worldedit-bukkit") {
tasks.register<Jar>("sourcesJar") {
dependsOn("classes")
archiveClassifier.set(null as String?)
archiveFileName.set("${rootProject.name}-${project.description}-${project.version}-sources.${archiveExtension.getOrElse("jar")}")
from(sourceSets["main"].allSource)
configure<PublishingExtension> {
publications {
register<MavenPublication>("maven") {
from(javaComponent)
group = "com.fastasyncworldedit"
artifactId = "${rootProject.name}-${project.description}"
version = version
pom {
name.set("${rootProject.name}-${project.description}" + " " + project.version)
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
licenses {
license {
name.set("GNU General Public License, Version 3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
distribution.set("repo")
}
}
developers {
developer {
id.set("NotMyFault")
name.set("NotMyFault")
email.set("contact@notmyfault.dev")
organization.set("IntellectualSites")
}
developer {
id.set("SirYwell")
name.set("Hannes Greule")
organization.set("IntellectualSites")
}
developer {
id.set("dordsor21")
name.set("dordsor21")
organization.set("IntellectualSites")
}
}
scm {
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/FastAsyncWorldEdit.git")
developerConnection.set("scm:git://github.com/IntellectualSites/FastAsyncWorldEdit.git")
}
issueManagement{
system.set("GitHub")
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
}
}
}
}
artifacts {
add("archives", tasks.named("sourcesJar"))
}
tasks.named("assemble").configure {
dependsOn("sourcesJar")
repositories {
mavenLocal()
val nexusUsername: String? by project
val nexusPassword: String? by project
if (nexusUsername != null && nexusPassword != null) {
maven {
val releasesRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
/* Commenting this out for now - Fawe currently does not user semver or any sort of versioning that
differentiates between snapshots and releases, API & (past) deployment wise, this will come with a next major release.
url = uri(
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
else releasesRepositoryUrl
)
*/
url = uri(releasesRepositoryUrl)
credentials {
username = nexusUsername
password = nexusPassword
}
}
} else {
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
}
}
}

View File

@ -1,4 +1,4 @@
group=com.sk89q.worldedit
group=com.fastasyncworldedit
org.gradle.jvmargs=-Xmx1512M
org.gradle.daemon=true