From ecb799128b9a30b9720ea5bf26b709fc46af24ea Mon Sep 17 00:00:00 2001 From: player-03 Date: Thu, 26 May 2016 06:00:21 -0400 Subject: [PATCH] Automatically insert build.gradle into an extension if it isn't there. --- lime/tools/platforms/AndroidPlatform.hx | 12 ++++++++++++ tools/utils/CreateTemplate.hx | 3 +++ 2 files changed, 15 insertions(+) diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx index c6529c327..5ef01079f 100644 --- a/lime/tools/platforms/AndroidPlatform.hx +++ b/lime/tools/platforms/AndroidPlatform.hx @@ -15,6 +15,7 @@ import lime.tools.helpers.PathHelper; import lime.tools.helpers.ProcessHelper; import lime.project.Architecture; import lime.project.AssetType; +import lime.project.Haxelib; import lime.project.HXProject; import lime.project.Icon; import lime.project.PlatformTarget; @@ -387,6 +388,17 @@ class AndroidPlatform extends PlatformTarget { FileHelper.recursiveCopy (library.source, sourceSet + "/deps/" + library.name, context, true); + if (!FileSystem.exists (sourceSet + "/deps/" + library.name + "/build.gradle")) { + + context.extensionLowerCase = library.name.toLowerCase(); + + var source = PathHelper.getHaxelib (new Haxelib ("lime")) + "templates/extension/dependencies/android/build.gradle"; + FileHelper.copyFile (source, sourceSet + "/deps/" + library.name + "/build.gradle", context, true); + + Reflect.deleteField(context, "extensionLowerCase"); + + } + } FileHelper.recursiveCopyTemplate (project.templatePaths, "android/template", destination, context); diff --git a/tools/utils/CreateTemplate.hx b/tools/utils/CreateTemplate.hx index 73fe182d4..7080e7404 100644 --- a/tools/utils/CreateTemplate.hx +++ b/tools/utils/CreateTemplate.hx @@ -35,6 +35,9 @@ class CreateTemplate { context.extensionLowerCase = extension.toLowerCase (); context.extensionUpperCase = extension.toUpperCase (); context.ANDROID_TARGET_SDK_VERSION = "::ANDROID_TARGET_SDK_VERSION::"; + context.ANDROID_MINIMUM_SDK_VERSION = "::ANDROID_MINIMUM_SDK_VERSION::"; + context.META_BUILD_NUMBER = "::META_BUILD_NUMBER::"; + context.META_VERSION = "::META_VERSION::"; PathHelper.mkdir (title); FileHelper.recursiveCopyTemplate ([ PathHelper.getHaxelib (new Haxelib ("lime"), true) + "/templates" ], "extension", title, context);