Improve support for Adobe AIR mobile, use 'dist' for lime deploy output

This commit is contained in:
Joshua Granick
2017-08-25 12:11:33 -07:00
parent 41e9e877a1
commit 194bfde219
6 changed files with 115 additions and 22 deletions

View File

@@ -144,7 +144,16 @@ class HXProject {
case AIR:
platformType = PlatformType.DESKTOP;
if (targetFlags.exists ("ios") || targetFlags.exists ("android")) {
platformType = PlatformType.MOBILE;
} else {
platformType = PlatformType.DESKTOP;
}
architectures = [];
case FLASH:

View File

@@ -128,14 +128,20 @@ class AIRHelper {
if (targetPlatform == IOS) {
args.push ("-provisioning-profile");
args.push (IOSHelper.getProvisioningFile ());
var provisioningProfile = IOSHelper.getProvisioningFile ();
if (provisioningProfile != "") {
args.push ("-provisioning-profile");
args.push (provisioningProfile);
}
}
args = args.concat ([ targetPath, applicationXML ]);
if (targetPlatform == IOS) {
if (targetPlatform == IOS && PlatformHelper.hostPlatform == Platform.MAC) {
args.push ("-platformsdk");
args.push (IOSHelper.getSDKDirectory (project));
@@ -151,6 +157,12 @@ class AIRHelper {
args = args.concat (files);
if (targetPlatform == ANDROID) {
Sys.putEnv ("AIR_NOANDROIDFLAIR", "true");
}
ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", args);
}
@@ -160,6 +172,7 @@ class AIRHelper {
if (targetPlatform == ANDROID) {
AndroidHelper.initialize (project);
AndroidHelper.install (project, FileSystem.fullPath (workingDirectory) + "/" + project.app.file + ".apk");
AndroidHelper.run ("air." + project.meta.packageName + "/.AppEntry");

View File

@@ -10,7 +10,7 @@ class DeploymentHelper {
public static function deploy (project:HXProject, targetFlags:Map<String, String>, targetDirectory:String, targetName:String) {
var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ") (" + targetName + ").zip";
var targetPath = PathHelper.combine (targetDirectory, name);
var targetPath = PathHelper.combine (targetDirectory + "/dist", name);
ZipHelper.compress (PathHelper.combine (targetDirectory, "bin"), targetPath);
@@ -18,23 +18,23 @@ class DeploymentHelper {
var parent = targetFlags.get ("parent");
var args = ["upload" , "-f" , targetPath];
var args = [ "upload" , "-f" , targetPath ];
if (targetFlags.exists("config")) {
args.push("--config");
args.push(targetFlags.get("config"));
args.push ("--config");
args.push (targetFlags.get("config"));
}
if (parent != null && parent != "") {
args.push("-p");
args.push(parent);
args.push ("-p");
args.push (parent);
}
ProcessHelper.runCommand("","drive",args);
ProcessHelper.runCommand ("", "drive", args);
}

View File

@@ -2,6 +2,7 @@ package lime.tools.helpers;
import haxe.io.Path;
import lime.project.Platform;
import lime.tools.helpers.PathHelper;
import lime.tools.helpers.ProcessHelper;
import lime.project.Haxelib;
@@ -172,16 +173,24 @@ class IOSHelper {
}
public static function getProvisioningFile ():String {
public static function getProvisioningFile (project:HXProject = null):String {
var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles");
var files = FileSystem.readDirectory (path);
for (file in files) {
if (project != null && project.config.exists ("ios.provisioning-profile")) {
if (Path.extension (file) == "mobileprovision") {
return project.config.getString ("ios.provisioning-profile");
} else if (PlatformHelper.hostPlatform == Platform.MAC) {
var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles");
var files = FileSystem.readDirectory (path);
for (file in files) {
return path + "/" + file;
if (Path.extension (file) == "mobileprovision") {
return path + "/" + file;
}
}

View File

@@ -32,8 +32,33 @@ class AIRPlatform extends FlashPlatform {
super (command, _project, targetFlags);
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("air.output-directory", "air"));
targetPlatform = PlatformHelper.hostPlatform;
targetPlatformType = DESKTOP;
if (targetFlags.exists ("android")) {
targetPlatform = Platform.ANDROID;
targetPlatformType = MOBILE;
} else if (targetFlags.exists ("ios")) {
targetPlatform = Platform.IOS;
targetPlatformType = MOBILE;
} else if (targetFlags.exists ("windows")) {
targetPlatform = Platform.WINDOWS;
targetPlatformType = DESKTOP;
} else if (targetFlags.exists ("mac")) {
targetPlatform = Platform.MAC;
targetPlatformType = DESKTOP;
} else {
targetPlatform = PlatformHelper.hostPlatform;
targetPlatformType = DESKTOP;
}
}
@@ -69,6 +94,14 @@ class AIRPlatform extends FlashPlatform {
}
var targetPath = switch (targetPlatform) {
case ANDROID: "bin/" + project.app.file + ".apk";
case IOS: "bin/" + project.app.file + ".ipa";
default: "bin/" + project.app.file + ".air";
}
AIRHelper.build (project, targetDirectory, targetPlatform, "bin/" + project.app.file + ".air", "application.xml", files, "bin");
}
@@ -98,7 +131,7 @@ class AIRPlatform extends FlashPlatform {
var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ").air";
var rootDirectory = targetDirectory + "/bin";
var paths = PathHelper.readDirectory (rootDirectory);
var paths = PathHelper.readDirectory (rootDirectory, [ project.app.file + ".apk", project.app.file + ".ipa", project.app.file + ".air" ]);
var files = [];
for (path in paths) {
@@ -107,7 +140,8 @@ class AIRPlatform extends FlashPlatform {
}
AIRHelper.build (project, targetDirectory, targetPlatform, name, "application.xml", files, "bin");
PathHelper.mkdir (targetDirectory + "/dist");
AIRHelper.build (project, targetDirectory, targetPlatform, "dist/" + name, "application.xml", files, "bin");
}

View File

@@ -1489,6 +1489,34 @@ class CommandLineTools {
}
if (targetFlags.exists ("air")) {
switch (targetName) {
case "android":
targetName = "air";
targetFlags.set ("android", "");
case "ios":
targetName = "air";
targetFlags.set ("ios", "");
case "windows":
targetName = "air";
targetFlags.set ("windows", "");
case "mac", "macos":
targetName = "air";
targetFlags.set ("mac", "");
}
}
var target = null;
switch (targetName) {