Improvements to AIR target (icons, 'lime deploy' to generate .air on desktop)

This commit is contained in:
Joshua Granick
2017-08-24 17:42:07 -07:00
parent 970fc7655f
commit 48bb8548eb
3 changed files with 124 additions and 73 deletions

View File

@@ -9,7 +9,7 @@ import sys.FileSystem;
class AIRHelper {
public static function build (project:HXProject, targetPlatform:Platform, workingDirectory:String, targetPath:String, applicationXML:String, files:Array<String>):Void {
public static function build (project:HXProject, workingDirectory:String, targetPlatform:Platform, targetPath:String, applicationXML:String, files:Array<String>, fileDirectory:String = null):Void {
var airTarget = "air";
var extension = ".air";
@@ -142,6 +142,13 @@ class AIRHelper {
}
if (fileDirectory != null && fileDirectory != "") {
args.push ("-C");
args.push (fileDirectory);
}
args = args.concat (files);
ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", args);
@@ -149,7 +156,7 @@ class AIRHelper {
}
public static function run (project:HXProject, targetPlatform:Platform, workingDirectory:String):Void {
public static function run (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null):Void {
if (targetPlatform == ANDROID) {
@@ -190,7 +197,13 @@ class AIRHelper {
}
args.push ("application.xml");
args.push (applicationXML);
if (rootDirectory != null && rootDirectory != "") {
args.push (rootDirectory);
}
ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adl", args);

View File

@@ -22,6 +22,7 @@ import sys.FileSystem;
class AIRPlatform extends FlashPlatform {
private var iconData:Array<Dynamic>;
private var targetPlatform:Platform;
private var targetPlatformType:PlatformType;
@@ -47,7 +48,9 @@ class AIRPlatform extends FlashPlatform {
}
if (targetPlatformType != DESKTOP || project.targetFlags.exists ("final")) {
// TODO: Should we package on desktop in "deploy" command instead?
if (targetPlatformType != DESKTOP) {
var files = [ project.app.file + ".swf" ];
for (asset in project.assets) {
@@ -60,7 +63,13 @@ class AIRPlatform extends FlashPlatform {
}
AIRHelper.build (project, targetPlatform, targetDirectory + "/bin", project.app.file + ".air", "application.xml", files);
for (icon in iconData) {
files.push (icon.path);
}
AIRHelper.build (project, targetDirectory, targetPlatform, "bin/" + project.app.file + ".air", "application.xml", files, "bin");
}
@@ -80,14 +89,34 @@ class AIRPlatform extends FlashPlatform {
public override function deploy ():Void {
if (targetFlags.exists ("gdrive") || targetFlags.exists ("zip")) {
DeploymentHelper.deploy (project, targetFlags, targetDirectory, "AIR");
} else {
var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ").air";
var rootDirectory = targetDirectory + "/bin";
var paths = PathHelper.readDirectory (rootDirectory);
var files = [];
for (path in paths) {
files.push (path.substr (rootDirectory.length + 1));
}
AIRHelper.build (project, targetDirectory, targetPlatform, name, "application.xml", files, "bin");
}
}
public override function run ():Void {
AIRHelper.run (project, targetPlatform, targetDirectory + "/bin");
AIRHelper.run (project, targetDirectory, targetPlatform, "application.xml", "bin");
}
@@ -104,9 +133,31 @@ class AIRPlatform extends FlashPlatform {
var context = generateContext ();
context.OUTPUT_DIR = targetDirectory;
var iconSizes = [ 16, 32, 48, 128 ];
var icons = project.icons;
iconData = [];
if (icons.length == 0) {
icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ];
}
for (size in iconSizes) {
if (IconHelper.createIcon (icons, size, size, targetDirectory + "/bin/_res/icon-" + size + ".png")) {
iconData.push ({ size: size, path: "_res/icon-" + size + ".png" });
}
}
if (iconData.length > 0) context.icons = iconData;
FileHelper.recursiveCopyTemplate (project.templatePaths, "haxe", targetDirectory + "/haxe", context);
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/hxml", targetDirectory + "/haxe", context);
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/template", targetDirectory + "/bin", context);
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/template", targetDirectory, context);
if (embedded) {
@@ -155,21 +206,6 @@ class AIRPlatform extends FlashPlatform {
}
//var sizes = [ 32, 48, 60, 64, 128, 512 ];
//var icons = project.icons;
//
//if (icons.length == 0) {
//
//icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ];
//
//}
//
//for (size in sizes) {
//
//IconHelper.createIcon (icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png"));
//
//}
}

View File

@@ -19,15 +19,17 @@
<height>::WIN_HEIGHT::</height>
<minSize>320 240</minSize>
<maxSize>1280 960</maxSize> -->
<renderMode>direct</renderMode>
<!-- <autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
<fullScreen>true</fullScreen> -->
<depthAndStencil>true</depthAndStencil>
</initialWindow>
<installFolder>::APP_COMPANY::/::APP_TITLE::</installFolder>
<programMenuFolder>::APP_TITLE::</programMenuFolder>
<!-- <icon>
<image16x16>icon_16.png</image16x16>
<image32x32>icon_32.png</image32x32>
<image48x48>icon_48.png</image48x48>
<image128x128>icon_128.png</image128x128>
</icon> -->
::if (icons != null)::<icon>::foreach icons::
<image::size::x::size::>::path::</image::size::x::size::>::end::
</icon>::end::
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<!-- <fileTypes>