Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ plugins {
id 'maven-publish' // for jitpack.io
}

String group = System.getenv("GROUP") ?: properties["group"] ?: "com.github.server-utilities"
String commitHash = "";

if (System.getenv("JITPACK") != "true") {
rootProject.group = group
rootProject.version = properties["version"] + "." + commitHash
}
group = 'com.github.server-utilities'
version = '1.0.0'

repositories {
mavenCentral()
Expand Down Expand Up @@ -74,10 +69,6 @@ shadowJar {
archiveFileName = project.name + '-' + project.version + '.jar'
}

artifacts {
archives shadowJar
}

tasks.register('deploy', Copy) {
// Define the deployment directory
def deployDir = file(System.getenv("DEPLOY_DIR") ?: "$rootDir/deploy")
Expand All @@ -89,31 +80,32 @@ tasks.register('deploy', Copy) {
println "Generated JAR file: ${shadowJar.archiveFile}"
}

// Copy the generated jar(s) to the deploy directory
// Copy the shadowJar output
from shadowJar.archiveFile
into deployDir
}

// Ensure that the copyToDeployDir task runs after the shadowJar task
// Ensure that the deploy task runs after the shadowJar task
shadowJar.finalizedBy(deploy)

tasks.named('deploy').configure {
dependsOn shadowJar
dependsOn jar
dependsOn 'shadowJar', 'sourcesJar', 'javadocJar', 'jar'
}

tasks.register('getGitCommitHash') {
doLast {
def ch = 'git rev-parse --short HEAD'.execute().text.trim()
commitHash = ch
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

tasks.named("build").configure {
dependsOn getGitCommitHash
java {
withSourcesJar()
withJavadocJar()
}

wrapper {
gradleVersion = '8.9'
distributionType = Wrapper.DistributionType.BIN
}
}
5 changes: 0 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
String artifact = System.getenv('ARTIFACT') ?: properties['name'] ?: rootProject.name

if (System.getenv("JITPACK") != "true") {
rootProject.name = artifact
}
Loading