Skip to content

Commit

Permalink
fix primary source set for run config
Browse files Browse the repository at this point in the history
  • Loading branch information
Minecraftschurli committed Mar 8, 2024
1 parent d9422d2 commit bcc8086
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

group = "com.github.minecraftschurlimods"
version = "1.7"
version = "1.8"
base.archivesName = "HelperPlugin"

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand All @@ -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() {
Expand Down Expand Up @@ -298,10 +301,8 @@ open class HelperExtension @Inject constructor(private val project: Project) {
}

fun withGameTestRuns(cfg: Action<Run> = Action<Run>{}) {
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,3 +54,4 @@ operator fun JavaPluginExtension.invoke(action: Action<JavaPluginExtension>) = a
operator fun PublishingExtension.invoke(action: Action<PublishingExtension>) = action.execute(this)

val NamedDomainObjectProvider<ModDependency>.version: Provider<String> get() = flatMap { it.version }
val Run.idea:IdeaRunExtension get() = the<IdeaRunExtension>()

0 comments on commit bcc8086

Please sign in to comment.