Improve 'lime display' when templates have not been processed

This commit is contained in:
Joshua Granick
2019-02-26 14:01:45 -08:00
parent 2fd940239f
commit 44bf137f9b
12 changed files with 239 additions and 222 deletions

View File

@@ -1,23 +1,19 @@
package;
import hxp.Log;
import hxp.Path;
import haxe.Template;
import hxp.System;
import lime.tools.AIRHelper;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.DeploymentHelper;
import hxp.System;
import lime.tools.FlashHelper;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import hxp.Log;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformType;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.System;
import sys.io.File;
import sys.FileSystem;
@@ -161,27 +157,6 @@ class AIRPlatform extends FlashPlatform
}
}
private override function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, "flash/hxml/" + buildType + ".hxml");
var context = project.templateContext;
context.WIN_FLASHBACKGROUND = StringTools.hex(project.window.background, 6);
context.OUTPUT_DIR = targetDirectory;
for (dependency in project.dependencies)
{
if (StringTools.endsWith(dependency.path, ".ane"))
{
context.HAXE_FLAGS += "\n-swf-lib " + dependency.path;
}
}
var template = new Template(File.getContent(hxml));
return template.execute(context);
}
public override function install():Void
{
// TODO: Make separate install step

View File

@@ -1,25 +1,22 @@
package;
import hxp.ArrayTools;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.Path;
import haxe.Template;
import hxp.System;
import lime.tools.AndroidHelper;
import lime.tools.Architecture;
import hxp.ArrayTools;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import hxp.Haxelib;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import hxp.Log;
import hxp.Path;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.System;
import sys.io.File;
import sys.FileSystem;
@@ -176,15 +173,20 @@ class AndroidPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, "android/hxml/" + buildType + ".hxml");
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = project.templateContext;
context.CPP_DIR = targetDirectory + "/obj";
context.OUTPUT_DIR = targetDirectory;
var template = new Template(File.getContent(hxml));
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.cpp = "_";
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function install():Void

View File

@@ -1,21 +1,19 @@
package;
import hxp.Path;
import hxp.NDLL;
import haxe.Json;
import haxe.Template;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.NDLL;
import hxp.Path;
import hxp.System;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import hxp.Haxelib;
import lime.tools.HTML5Helper;
import hxp.Log;
import hxp.Path;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.PlatformTarget;
import lime.tools.ProjectHelper;
import sys.io.File;
import sys.FileSystem;
@@ -235,15 +233,26 @@ class EmscriptenPlatform extends PlatformTarget
public override function display():Void
{
var hxml = System.findTemplate(project.templatePaths, "emscripten/hxml/" + buildType + ".hxml");
Sys.println(getDisplayHXML());
}
var context = project.templateContext;
context.OUTPUT_DIR = targetDirectory;
context.OUTPUT_FILE = outputFile;
private function getDisplayHXML():String
{
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var template = new Template(File.getContent(hxml));
Sys.println(template.execute(context));
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.cpp = "_";
hxml.define("webgl");
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,24 +1,20 @@
package;
import hxp.Path;
import haxe.Json;
import haxe.Template;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.Path;
import hxp.System;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.DeploymentHelper;
import lime.tools.ProjectHelper;
import hxp.System;
import lime.tools.FlashHelper;
import hxp.Haxelib;
import lime.tools.HTML5Helper;
import hxp.Log;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import hxp.System;
import lime.tools.ProjectHelper;
import lime.tools.FlashHelper;
import lime.tools.HTML5Helper;
import lime.tools.Platform;
import lime.tools.PlatformTarget;
import sys.io.File;
import sys.FileSystem;
#if neko
@@ -104,15 +100,21 @@ class FlashPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, "flash/hxml/" + buildType + ".hxml");
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = project.templateContext;
context.WIN_FLASHBACKGROUND = StringTools.hex(project.window.background, 6);
context.OUTPUT_DIR = targetDirectory;
var template = new Template(File.getContent(hxml));
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.swfVersion = context.SWF_VERSION;
hxml.swf = "_.swf";
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function run():Void

View File

