Skip to content

Commit

Permalink
Add shadow jar support
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Nov 28, 2023
1 parent b9dfedd commit 4dfc67a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ jobs:

- name: Execute Gradle build
run: ./gradlew build

- name: Build shadowJar
run: ./gradlew shadowJar

- name: Upload shadowJar
uses: actions/upload-artifact@v3
with:
name: stealing-artefacts-shadow
path: build/libs/*-all.jar
25 changes: 25 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,29 @@ tasks.withType<JavaCompile> {

tasks.test {
useJUnitPlatform()
}

tasks.register(name = "shadowJar", type = Jar::class) {
dependsOn(configurations.testRuntimeClasspath)
manifest {
attributes(mapOf("Main-Class" to "io.cbitler.stealingartefacts.StealingArtefactsPluginTest"))
}

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.get().output)
from(sourceSets.test.get().output)
from({
configurations.testRuntimeClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
}
})
exclude("META-INF/INDEX.LIST")
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
exclude("**/module-info.class")

group = BasePlugin.BUILD_GROUP
archiveClassifier.set("shadow")
archiveFileName.set(rootProject.name + "-" + project.version + "-all.jar")
}

0 comments on commit 4dfc67a

Please sign in to comment.