Print error and exit if ANDROID_SDK or ANDROID_NDK_ROOT is undefined for Android builds

This commit is contained in:
Joshua Granick
2017-03-06 10:05:03 -08:00
parent 8e92767ba2
commit f5fb0de232

View File

@@ -315,6 +315,13 @@ class AndroidPlatform extends PlatformTarget {
context.ANDROID_GRADLE_PLUGIN = project.config.getString ("android.gradle-plugin", "2.1.0");
context.ANDROID_LIBRARY_PROJECTS = [];
if (!project.environment.exists ("ANDROID_SDK") || !project.environment.exists ("ANDROID_NDK_ROOT")) {
LogHelper.error ("You must define ANDROID_SDK and ANDROID_NDK_ROOT to target Android, please run '" + CommandLineTools.commandName + " setup android' first");
Sys.exit (1);
}
var escaped = ~/([ #!=\\:])/g;
context.ANDROID_SDK_ESCAPED = escaped.replace(context.ENV_ANDROID_SDK, "\\$1");
context.ANDROID_NDK_ROOT_ESCAPED = escaped.replace(context.ENV_ANDROID_NDK_ROOT, "\\$1");