Allow build scripts to reference a template's source files

This commit is contained in:
ME1312 2021-06-16 00:38:00 -04:00
parent dfabbcf4ad
commit ff709ba314
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
2 changed files with 6 additions and 14 deletions

View File

@ -178,17 +178,13 @@ public class InternalSubCreator extends SubCreator {
} }
if (template.getBuildOptions().contains("Executable")) { if (template.getBuildOptions().contains("Executable")) {
File cache; File cache = null;
if (template.getBuildOptions().getBoolean("Use-Cache", true)) { if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName()); cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName());
cache.mkdirs(); cache.mkdirs();
String c = cache.toString(); var.put("cache", cache.getAbsolutePath());
if (System.getProperty("os.name").toLowerCase().startsWith("windows") &&
(template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/');
var.put("cache", c);
} else {
cache = null;
} }
var.put("source", dir.getAbsolutePath());
try { try {
Logger.get(prefix).info("Launching Build Script..."); Logger.get(prefix).info("Launching Build Script...");

View File

@ -378,17 +378,13 @@ public class SubCreatorImpl {
} }
if (template.getBuildOptions().contains("Executable")) { if (template.getBuildOptions().contains("Executable")) {
File cache; File cache = null;
if (template.getBuildOptions().getBoolean("Use-Cache", true)) { if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
cache = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Cache:Templates:" + template.getName()); cache = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Cache:Templates:" + template.getName());
cache.mkdirs(); cache.mkdirs();
String c = cache.toString(); var.put("cache", cache.getAbsolutePath());
if (System.getProperty("os.name").toLowerCase().startsWith("windows") &&
(template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/');
var.put("cache", c);
} else {
cache = null;
} }
var.put("source", dir.getAbsolutePath());
try { try {
log.logger.info.println("Launching Build Script..."); log.logger.info.println("Launching Build Script...");