-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Conventions subsystem #170
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last commit published: 3e9c63a900233e7ce9367ed749e9a6a3c4d6fdaf. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #170' // https://github.com/neoforged/NeoGradle/pull/170
url 'https://prmaven.neoforged.net/NeoGradle/pr170'
content {
includeModule('net.neoforged.gradle', 'common')
includeModule('net.neoforged.gradle', 'neoform')
includeModule('net.neoforged.gradle', 'dsl-neoform')
includeModule('net.neoforged.gradle.common', 'net.neoforged.gradle.common.gradle.plugin')
includeModule('net.neoforged.gradle.userdev', 'net.neoforged.gradle.userdev.gradle.plugin')
includeModule('net.neoforged.gradle', 'dsl-common')
includeModule('net.neoforged.gradle.neoform', 'net.neoforged.gradle.neoform.gradle.plugin')
includeModule('net.neoforged.gradle', 'platform')
includeModule('net.neoforged.gradle', 'dsl-vanilla')
includeModule('net.neoforged.gradle', 'dsl-platform')
includeModule('net.neoforged.gradle.platform', 'net.neoforged.gradle.platform.gradle.plugin')
includeModule('net.neoforged.gradle', 'dsl-mixin')
includeModule('net.neoforged.gradle.vanilla', 'net.neoforged.gradle.vanilla.gradle.plugin')
includeModule('net.neoforged.gradle.mixin', 'net.neoforged.gradle.mixin.gradle.plugin')
includeModule('net.neoforged.gradle', 'userdev')
includeModule('net.neoforged.gradle', 'mixin')
includeModule('net.neoforged.gradle', 'vanilla')
includeModule('net.neoforged.gradle', 'utils')
includeModule('net.neoforged.gradle', 'dsl-userdev')
}
}
} |
shartte
reviewed
May 14, 2024
shartte
reviewed
May 14, 2024
dsl/common/src/main/groovy/net/neoforged/gradle/dsl/common/runs/run/DependencyHandler.groovy
Outdated
Show resolved
Hide resolved
shartte
reviewed
May 14, 2024
...rc/main/groovy/net/neoforged/gradle/dsl/common/extensions/subsystems/conventions/Runs.groovy
Show resolved
Hide resolved
shartte
approved these changes
May 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
This new subsystem (allthough only partially configurable via DSL), allows the management of NeoForge resources via conventions over configurations, runs and sourcesets.
The buildscript as such can be shorted to the following:
Obviously the version for neoforge can still be hand set.
This shorter variant will configure the same setup, including runs, configurations and all setup as usual. A reference to the neoforge implementation is still needed.
Conventions
Within the gradle community there is a heavy emphasis on conventions, configurations are named in certain patterns, source sets trigger the creation of configurations, and main exists always, etc.
NeoGradle followed some of these, but not others. The goal of this PR is to follow these more, specifically when it comes to configurations, runs, and sourcesets.
This entire new subsystem is configurable like any other via the gradle properties, or the DSL.
Warning
Some properties of the new subsystem are only configurable via the gradle properties, as they are read as soon as the project is applied, others can be modified later, or when they are modified later, then the new value with only effect configurations, runs or sourcesets from the moment that it was set.
Configurations:
Per source set we now create the following configurations, using test as an example the name for the main sourceset can be found in brackets:
Per run we now also create the following configurations, using client as an example:
Globally we now also create 2 configurations:
Sourceset management:
We now add the main sourceset to any run in the project by default.
Additionally if you add a sourceset to the mod sources of a run, its localRunRuntime (so for example testLocalRunRuntime for test) configuration is also added to the runs runtime.
Note
We currently do not offer a sourceset scoped mod configuration, but if the community requests one, we can trivially add it
Run management:
Automatic creation of runs based on available run types.
Most modders run with exactly one version of neoforge (either in one or more sourcesets), and they create all available runs; client, server, datagen, and gameTestServer. So this convention configures the runs accordingly, automatically creating a run based on the given run type found. If you run with multiple different NeoForge versions in different sourcesets, please dissable this convention via gradle.properties to prevent issues.
Note
If you are effected by this, let us know so that we can gauge the community use and interest of the multi-neoforge version feature and possibly improve compatibilty.
IDE Integrations:
This PR only offers conventions for the IDEA plugin:
We now automatically detect if you are running NeoGradle in an IDEA instance with "Compile with IDEA" enabled. If this is the case different output paths are emitted.
We also now offer a direct convention property to set the output directory of the compiler. By default this is
out
. We do not yet automatically detect this from your configuration.Properties
If you want to disable any of these functionalities, please see the new
readme.md
entries for them, or visit the NeoGradle documentation, once it is added there.Other changes: