-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Imperative Configuration V2 #200
base: main
Are you sure you want to change the base?
Conversation
Last commit published: 2c44516430ba30984829c5d72c5764881a453094. 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 #200' // https://github.com/neoforged/ModDevGradle/pull/200
url 'https://prmaven.neoforged.net/ModDevGradle/pr200'
content {
includeModule('net.neoforged.moddev.legacyforge', 'net.neoforged.moddev.legacyforge.gradle.plugin')
includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin')
includeModule('net.neoforged', 'moddev-gradle')
includeModule('net.neoforged.moddev.repositories', 'net.neoforged.moddev.repositories.gradle.plugin')
}
}
} |
@shartte, this pull request has conflicts, please resolve them for this PR to move forward. |
aa22bc9
to
2ecd9d7
Compare
2ecd9d7
to
f8ff404
Compare
src/main/java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java
Outdated
Show resolved
Hide resolved
src/legacy/java/net/neoforged/moddevgradle/legacyforge/dsl/LegacyForgeExtension.java
Show resolved
Hide resolved
src/legacy/java/net/neoforged/moddevgradle/legacyforge/dsl/LegacyForgeModdingSettings.java
Show resolved
Hide resolved
src/legacy/java/net/neoforged/moddevgradle/legacyforge/dsl/ObfuscationExtension.java
Outdated
Show resolved
Hide resolved
* Contains the list of source sets for which access to Minecraft classes should be configured. | ||
* Defaults to the main source set, but can also be set to an empty list. | ||
*/ | ||
public abstract ListProperty<SourceSet> getEnabledSourceSets(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not put this in a common settings class?
src/main/java/net/neoforged/moddevgradle/internal/DataFileCollectionFactory.java
Outdated
Show resolved
Hide resolved
…uscationExtension.java Co-authored-by: Matyrobbrt <[email protected]>
try { | ||
toolchainSpec.getLanguageVersion().convention(JavaLanguageVersion.of(versionCapabilities.javaVersion())); | ||
} catch (IllegalStateException e) { | ||
// We tried our best |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could error like this?
// We tried our best | ||
} | ||
|
||
// Add a filtered parchment repository automatically if enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh? We're pulling Parchment from our mirror.
task.getParchmentData().from(parchmentData); | ||
task.getParchmentEnabled().set(parchment.getEnabled()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of these enabled booleans, can we not simply check if the artifact has been configured?
task.getParchmentConflictResolutionPrefix().set(parchment.getConflictResolutionPrefix()); | ||
|
||
Function<WorkflowArtifact, Provider<RegularFile>> artifactPathStrategy = artifact -> | ||
modDevBuildDir.map(dir -> dir.dir("artifacts").file(artifactNamingStrategy.getFilename(artifact))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull the artifacts dir outside of the lambda.
/** | ||
* Collects all dependencies needed by the NeoFormRuntime | ||
*/ | ||
private static List<Configuration> configureArtifactManifestConfigurations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pedantic but put this method immediately after create
.
} | ||
|
||
public Provider<RegularFile> requestAdditionalMinecraftArtifact(String id, String filename) { | ||
return requestAdditionalMinecraftArtifact(id, modDevBuildDir.map(dir -> dir.file(filename))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be in the artifacts dir? Or maybe another dir? Putting everything in the same dir is a bit annoying.
spec.getDependencies().add(runTypesConfigDependency); | ||
}); | ||
} else { | ||
// Create an implicit configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? The configuration is null.
Consumer<Configuration> configureModulePath, | ||
Consumer<Configuration> configureLegacyClasspath, | ||
Provider<RegularFile> assetPropertiesFile, | ||
Provider<VersionCapabilities> versionCapabilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a provider if it is always known ahead of time? In NeoDev you can supply null.
|
||
// FML searches for client resources on the legacy classpath | ||
private void addClientResources(Project project, Configuration spec, TaskProvider<CreateMinecraftArtifacts> createArtifacts) { | ||
// FML searches for client resources on the legacy classpath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated comment
} | ||
|
||
for (var target : testSuite.getTargets()) { | ||
setupTestTask( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current state of setupTestTask
definitely does not support multiple test tasks and will fail miserably trying to configure more than one test task, we should change that or have a nicer error message.
/** | ||
* Used to customize the groups of tasks generated by MDG. | ||
* | ||
* @param publicTaskGroup Use this group for tasks that are considered to be part of the user-interface of MDG. | ||
* @param internalTaskGroup Use this group for tasks that are considered to be an implementation detail of MDG. | ||
*/ | ||
record Branding(String publicTaskGroup, String internalTaskGroup) { | ||
@ApiStatus.Internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant since the package is already internal
src/main/java/net/neoforged/moddevgradle/internal/ModDevExtension.java
Outdated
Show resolved
Hide resolved
|
||
/** | ||
* This is the top-level {@code neoForge} extension, used to configure the moddev plugin. | ||
*/ | ||
public abstract class NeoForgeExtension { | ||
public abstract class NeoForgeExtension extends ModDevExtension { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced that splitting the extension in two is necessary or useful, when the only difference is changing some field from neoForgeVersion
to forgeVersion
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(My main annoyance is how messy the diff of this PR gets).
@@ -28,7 +28,7 @@ public void testApplyInEmptyProject() throws IOException { | |||
.withArguments("tasks", "--all") | |||
.build(); | |||
|
|||
assertThat(result.getOutput()).contains("createMinecraftArtifacts"); | |||
assertThat(result.getOutput()).doesNotContain("createMinecraftArtifacts"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what?
@@ -29,7 +29,7 @@ public void testApplyInEmptyProject() throws IOException { | |||
.withArguments("tasks", "--all") | |||
.build(); | |||
|
|||
assertThat(result.getOutput()).contains("createMinecraftArtifacts"); | |||
assertThat(result.getOutput()).doesNotContain("createMinecraftArtifacts"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what?
@@ -94,7 +94,7 @@ public static TaskProvider<JarJar> registerWithConfiguration(Project project, St | |||
// jvm version. We could copy DefaultJvmFeature, and search for the target version of the compile task, | |||
// but this is difficult - we only have a feature name, not the linked source set. For this reason, we use | |||
// the toolchain version, which is the most likely to be correct. | |||
attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, javaPlugin.getToolchain().getLanguageVersion().map(JavaLanguageVersion::asInt)); | |||
attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, javaPlugin.getToolchain().getLanguageVersion().orElse(JavaLanguageVersion.current()).map(JavaLanguageVersion::asInt)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
*/ | ||
public void setVersion(Object version) { | ||
enableModding(settings -> { | ||
settings.setForgeVersion(version.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString
?
.extendsFrom(configurations.getByName(ModDevPlugin.CONFIGURATION_COMPILE_DEPENDENCIES)); | ||
public void setVersion(Object version) { | ||
enableModding(settings -> { | ||
settings.setNeoForgeVersion(version.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString
?
@shartte, this pull request has conflicts, please resolve them for this PR to move forward. |
No description provided.