Refactor build scripts and Jenkinsfile
This commit is contained in:
parent
0d31d85fd4
commit
de03444bc6
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
|
|
@ -11,19 +11,20 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish to Maven') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'alttd-publish-user', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh '''
|
||||
chmod +x gradlew
|
||||
./gradlew publish -PalttdDevPublishUser=$USERNAME -PalttdDevPublishPass=$PASSWORD
|
||||
./gradlew :api:publish -PalttdDevPublishUser=$USERNAME -PalttdDevPublishPass=$PASSWORD
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'build/libs/', followSymlinks: false
|
||||
archiveArtifacts artifacts: 'plugin/build/libs/DataLockLib*.jar, api/build/libs/DataLockLibApi*.jar', followSymlinks: false
|
||||
}
|
||||
}
|
||||
stage('discord') {
|
||||
|
|
@ -38,4 +39,3 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,17 @@
|
|||
plugins {
|
||||
`maven-publish`
|
||||
id("java-library")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
enabled = true
|
||||
}
|
||||
// Configure API-specific settings
|
||||
base {
|
||||
archivesName.set("DataLockLibApi")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
artifactId = "api"
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
|
@ -24,8 +21,8 @@ publishing {
|
|||
name = "nexus"
|
||||
url = uri("https://repo.alttd.com/repository/alttd-snapshot/")
|
||||
credentials {
|
||||
username = project.property("alttdDevPublishUser") as String
|
||||
password = project.property("alttdDevPublishPass") as String
|
||||
username = project.findProperty("alttdDevPublishUser")?.toString()
|
||||
password = project.findProperty("alttdDevPublishPass")?.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
|
@ -10,41 +10,21 @@ allprojects {
|
|||
}
|
||||
|
||||
subprojects {
|
||||
apply<JavaLibraryPlugin>()
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "java-library")
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
repositories{
|
||||
maven {
|
||||
name = "nexus"
|
||||
url = uri("https://repo.alttd.com/repository/alttd-snapshot/")
|
||||
credentials {
|
||||
username = project.property("alttdDevPublishUser") as String
|
||||
password = project.property("alttdDevPublishPass") as String
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
from(sourceSets.main.get().output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,56 +1,23 @@
|
|||
import java.io.ByteArrayOutputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.net.URL
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
|
||||
id("xyz.jpenilla.run-paper") version "1.0.6"
|
||||
id("java-library")
|
||||
id("net.minecrell.plugin-yml.bukkit") version "0.6.0" // Plugin for generating plugin.yml
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":api")) // API
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
jar {
|
||||
enabled = true
|
||||
implementation(project(":api"))
|
||||
}
|
||||
|
||||
// Plugin-specific configurations
|
||||
base {
|
||||
archivesName.set("DataLockLib")
|
||||
}
|
||||
|
||||
// Bukkit plugin configuration
|
||||
bukkit {
|
||||
name = rootProject.name
|
||||
main = "$group.${rootProject.name}"
|
||||
version = gitCommit()
|
||||
main = "${project.group}.${rootProject.name}"
|
||||
apiVersion = "1.21"
|
||||
authors = listOf("Teriuihi")
|
||||
}
|
||||
|
||||
fun gitCommit(): String {
|
||||
val os = ByteArrayOutputStream()
|
||||
project.exec {
|
||||
isIgnoreExitValue = true
|
||||
commandLine = "git rev-parse --short HEAD".split(" ")
|
||||
standardOutput = os
|
||||
}
|
||||
return String(os.toByteArray()).trim()
|
||||
}
|
||||
|
||||
fun download(link: String, path: File) {
|
||||
URL(link).openStream().use { input ->
|
||||
FileOutputStream(path).use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bukkit {
|
||||
name = rootProject.name
|
||||
main = "$group.${rootProject.name}"
|
||||
version = gitCommit()
|
||||
apiVersion = "1.21"
|
||||
authors = listOf("akastijn")
|
||||
description = project.description
|
||||
version = project.version.toString()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
rootProject.name = "DataLockLib"
|
||||
|
||||
val nexusUser = providers.gradleProperty("alttdDevPublishUser").get()
|
||||
val nexusPass = providers.gradleProperty("alttdDevPublishPass").get()
|
||||
|
||||
include(":api")
|
||||
include(":plugin")
|
||||
|
||||
|
|
@ -20,5 +17,9 @@ dependencyResolutionManagement {
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = "papermc"
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user