Improvements to AIR target (icons, 'lime deploy' to generate .air on desktop)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
DeploymentHelper.deploy (project, targetFlags, targetDirectory, "AIR");
|
||||
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"));
|
||||
//
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,59 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<application xmlns="http://ns.adobe.com/air/application/25.0">
|
||||
<id>::APP_PACKAGE::</id>
|
||||
<versionNumber>::APP_VERSION::</versionNumber>
|
||||
<filename>::APP_FILE::</filename>
|
||||
<name>::APP_TITLE::</name>
|
||||
<description>::APP_DESCRIPTION::</description>
|
||||
<!-- <copyright>????</copyright> -->
|
||||
<initialWindow>
|
||||
<title>::APP_TITLE::</title>
|
||||
<content>::APP_FILE::.swf</content>
|
||||
<systemChrome>standard</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<visible>true</visible>
|
||||
<minimizable>true</minimizable>
|
||||
<maximizable>false</maximizable>
|
||||
<resizable>::WIN_RESIZABLE::</resizable>
|
||||
<!-- <width>::WIN_WIDTH::</width>
|
||||
<height>::WIN_HEIGHT::</height>
|
||||
<minSize>320 240</minSize>
|
||||
<maxSize>1280 960</maxSize> -->
|
||||
</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> -->
|
||||
<customUpdateUI>false</customUpdateUI>
|
||||
<allowBrowserInvocation>false</allowBrowserInvocation>
|
||||
<!-- <fileTypes>
|
||||
<fileType>
|
||||
<name>adobe.VideoFile</name>
|
||||
<extension>avf</extension>
|
||||
<description>Adobe Video File</description>
|
||||
<contentType>application/vnd.adobe.video-file</contentType>
|
||||
<icon>
|
||||
<image16x16>icons/avfIcon_16.png</image16x16>
|
||||
<image32x32>icons/avfIcon_32.png</image32x32>
|
||||
<image48x48>icons/avfIcon_48.png</image48x48>
|
||||
<image128x128>icons/avfIcon_128.png</image128x128>
|
||||
</icon>
|
||||
</fileType>
|
||||
</fileTypes> -->
|
||||
<id>::APP_PACKAGE::</id>
|
||||
<versionNumber>::APP_VERSION::</versionNumber>
|
||||
<filename>::APP_FILE::</filename>
|
||||
<name>::APP_TITLE::</name>
|
||||
<description>::APP_DESCRIPTION::</description>
|
||||
<!-- <copyright>????</copyright> -->
|
||||
<initialWindow>
|
||||
<title>::APP_TITLE::</title>
|
||||
<content>::APP_FILE::.swf</content>
|
||||
<systemChrome>standard</systemChrome>
|
||||
<transparent>false</transparent>
|
||||
<visible>true</visible>
|
||||
<minimizable>true</minimizable>
|
||||
<maximizable>false</maximizable>
|
||||
<resizable>::WIN_RESIZABLE::</resizable>
|
||||
<!-- <width>::WIN_WIDTH::</width>
|
||||
<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>
|
||||
::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>
|
||||
<fileType>
|
||||
<name>adobe.VideoFile</name>
|
||||
<extension>avf</extension>
|
||||
<description>Adobe Video File</description>
|
||||
<contentType>application/vnd.adobe.video-file</contentType>
|
||||
<icon>
|
||||
<image16x16>icons/avfIcon_16.png</image16x16>
|
||||
<image32x32>icons/avfIcon_32.png</image32x32>
|
||||
<image48x48>icons/avfIcon_48.png</image48x48>
|
||||
<image128x128>icons/avfIcon_128.png</image128x128>
|
||||
</icon>
|
||||
</fileType>
|
||||
</fileTypes> -->
|
||||
<android>
|
||||
<manifestAdditions>
|
||||
<![CDATA[
|
||||
<manifest>
|
||||
<manifestAdditions>
|
||||
<![CDATA[
|
||||
<manifest>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
||||
]]>
|
||||
</manifestAdditions>
|
||||
</manifest>
|
||||
]]>
|
||||
</manifestAdditions>
|
||||
</android>
|
||||
</application>
|
||||
Reference in New Issue
Block a user