diff --git a/build.gradle.kts b/build.gradle.kts index 20e1501..885aa74 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ repositories { } group = "com.github.minecraftschurlimods" -version = "1.7" +version = "1.8" base.archivesName = "HelperPlugin" dependencies { diff --git a/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/HelperExtension.kt b/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/HelperExtension.kt index 3fba21b..a4cd433 100644 --- a/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/HelperExtension.kt +++ b/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/HelperExtension.kt @@ -5,6 +5,7 @@ package com.github.minecraftschurlimods.helperplugin import com.github.minecraftschurlimods.helperplugin.moddependencies.ModDependency import com.github.minecraftschurlimods.helperplugin.moddependencies.ModDependencyContainer import net.neoforged.gradle.common.tasks.JarJar +import net.neoforged.gradle.dsl.common.runs.ide.extensions.IdeaRunExtension import net.neoforged.gradle.dsl.common.runs.run.Run import org.gradle.api.Action import org.gradle.api.Project @@ -237,10 +238,9 @@ open class HelperExtension @Inject constructor(private val project: Project) { testSourceSet.implementationConfigurationName(apiSourceSet.output) } } - project.runs.all { - if (name != "data") { - modSources.add(testSourceSet) - } + project.runs.matching { it.name != "data" }.all { + modSources.add(testSourceSet) + idea.primarySourceSet = testSourceSet } } @@ -255,7 +255,10 @@ open class HelperExtension @Inject constructor(private val project: Project) { dataGenSourceSet.implementationConfigurationName(apiSourceSet.output) } } - project.runs.findByName("data")?.modSources?.add(dataGenSourceSet) + project.runs.matching { it.name == "data" }.all { + modSources.add(dataGenSourceSet) + idea.primarySourceSet = dataGenSourceSet + } } fun withCommonRuns() { @@ -298,10 +301,8 @@ open class HelperExtension @Inject constructor(private val project: Project) { } fun withGameTestRuns(cfg: Action = Action{}) { - project.runs.all { - if (name != "data") { - systemProperties.put("neoforge.enabledGameTestNamespaces", projectId) - } + project.runs.matching { it.name != "data" }.all { + systemProperties.put("neoforge.enabledGameTestNamespaces", projectId) } project.runs.create("gameTestServer") { singleInstance() diff --git a/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/Util.kt b/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/Util.kt index 09011f8..e0e6b78 100644 --- a/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/Util.kt +++ b/src/main/kotlin/com/github/minecraftschurlimods/helperplugin/Util.kt @@ -2,6 +2,7 @@ package com.github.minecraftschurlimods.helperplugin import com.github.minecraftschurlimods.helperplugin.moddependencies.ModDependency import net.neoforged.gradle.common.extensions.JarJarExtension +import net.neoforged.gradle.dsl.common.runs.ide.extensions.IdeaRunExtension import net.neoforged.gradle.dsl.common.runs.run.Run import net.neoforged.gradle.util.TransformerUtils import org.gradle.api.Action @@ -53,3 +54,4 @@ operator fun JavaPluginExtension.invoke(action: Action) = a operator fun PublishingExtension.invoke(action: Action) = action.execute(this) val NamedDomainObjectProvider.version: Provider get() = flatMap { it.version } +val Run.idea:IdeaRunExtension get() = the()