-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix Forge 50 (1.20.6) #219
Changes from all commits
7b2ba5b
161916a
68ed434
642316c
d1cccf3
8bd02d7
527059d
10e8977
4b879a6
619cd80
d7dd1cf
de5de04
df92085
1a621d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,14 @@ public static String intermediary(Project project) { | |
return intermediaryNamespace(project).toString(); | ||
} | ||
|
||
/** | ||
* Returns the runtime intermediary namespace of the project. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this also applies in dev runtime I believe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't dev runtime |
||
* This is the namespace used in the compiled jar. | ||
*/ | ||
public static String runtimeIntermediary(Project project) { | ||
return runtimeIntermediaryNamespace(project).toString(); | ||
} | ||
|
||
/** | ||
* Returns the intermediary namespace of the project. | ||
*/ | ||
|
@@ -49,6 +57,15 @@ public static MappingsNamespace intermediaryNamespace(Project project) { | |
}; | ||
} | ||
|
||
/** | ||
* Returns the intermediary namespace of the project. | ||
*/ | ||
public static MappingsNamespace runtimeIntermediaryNamespace(Project project) { | ||
LoomGradleExtension extension = LoomGradleExtension.get(project); | ||
if (extension.isForge() && extension.getForgeProvider().usesMojangAtRuntime()) return MappingsNamespace.MOJANG; | ||
return intermediaryNamespace(project); | ||
} | ||
|
||
/** | ||
* Potentially replaces the remapping target namespace for mixin refmaps. | ||
* | ||
|
@@ -62,6 +79,6 @@ public static MappingsNamespace intermediaryNamespace(Project project) { | |
* @return the correct namespace to use | ||
*/ | ||
public static String replaceMixinIntermediaryNamespace(Project project, String namespace) { | ||
return namespace.equals(intermediary(project)) ? MappingsNamespace.INTERMEDIARY.toString() : namespace; | ||
return namespace.equals(runtimeIntermediary(project)) ? MappingsNamespace.INTERMEDIARY.toString() : namespace; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,10 @@ public abstract class MixinExtensionApiImpl implements MixinExtensionAPI { | |
public MixinExtensionApiImpl(Project project) { | ||
this.project = Objects.requireNonNull(project); | ||
this.useMixinAp = project.getObjects().property(Boolean.class) | ||
.convention(project.provider(() -> !LoomGradleExtension.get(project).isNeoForge())); | ||
.convention(project.provider(() -> !LoomGradleExtension.get(project).isNeoForge() && (!LoomGradleExtension.get(project).isForge() || !LoomGradleExtension.get(project).getForgeProvider().usesMojangAtRuntime()))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic here is a bit ugly, it could be better for readability to use a block lambda. @shedaniel Do you remember if there's any reason why we have this set to false for Fabric? Upstream 1.6 has it on true: https://github.com/FabricMC/fabric-loom/blob/c4d36fac4ea7ccd1ef9526aa138139a154c8f581/src/main/java/net/fabricmc/loom/extension/MixinExtensionApiImpl.java#L51-L52 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe old forge mods should have this as false There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's fine. I think we could change it for Fabric if it didn't break common projects not getting refmaps on old Forge (arch plugin could set it to true?) |
||
|
||
this.refmapTargetNamespace = project.getObjects().property(String.class) | ||
.convention(project.provider(() -> IntermediaryNamespaces.intermediary(project))); | ||
.convention(project.provider(() -> IntermediaryNamespaces.runtimeIntermediary(project))); | ||
this.refmapTargetNamespace.finalizeValueOnRead(); | ||
|
||
this.messages = project.getObjects().mapProperty(String.class, String.class); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* This file is part of fabric-loom, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) 2024 FabricMC | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package net.fabricmc.loom.test.integration.forge | ||
|
||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
import net.fabricmc.loom.test.util.GradleProjectTestTrait | ||
|
||
import static net.fabricmc.loom.test.LoomTestConstants.DEFAULT_GRADLE | ||
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS | ||
|
||
class Forge1206Test extends Specification implements GradleProjectTestTrait { | ||
@Unroll | ||
def "build #mcVersion #neoforgeVersion #mappings #patches"() { | ||
if (Integer.valueOf(System.getProperty("java.version").split("\\.")[0]) < 21) { | ||
println("This test requires Java 21. Currently you have Java ${System.getProperty("java.version")}.") | ||
return | ||
} | ||
|
||
setup: | ||
def gradle = gradleProject(project: "forge/1206", version: DEFAULT_GRADLE) | ||
gradle.buildGradle.text = gradle.buildGradle.text.replace('@MCVERSION@', mcVersion) | ||
.replace('@FORGEVERSION@', neoforgeVersion) | ||
.replace('MAPPINGS', mappings) // Spotless doesn't like the @'s | ||
.replace('PATCHES', patches) | ||
|
||
when: | ||
def result = gradle.run(task: "build") | ||
|
||
then: | ||
result.task(":build").outcome == SUCCESS | ||
|
||
where: | ||
mcVersion | neoforgeVersion | mappings | patches | ||
'1.20.6' | '1.20.6-50.1.3' | 'loom.officialMojangMappings()' | '' | ||
} | ||
} |
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.
Note (mostly for myself): this can be removed in 1.7 since the Fabric API test requires it