mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Deprecate Forge data generation API (#117)
* Deprecate RunConfigSettings.data() * Leave RCS.data() intact, only apply hardcoded game args if old api is used
This commit is contained in:
@@ -110,20 +110,29 @@ public interface ForgeExtensionAPI {
|
||||
* {@link #dataGen(Action)}.
|
||||
*
|
||||
* @return the list
|
||||
* @deprecated Removed in favor of configuring the data generator directly.
|
||||
*/
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
@Deprecated(forRemoval = true)
|
||||
List<String> getDataGenMods();
|
||||
|
||||
/**
|
||||
* Applies data generation settings.
|
||||
*
|
||||
* @param action the action to configure data generation
|
||||
* @deprecated Removed in favor of configuring the data generator directly.
|
||||
*/
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
@Deprecated(forRemoval = true)
|
||||
void dataGen(Action<DataGenConsumer> action);
|
||||
|
||||
/**
|
||||
* Data generation config.
|
||||
* @deprecated Removed in favor of configuring the data generator directly.
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
@Deprecated(forRemoval = true)
|
||||
interface DataGenConsumer {
|
||||
/**
|
||||
* Adds mod IDs applied for data generation.
|
||||
|
||||
@@ -325,15 +325,14 @@ public final class RunConfigSettings implements Named {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure run config with the default server options.
|
||||
* Configure run config with the default data options.
|
||||
*
|
||||
* <p>This method can only be used on Forge.
|
||||
*/
|
||||
public void data() {
|
||||
ModPlatform.assertPlatform(getExtension(), ModPlatform.FORGE, () -> "RunConfigSettings.data() is only usable on Forge.");
|
||||
environment("data");
|
||||
defaultMainClass(Constants.Knot.KNOT_SERVER);
|
||||
|
||||
if (getExtension().isForge()) {
|
||||
forgeTemplate("data");
|
||||
}
|
||||
forgeTemplate("data");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,14 +112,20 @@ public abstract class GenerateDLIConfigTask extends AbstractLoomTask {
|
||||
.property("fabric.yarnWithSrg.path", getExtension().getMappingConfiguration().tinyMappingsWithSrg.toAbsolutePath().toString())
|
||||
.property("unprotect.mappings", unprotectMappings)
|
||||
|
||||
.argument("data", "--all")
|
||||
.argument("data", "--mod")
|
||||
.argument("data", String.join(",", getExtension().getForge().getDataGenMods()))
|
||||
.argument("data", "--output")
|
||||
.argument("data", getProject().file("src/generated/resources").getAbsolutePath())
|
||||
|
||||
.property("mixin.env.remapRefMap", "true");
|
||||
|
||||
final List<String> dataGenMods = getExtension().getForge().getDataGenMods();
|
||||
|
||||
// Only apply the hardcoded data arguments if the deprecated data generator API is being used.
|
||||
if (!dataGenMods.isEmpty()) {
|
||||
launchConfig
|
||||
.argument("data", "--all")
|
||||
.argument("data", "--mod")
|
||||
.argument("data", String.join(",", getExtension().getForge().getDataGenMods()))
|
||||
.argument("data", "--output")
|
||||
.argument("data", getProject().file("src/generated/resources").getAbsolutePath());
|
||||
}
|
||||
|
||||
if (PropertyUtil.getAndFinalize(getExtension().getForge().getUseCustomMixin())) {
|
||||
launchConfig.property("mixin.forgeloom.inject.mappings.srg-named", getExtension().getMappingConfiguration().getReplacedTarget(getExtension(), "srg").toAbsolutePath().toString());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user