MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
521 stars 444 forks source link

Server and client tweaker replacements don't seem to get set #263

Closed stephan-gh closed 9 years ago

stephan-gh commented 9 years ago

Apparently ForgeGradle doesn't set {RUN_SERVER_TWEAKER} and {RUN_CLIENT_TWEAKER} replacements anywhere in the code, which results in the start dependency getting generated with an empty tweak class, no matter what's defined in the build file:

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

import com.google.common.base.Strings;
import java.util.List;
import java.util.Map;
import net.minecraftforge.gradle.GradleStartCommon;

public class GradleStartServer extends GradleStartCommon {
    public GradleStartServer() {
    }

    public static void main(String[] var0) throws Throwable {
        (new GradleStartServer()).launch(var0);
    }

    protected String getTweakClass() {
        return "";
    }

    protected String getBounceClass() {
        String var1 = "net.minecraft.server.MinecraftServer";
        return Strings.isNullOrEmpty(var1)?"net.minecraft.server.MinecraftServer":var1;
    }

    protected void preLaunch(Map<String, String> var1, List<String> var2) {
    }

    protected void setDefaultArguments(Map<String, String> var1) {
    }
}
AbrarSyed commented 9 years ago

This is by design. You should specify your tweaker as a CLI arg in your run configs. IIRC fg generates the run configs correctly with the --tweakclass argument.

This is because the twrakclass is likely to change, and I dont want such a change to require a full rebuild of the gradle start.

stephan-gh commented 9 years ago

I don't think FG generates any run configurations for IDEA when importing using the inbuilt Gradle support (which should normally always be preferred) so this is kind of a problem because you always need to add it manually, including the tweak class and everything, as well as keeping it up to date there, in the build file etc etc. One place where the tweak class is defined would make things much easier.

AbrarSyed commented 9 years ago

That's why the gebIntellijRuns task exists. It was design to be triggered after a an intellij import.

stephan-gh commented 9 years ago

Couldn't that be run by the setupWorkspace tasks then? I don't think anyone runs that task manually.

AbrarSyed commented 9 years ago

Its because that task modifies existing intellij files. It doesn't create them. If you want to create the files, run the idea task, which has been modified by me to add the run configs. Unfortunately I have no control over what idea does for its import, or I would inject the run configs right there.