inst.from(delayedFile(FORGE_LICENSE));
inst.from(delayedFile(FORGE_CREDITS));
inst.from(delayedFile(PAULSCODE_LISCENCE1));
inst.from(delayedFile(PAULSCODE_LISCENCE2));
inst.from(delayedFile(FORGE_LOGO));
inst.from(delayedZipTree(INSTALLER_BASE), new CopyInto("", "!*.json", "!*.png"));
inst.dependsOn("packageUniversal", "downloadBaseInstaller", "generateInstallJson");
inst.rename("forge_logo\\.png", "big_logo.png");
inst.setExtension("jar");
}
project.getArtifacts().add("archives", inst);
final Zip patchZipFML = makeTask("zipFmlPatches", Zip.class);
{
patchZipFML.from(delayedFile(FML_PATCH_DIR));
patchZipFML.setArchiveName("fmlpatches.zip");
patchZipFML.setDestinationDir(delayedFile("{BUILD_DIR}/tmp/").call());
}
final Zip patchZipForge = makeTask("zipForgePatches", Zip.class);
{
patchZipForge.from(delayedFile(FORGE_PATCH_DIR));
patchZipForge.setArchiveName("forgepatches.zip");
patchZipForge.setDestinationDir(delayedFile("{BUILD_DIR}/tmp/").call());
}
final Zip classZip = makeTask("jarClasses", Zip.class);
{
classZip.from(delayedZipTree(BINPATCH_TMP), new CopyInto("", "**/*.class"));
classZip.setArchiveName("binaries.jar");
classZip.setDestinationDir(delayedFile("{BUILD_DIR}/tmp/").call());
}
final File javadocSource = project.file(delayedFile("{BUILD_DIR}/tmp/javadocSource"));
ReplaceJavadocsTask jdSource = makeTask("replaceJavadocs", ReplaceJavadocsTask.class);
{
jdSource.from(delayedFile(FML_SOURCES));
jdSource.from(delayedFile(FORGE_SOURCES));
jdSource.from(delayedFile(ECLIPSE_FORGE_SRC));
jdSource.setOutFile(delayedFile("{BUILD_DIR}/tmp/javadocSource"));
jdSource.setMethodsCsv(delayedFile(METHODS_CSV));
jdSource.setFieldsCsv(delayedFile(FIELDS_CSV));
}
final File javadoc_temp = project.file(delayedFile("{BUILD_DIR}/tmp/javadoc"));
final SubprojectTask javadocJar = makeTask("genJavadocs", SubprojectTask.class);
{
javadocJar.dependsOn("replaceJavadocs");
javadocJar.setBuildFile(delayedFile(ECLIPSE_FORGE + "/build.gradle"));
javadocJar.setTasks("javadoc");
javadocJar.setConfigureTask(new Action<Task>() {
public void execute(Task obj)
{
Javadoc task = (Javadoc)obj;
task.setSource(project.fileTree(javadocSource));
task.setDestinationDir(javadoc_temp);
}
});
javadocJar.dependsOn("generateProjects", "extractForgeSources");
}
final Zip javadoc = makeTask("packageJavadoc", Zip.class);
{
javadoc.from(javadoc_temp);
javadoc.setClassifier("javadoc");
javadoc.dependsOn("genJavadocs");
}
project.getArtifacts().add("archives", javadoc);
ExtractS2SRangeTask range = makeTask("userDevExtractRange", ExtractS2SRangeTask.class);
{
range.setLibsFromProject(delayedFile(DevConstants.ECLIPSE_FORGE + "/build.gradle"), "compile", true);
range.addIn(delayedFile(DevConstants.FML_SOURCES));
range.addIn(delayedFile(DevConstants.FORGE_SOURCES));
range.setRangeMap(delayedFile(DevConstants.USERDEV_RANGEMAP));
range.dependsOn("extractForgeSources", "generateProjects");
}
ApplyS2STask s2s = makeTask("userDevSrgSrc", ApplyS2STask.class);
{
s2s.addIn(delayedFile(DevConstants.FORGE_SOURCES));
s2s.addIn(delayedFile(DevConstants.FML_SOURCES));
s2s.setOut(delayedFile(DevConstants.USERDEV_SRG_SRC));
s2s.addSrg(delayedFile(DevConstants.MCP_2_SRG_SRG));
s2s.addExc(delayedFile(DevConstants.JOINED_EXC));
s2s.setRangeMap(delayedFile(DevConstants.USERDEV_RANGEMAP));
s2s.dependsOn("genSrgs", range);
s2s.getOutputs().upToDateWhen(Constants.CALL_FALSE); //Fucking caching.
// find all the exc & srg files in the resources.
for (File f : project.fileTree(delayedFile(DevConstants.FML_RESOURCES).call()).getFiles())
{
if(f.getPath().endsWith(".exc"))
s2s.addExc(f);
else if(f.getPath().endsWith(".srg"))
s2s.addSrg(f);
}
// find all the exc & srg files in the resources.
for (File f : project.fileTree(delayedFile(DevConstants.FORGE_RESOURCES).call()).getFiles())
{
if(f.getPath().endsWith(".exc"))
s2s.addExc(f);
else if(f.getPath().endsWith(".srg"))
s2s.addSrg(f);
}
}
Zip userDev = makeTask("packageUserDev", Zip.class);
{
userDev.setClassifier("userdev");
userDev.from(delayedFile(JSON_DEV));
userDev.from(new Closure<File>(project) {
public File call()
{
return patchZipFML.getArchivePath();
}
});
userDev.from(new Closure<File>(project) {
public File call()
{
return patchZipForge.getArchivePath();
}
});
userDev.from(new Closure<File>(project) {
public File call()
{
return classZip.getArchivePath();
}
});
userDev.from(delayedFile(CHANGELOG));
userDev.from(delayedZipTree(BINPATCH_TMP), new CopyInto("", "devbinpatches.pack.lzma"));
userDev.from(delayedFileTree("{FML_DIR}/src/main/resources"), new CopyInto("src/main/resources"));
userDev.from(delayedFileTree("src/main/resources"), new CopyInto("src/main/resources"));
userDev.from(delayedZipTree(DevConstants.USERDEV_SRG_SRC), new CopyInto("src/main/java"));
userDev.from(delayedFile(DEOBF_DATA), new CopyInto("src/main/resources/"));
userDev.from(delayedFileTree("{MAPPINGS_DIR}"), new CopyInto("conf", "astyle.cfg", "exceptor.json", "*.csv", "!packages.csv"));
userDev.from(delayedFileTree("{MAPPINGS_DIR}/patches"), new CopyInto("conf"));
userDev.from(delayedFile(MERGE_CFG), new CopyInto("conf"));
userDev.from(delayedFile(NOTCH_2_SRG_SRG), new CopyInto("conf"));
userDev.from(delayedFile(SRG_EXC), new CopyInto("conf"));
userDev.from(delayedFile(FML_VERSIONF), new CopyInto("src/main/resources"));
userDev.rename("[\\d.]+?-dev\\.json", "dev.json");
userDev.rename(".+?\\.srg", "packaged.srg");
userDev.rename(".+?\\.exc", "packaged.exc");
userDev.setIncludeEmptyDirs(false);
userDev.dependsOn("packageUniversal", "zipFmlPatches", "zipForgePatches", "jarClasses", "createVersionPropertiesFML", s2s);
userDev.setExtension("jar");
}
project.getArtifacts().add("archives", userDev);
Zip src = makeTask("packageSrc", Zip.class);
{
src.setClassifier("src");
src.from(delayedFile(CHANGELOG));
src.from(delayedFile(FML_LICENSE));
src.from(delayedFile(FML_CREDITS));
src.from(delayedFile(FORGE_LICENSE));
src.from(delayedFile(FORGE_CREDITS));
src.from(delayedFile("{FML_DIR}/install"), new CopyInto(null, "!*.gradle"));
src.from(delayedFile("{FML_DIR}/install"), (new CopyInto(null, "*.gradle")).addExpand("version", delayedString("{MC_VERSION}-{VERSION}")).addExpand("name", "forge"));
src.from(delayedFile("{FML_DIR}/gradlew"));
src.from(delayedFile("{FML_DIR}/gradlew.bat"));
src.from(delayedFile("{FML_DIR}/gradle/wrapper"), new CopyInto("gradle/wrapper"));
src.rename(".+?\\.gradle", "build.gradle");
src.dependsOn("createChangelog");
src.setExtension("zip");
}
project.getArtifacts().add("archives", src);