neoforged / ModDevGradle

A Gradle plugin for developing Minecraft mods using NeoForge
https://projects.neoforged.net/neoforged/moddevgradle
GNU Lesser General Public License v2.1
25 stars 6 forks source link

Improve source set support #17

Closed shartte closed 2 months ago

shartte commented 2 months ago

Allow the modding depedencies to be added to source sets that do not extend from the main source set. Also allow setting of the primary source set for runs, which also translates into that source set being set as the IntelliJ classpath module for that run.

Isolated Source Sets

If you work with source sets that do not extend from main, and would like the modding dependencies to be available in those source sets, you can use the following api:

sourceSets {
  anotherSourceSet // example
}
neoForge {
  // ...
  addModdingDependenciesTo(sourceSets.anotherSourceSet)

  mods {
    mymod {
      sourceSet sourceSets.main
      // Do not forget to add additional soruce-sets here!
      sourceSet sourceSets.anotherSourceSet
    }
  }
}
dependencies {
  implementation sourceSets.anotherSourceSet.output
}
neoforged-pr-publishing[bot] commented 2 months ago

Last commit published: 8583e166b1d303d71c812ca13daa5631c68db922.

PR Publishing ### The artifacts published by this PR: - :package: [`net.neoforged:moddev-gradle:0.1.83-pr-17-better-source-set-support`](https://github.com/neoforged/ModDevGradle/packages/2178108) - :package: [`net.neoforged.moddev:net.neoforged.moddev.gradle.plugin:0.1.83-pr-17-better-source-set-support`](https://github.com/neoforged/ModDevGradle/packages/2178109) ### Repository Declaration In order to use the artifacts published by the PR, add the following repository to your buildscript: ```gradle repositories { maven { name 'Maven for PR #17' // https://github.com/neoforged/ModDevGradle/pull/17 url 'https://prmaven.neoforged.net/ModDevGradle/pr17' content { includeModule('net.neoforged', 'moddev-gradle') includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin') } } } ```