@@ -1,6 +1,9 @@
package;
import hxp.HXML;
import hxp.Log;
import hxp.Path;
import hxp.System;
import haxe.Template;
#if lime
import lime.text.Font;
@@ -9,18 +12,13 @@ import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.DeploymentHelper;
import lime.tools.ElectronHelper;
import hxp.System;
import lime.tools.HTML5Helper;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import hxp.Log;
import lime.tools.ModuleHelper;
import lime.tools.ProjectHelper;
import hxp.Path;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import hxp.System;
import sys.io.File;
import sys.FileSystem;
@@ -124,22 +122,25 @@ class HTML5Platform extends PlatformTarget
private function getDisplayHXML():String
{
var type = "html5";
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
if (targetFlags.exists("electron"))
if (FileSystem.exists(path))
{
type = "electron";
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.js = "_";
hxml.define("html");
if (targetFlags.exists("electron"))
{
hxml.define("electron");
}
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
var hxml = System.findTemplate(project.templatePaths, type + "/hxml/" + buildType + ".hxml");
var context = project.templateContext;
context.OUTPUT_DIR = targetDirectory;
context.OUTPUT_FILE = outputFile;
var template = new Template(File.getContent(hxml));
return template.execute(context);
}
private function initialize(command:String, project:HXProject):Void

View File

@@ -1,36 +1,31 @@
package;
// import openfl.display.BitmapData;
import hxp.Path;
import haxe.Json;
import haxe.Template;
import lime.tools.Architecture;
import hxp.ArrayTools;
import lime.tools.Asset;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import hxp.Haxelib;
import lime.tools.Icon;
import lime.tools.IconHelper;
import lime.tools.IOSHelper;
import lime.tools.Keystore;
import hxp.HXML;
import hxp.Log;
import hxp.NDLL;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.StringTools;
import hxp.System;
#if lime
import lime.graphics.Image;
#end
import lime.tools.Architecture;
import lime.tools.Asset;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import lime.tools.IOSHelper;
import lime.tools.Keystore;
import lime.tools.Platform;
import lime.tools.PlatformTarget;
import lime.tools.ProjectHelper;
import sys.io.File;
import sys.FileSystem;
@@ -374,15 +369,21 @@ class IOSPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, "iphone/PROJ/haxe/Build.hxml", false);
if (hxml == null) hxml = System.findTemplate(project.templatePaths, "iphone/template/{{app.file}}/Build.hxml", true);
var template = new Template(File.getContent(hxml));
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
// project = project.clone ();
var context = generateContext();
context.OUTPUT_DIR = targetDirectory;
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.cpp = "_";
hxml.define("iphone");
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,27 +1,23 @@
package;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Path;
import hxp.Log;
import hxp.NDLL;
import haxe.Template;
import hxp.System;
import lime.tools.Architecture;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import hxp.Haxelib;
import lime.tools.HXProject;
import lime.tools.JavaHelper;
import hxp.Log;
import lime.tools.NekoHelper;
import lime.tools.NodeJSHelper;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.System;
import sys.io.File;
import sys.io.Process;
import sys.FileSystem;
@@ -255,13 +251,27 @@ class LinuxPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, targetType + "/hxml/" + buildType + ".hxml");
var template = new Template(File.getContent(hxml));
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = generateContext();
context.OUTPUT_DIR = targetDirectory;
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
switch (targetType)
{
case "hl": hxml.hl = "_.hl";
case "neko": hxml.neko = "_.n";
case "java": hxml.java = "_";
case "nodejs": hxml.js = "_.js";
default: hxml.cpp = "_";
}
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,31 +1,27 @@
package;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.Path;
import hxp.NDLL;
import haxe.Template;
import hxp.System;
import lime.tools.Architecture;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.CSHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import lime.tools.GUID;
import hxp.Haxelib;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import lime.tools.JavaHelper;
import hxp.Log;
import lime.tools.NekoHelper;
import lime.tools.NodeJSHelper;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.System;
import sys.io.File;
import sys.FileSystem;
@@ -230,13 +226,27 @@ class MacPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, targetType + "/hxml/" + buildType + ".hxml");
var template = new Template(File.getContent(hxml));
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = generateContext();
context.OUTPUT_DIR = targetDirectory;
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
switch (targetType)
{
case "hl": hxml.hl = "_.hl";
case "neko": hxml.neko = "_.n";
case "java": hxml.java = "_";
case "nodejs": hxml.js = "_.js";
default: hxml.cpp = "_";
}
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,36 +1,31 @@
package;
// import openfl.display.BitmapData;
import hxp.Path;
import haxe.Json;
import haxe.Template;
import lime.tools.Architecture;
import hxp.ArrayTools;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.NDLL;
import hxp.Path;
import hxp.StringTools;
import hxp.System;
#if lime
import lime.graphics.Image;
#end
import lime.tools.Architecture;
import lime.tools.Asset;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import hxp.Haxelib;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import lime.tools.Keystore;
import hxp.Log;
import hxp.NDLL;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.StringTools;
import lime.tools.TVOSHelper;
import hxp.System;
#if lime
import lime.graphics.Image;
#end
import sys.io.File;
import sys.FileSystem;
@@ -301,13 +296,22 @@ class TVOSPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, "tvos/PROJ/haxe/Build.hxml");
var template = new Template(File.getContent(hxml));
var path = targetDirectory + "/" + project.app.file + "/haxe/Build.hxml";
var context = generateContext();
context.OUTPUT_DIR = targetDirectory;
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.cpp = "_";
hxml.define("tvos");
hxml.define("appletv");
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,20 +1,18 @@
package;
import hxp.HXML;
import hxp.Path;
import haxe.Template;
import hxp.System;
import lime.tools.AssetHelper;
import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import hxp.Path;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.TizenHelper;
import lime.tools.TizenHelper;
import sys.io.File;
import sys.FileSystem;
@@ -79,15 +77,20 @@ class TizenPlatform extends PlatformTarget
public override function display():Void
{
var hxml = System.findTemplate(project.templatePaths, "tizen/hxml/" + buildType + ".hxml");
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = project.templateContext;
context.CPP_DIR = targetDirectory + "/obj";
context.OUTPUT_DIR = targetDirectory;
var template = new Template(File.getContent(hxml));
Sys.println(template.execute(context));
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
hxml.cpp = "_";
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void

View File

@@ -1,8 +1,11 @@
package;
import hxp.Haxelib;
import hxp.HXML;
import hxp.Log;
import hxp.Path;
import hxp.NDLL;
import haxe.Template;
import hxp.System;
import lime.tools.Architecture;
import lime.tools.Asset;
import lime.tools.AssetHelper;
@@ -10,25 +13,18 @@ import lime.tools.AssetType;
import lime.tools.CPPHelper;
import lime.tools.CSHelper;
import lime.tools.DeploymentHelper;
import hxp.System;
import lime.tools.GUID;
import hxp.Haxelib;
import lime.tools.HTML5Helper;
import lime.tools.HXProject;
import lime.tools.Icon;
import lime.tools.IconHelper;
import lime.tools.JavaHelper;
import hxp.Log;
import lime.tools.ModuleHelper;
import lime.tools.NekoHelper;
import lime.tools.NodeJSHelper;
import hxp.Path;
import lime.tools.Platform;
import hxp.System;
import lime.tools.PlatformTarget;
import hxp.System;
import lime.tools.HXProject;
import lime.tools.ProjectHelper;
import hxp.System;
import sys.io.File;
import sys.FileSystem;
@@ -420,13 +416,27 @@ class WindowsPlatform extends PlatformTarget
private function getDisplayHXML():String
{
var hxml = System.findTemplate(project.templatePaths, targetType + "/hxml/" + buildType + ".hxml");
var template = new Template(File.getContent(hxml));
var path = targetDirectory + "/haxe/" + buildType + ".hxml";
var context = generateContext();
context.OUTPUT_DIR = targetDirectory;
return template.execute(context);
if (FileSystem.exists(path))
{
return File.getContent(path);
}
else
{
var context = project.templateContext;
var hxml = new HXML();
hxml.noOutput = true;
switch (targetType)
{
case "hl": hxml.hl = "_.hl";
case "neko": hxml.neko = "_.n";
case "java": hxml.java = "_";
case "nodejs", "winjs": hxml.js = "_.js";
default: hxml.cpp = "_";
}
return context.HAXE_FLAGS + "\n" + hxml.toString();
}
}
public override function rebuild():Void