From 9fed583269372b4dd692317e70ef58669d509f73 Mon Sep 17 00:00:00 2001 From: Kaspars Date: Sat, 4 Nov 2017 14:24:41 +0200 Subject: [PATCH] added support for native extensions for Adobe AIR --- lime/tools/helpers/AIRHelper.hx | 24 ++++++++++++++++++++++++ lime/tools/platforms/AIRPlatform.hx | 14 ++++++++++++++ templates/air/template/application.xml | 3 +++ 3 files changed, 41 insertions(+) diff --git a/lime/tools/helpers/AIRHelper.hx b/lime/tools/helpers/AIRHelper.hx index 0eb7868d8..417e81821 100644 --- a/lime/tools/helpers/AIRHelper.hx +++ b/lime/tools/helpers/AIRHelper.hx @@ -1,6 +1,7 @@ package lime.tools.helpers; +import haxe.io.Path; import lime.project.HXProject; import lime.project.Platform; import sys.FileSystem; @@ -162,6 +163,29 @@ class AIRHelper { } args = args.concat (files); + + var extDirs:Array = []; + + 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) { diff --git a/lime/tools/platforms/AIRPlatform.hx b/lime/tools/platforms/AIRPlatform.hx index 166c40f88..df0d6a7b0 100644 --- a/lime/tools/platforms/AIRPlatform.hx +++ b/lime/tools/platforms/AIRPlatform.hx @@ -277,6 +277,20 @@ class AIRPlatform extends FlashPlatform { } if (iconData.length > 0) context.icons = iconData; + + context.extensions = new Array(); + + 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); diff --git a/templates/air/template/application.xml b/templates/air/template/application.xml index 72a502e4b..688ecfa3f 100644 --- a/templates/air/template/application.xml +++ b/templates/air/template/application.xml @@ -67,4 +67,7 @@ ::if WIN_ALLOW_HIGH_DPI::high::else::standard::end:: + ::if (extensions != null)::::foreach extensions:: + ::name::::end:: + ::end:: \ No newline at end of file