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 {
|
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 airTarget = "air";
|
||||||
var extension = ".air";
|
var extension = ".air";
|
||||||
@@ -142,6 +142,13 @@ class AIRHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileDirectory != null && fileDirectory != "") {
|
||||||
|
|
||||||
|
args.push ("-C");
|
||||||
|
args.push (fileDirectory);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
args = args.concat (files);
|
args = args.concat (files);
|
||||||
|
|
||||||
ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", args);
|
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) {
|
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);
|
ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adl", args);
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import sys.FileSystem;
|
|||||||
class AIRPlatform extends FlashPlatform {
|
class AIRPlatform extends FlashPlatform {
|
||||||
|
|
||||||
|
|
||||||
|
private var iconData:Array<Dynamic>;
|
||||||
private var targetPlatform:Platform;
|
private var targetPlatform:Platform;
|
||||||
private var targetPlatformType:PlatformType;
|
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" ];
|
var files = [ project.app.file + ".swf" ];
|
||||||
for (asset in project.assets) {
|
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 {
|
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 {
|
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 ();
|
var context = generateContext ();
|
||||||
context.OUTPUT_DIR = targetDirectory;
|
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, "haxe", targetDirectory + "/haxe", context);
|
||||||
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/hxml", 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) {
|
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" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<application xmlns="http://ns.adobe.com/air/application/25.0">
|
<application xmlns="http://ns.adobe.com/air/application/25.0">
|
||||||
<id>::APP_PACKAGE::</id>
|
<id>::APP_PACKAGE::</id>
|
||||||
<versionNumber>::APP_VERSION::</versionNumber>
|
<versionNumber>::APP_VERSION::</versionNumber>
|
||||||
<filename>::APP_FILE::</filename>
|
<filename>::APP_FILE::</filename>
|
||||||
<name>::APP_TITLE::</name>
|
<name>::APP_TITLE::</name>
|
||||||
<description>::APP_DESCRIPTION::</description>
|
<description>::APP_DESCRIPTION::</description>
|
||||||
<!-- <copyright>????</copyright> -->
|
<!-- <copyright>????</copyright> -->
|
||||||
<initialWindow>
|
<initialWindow>
|
||||||
<title>::APP_TITLE::</title>
|
<title>::APP_TITLE::</title>
|
||||||
<content>::APP_FILE::.swf</content>
|
<content>::APP_FILE::.swf</content>
|
||||||
<systemChrome>standard</systemChrome>
|
<systemChrome>standard</systemChrome>
|
||||||
<transparent>false</transparent>
|
<transparent>false</transparent>
|
||||||
<visible>true</visible>
|
<visible>true</visible>
|
||||||
<minimizable>true</minimizable>
|
<minimizable>true</minimizable>
|
||||||
<maximizable>false</maximizable>
|
<maximizable>false</maximizable>
|
||||||
<resizable>::WIN_RESIZABLE::</resizable>
|
<resizable>::WIN_RESIZABLE::</resizable>
|
||||||
<!-- <width>::WIN_WIDTH::</width>
|
<!-- <width>::WIN_WIDTH::</width>
|
||||||
<height>::WIN_HEIGHT::</height>
|
<height>::WIN_HEIGHT::</height>
|
||||||
<minSize>320 240</minSize>
|
<minSize>320 240</minSize>
|
||||||
<maxSize>1280 960</maxSize> -->
|
<maxSize>1280 960</maxSize> -->
|
||||||
</initialWindow>
|
<renderMode>direct</renderMode>
|
||||||
<installFolder>::APP_COMPANY::/::APP_TITLE::</installFolder>
|
<!-- <autoOrients>false</autoOrients>
|
||||||
<programMenuFolder>::APP_TITLE::</programMenuFolder>
|
<aspectRatio>landscape</aspectRatio>
|
||||||
<!-- <icon>
|
<fullScreen>true</fullScreen> -->
|
||||||
<image16x16>icon_16.png</image16x16>
|
<depthAndStencil>true</depthAndStencil>
|
||||||
<image32x32>icon_32.png</image32x32>
|
</initialWindow>
|
||||||
<image48x48>icon_48.png</image48x48>
|
<installFolder>::APP_COMPANY::/::APP_TITLE::</installFolder>
|
||||||
<image128x128>icon_128.png</image128x128>
|
<programMenuFolder>::APP_TITLE::</programMenuFolder>
|
||||||
</icon> -->
|
::if (icons != null)::<icon>::foreach icons::
|
||||||
<customUpdateUI>false</customUpdateUI>
|
<image::size::x::size::>::path::</image::size::x::size::>::end::
|
||||||
<allowBrowserInvocation>false</allowBrowserInvocation>
|
</icon>::end::
|
||||||
<!-- <fileTypes>
|
<customUpdateUI>false</customUpdateUI>
|
||||||
<fileType>
|
<allowBrowserInvocation>false</allowBrowserInvocation>
|
||||||
<name>adobe.VideoFile</name>
|
<!-- <fileTypes>
|
||||||
<extension>avf</extension>
|
<fileType>
|
||||||
<description>Adobe Video File</description>
|
<name>adobe.VideoFile</name>
|
||||||
<contentType>application/vnd.adobe.video-file</contentType>
|
<extension>avf</extension>
|
||||||
<icon>
|
<description>Adobe Video File</description>
|
||||||
<image16x16>icons/avfIcon_16.png</image16x16>
|
<contentType>application/vnd.adobe.video-file</contentType>
|
||||||
<image32x32>icons/avfIcon_32.png</image32x32>
|
<icon>
|
||||||
<image48x48>icons/avfIcon_48.png</image48x48>
|
<image16x16>icons/avfIcon_16.png</image16x16>
|
||||||
<image128x128>icons/avfIcon_128.png</image128x128>
|
<image32x32>icons/avfIcon_32.png</image32x32>
|
||||||
</icon>
|
<image48x48>icons/avfIcon_48.png</image48x48>
|
||||||
</fileType>
|
<image128x128>icons/avfIcon_128.png</image128x128>
|
||||||
</fileTypes> -->
|
</icon>
|
||||||
|
</fileType>
|
||||||
|
</fileTypes> -->
|
||||||
<android>
|
<android>
|
||||||
<manifestAdditions>
|
<manifestAdditions>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<manifest>
|
<manifest>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
]]>
|
]]>
|
||||||
</manifestAdditions>
|
</manifestAdditions>
|
||||||
</android>
|
</android>
|
||||||
</application>
|
</application>
|
||||||
Reference in New Issue
Block a user