added support for native extensions for Adobe AIR

This commit is contained in:
Kaspars
2017-11-04 14:24:41 +02:00
committed by Joshua Granick
parent 5172cd8208
commit 9fed583269
3 changed files with 41 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package lime.tools.helpers;
import haxe.io.Path;
import lime.project.HXProject;
import lime.project.Platform;
import sys.FileSystem;
@@ -163,6 +164,29 @@ class AIRHelper {
args = args.concat (files);
var extDirs:Array<String> = [];
for (dependency in project.dependencies) {
if (StringTools.endsWith (dependency.path, ".ane") && extDirs.indexOf(dependency.path) == -1) {
extDirs.push(FileSystem.fullPath(Path.directory(dependency.path)));
}
}
if (extDirs.length > 0) {
args.push("-extdir");
for (extDir in extDirs) {
args.push(extDir);
}
}
if (targetPlatform == ANDROID) {
Sys.putEnv ("AIR_NOANDROIDFLAIR", "true");

View File

@@ -278,6 +278,20 @@ class AIRPlatform extends FlashPlatform {
if (iconData.length > 0) context.icons = iconData;
context.extensions = new Array<String>();
for (dependency in project.dependencies) {
if (StringTools.endsWith(dependency.path, ".ane")) {
var extension:Dynamic = { name: dependency.name };
context.extensions.push(extension);
context.HAXE_FLAGS += "\n-swf-lib " + dependency.path;
}
}
FileHelper.recursiveCopyTemplate (project.templatePaths, "haxe", targetDirectory + "/haxe", context);
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/hxml", targetDirectory + "/haxe", context);
FileHelper.recursiveCopyTemplate (project.templatePaths, "air/template", targetDirectory, context);

View File

@@ -67,4 +67,7 @@
<iPhone>
<requestedDisplayResolution>::if WIN_ALLOW_HIGH_DPI::high::else::standard::end::</requestedDisplayResolution>
</iPhone>
::if (extensions != null)::<extensions>::foreach extensions::
<extensionID>::name::</extensionID>::end::
</extensions>::end::
</application>