Skip to content

Commit

Permalink
fix: Add support for shadow maintained fork
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Jun 20, 2024
1 parent 65f85e4 commit 7585000
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "com.xpdustry"
version = "4.0.1" + if (indraGit.headTag() == null) "-SNAPSHOT" else ""
version = "4.0.2" + if (indraGit.headTag() == null) "-SNAPSHOT" else ""
description = "Gradle plugin for building and testing mindustry mods/plugins."

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.hasPlugin
import org.gradle.kotlin.dsl.named

private const val SHADOW_PLUGIN_ID = "com.github.johnrengelman.shadow"
private const val SHADOW_JAR_TASK_NAME = "shadowJar"

internal inline val Project.toxopid: ToxopidExtension
get() =
extensions.findByName(Toxopid.EXTENSION_NAME) as ToxopidExtension?
?: extensions.create(ToxopidExtension::class, Toxopid.EXTENSION_NAME, ToxopidExtensionImpl::class)

internal fun Project.getJarTask(): TaskProvider<out Jar> =
if (plugins.hasPlugin(SHADOW_PLUGIN_ID)) {
tasks.named<Jar>(SHADOW_JAR_TASK_NAME)
if (plugins.hasPlugin("com.github.johnrengelman.shadow") || plugins.hasPlugin("io.github.goooler.shadow")) {
tasks.named<Jar>("shadowJar")
} else if (plugins.hasPlugin(JavaPlugin::class)) {
tasks.named<Jar>(JavaPlugin.JAR_TASK_NAME)
} else {
Expand Down

0 comments on commit 7585000

Please sign in to comment.