Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* ForgeGradle
* Copyright (C) 2018 Forge Development LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
package net.minecraftforge.gradle.common.util;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSet;
import groovy.lang.Closure;
import groovy.lang.GroovyObjectSupport;
import groovy.util.MapEntry;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
public class RunConfig extends GroovyObjectSupport implements Serializable {
public static final String RUNS_GROUP = "ForgeGradle runs";
private static final String MCP_CLIENT_MAIN = "mcp.client.Start";
private static final String MC_CLIENT_MAIN = "net.minecraft.client.main.Main";
private static final long serialVersionUID = 1L;
private transient final Project project;
private transient NamedDomainObjectContainer mods;
private final String name;
private Boolean singleInstance = null;
private String taskName, main, ideaModule, workDir;
private List sources;
private List parents, children;
private List args, jvmArgs;
private boolean forceExit = true;
private Boolean client; // so we can have it null
private Boolean inheritArgs;
private Boolean inheritJvmArgs;
private Map env, props, tokens;
private Map> lazyTokens;
public RunConfig(final Project project, final String name) {
this.project = project;
this.name = name;
this.mods = project.container(ModConfig.class, modName -> new ModConfig(project, modName));
}
public final String getName() {
return name;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public void taskName(String taskName) {
setTaskName(taskName);
}
public final String getTaskName() {
if (taskName == null) {
taskName = getName().replaceAll("[^a-zA-Z0-9\\-_]", "");
if (!taskName.startsWith("run")) {
taskName = "run" + Utils.capitalize(taskName);
}
}
return taskName;
}
public final String getUniqueFileName() {
return project.getPath().length() > 1 ? String.join("_", String.join("_", project.getPath().substring(1).split(":")), getTaskName()) : getTaskName();
}
public final String getUniqueName() {
return getUniqueFileName().replaceAll("_", " ");
}
public void environment(Map map) {
this.setEnvironment(map);
}
public void setEnvironment(Map map) {
map.forEach((k, v) -> getEnvironment().put(k, v instanceof File ? ((File) v).getAbsolutePath() : (String) v));
}
public void environment(String key, String value) {
getEnvironment().put(key, value);
}
public void environment(String key, File value) {
getEnvironment().put(key, value.getAbsolutePath());
}
public Map getEnvironment() {
if (env == null) {
env = new HashMap<>();
}
return env;
}
public void main(String value) {
this.setMain(value);
}
public void setMain(String value) {
this.main = value;
}
public String getMain() {
return this.main;
}
public void inheritArgs(boolean value) {
setInheritArgs(value);
}
public void setInheritArgs(boolean value) {
this.inheritArgs = value;
}
public boolean getInheritArgs() {
// Both null and true mean inherit the args
return inheritArgs != Boolean.FALSE;
}
public void inheritJvmArgs(boolean value) {
setInheritJvmArgs(value);
}
public void setInheritJvmArgs(boolean value) {
this.inheritJvmArgs = value;
}
public boolean getInheritJvmArgs() {
// Both null and true mean inherit the args
return inheritJvmArgs != Boolean.FALSE;
}
public void args(List