Skip to content

Commit

Permalink
Add support for changing the Android minimum and target SDK versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Jun 28, 2013
1 parent d63d9a6 commit ed44d3f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
31 changes: 31 additions & 0 deletions project/NMMLParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,37 @@ class NMMLParser extends NMEProject {

dependencies.push (substitute (element.att.name));

case "android":

for (attribute in element.x.attributes ()) {

var name = formatAttributeName (attribute);
var value = substitute (element.att.resolve (attribute));

switch (name) {

case "minimum-sdk-version":

config.android.minimumSDKVersion = Std.parseInt (value);

case "target-sdk-version":

config.android.targetSDKVersion = Std.parseInt (value);

default:

name = formatAttributeName (attribute);

if (Reflect.hasField (config.android, name)) {

Reflect.setField (config.android, name, value);

}

}

}

case "ios":

if (target == Platform.IOS) {
Expand Down
4 changes: 3 additions & 1 deletion project/PlatformConfig.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PlatformConfig {
public var android:AndroidConfig;
public var ios:IOSConfig;

private static var defaultAndroid:AndroidConfig = { installLocation: "preferExternal" };
private static var defaultAndroid:AndroidConfig = { installLocation: "preferExternal", minimumSDKVersion: 8, targetSDKVersion: 8 };
private static var defaultIOS:IOSConfig = { compiler: "clang", deployment: /*3.2*/ 5, device: IOSConfigDevice.UNIVERSAL, linkerFlags: "", prerenderedIcon: false };


Expand Down Expand Up @@ -59,6 +59,8 @@ class PlatformConfig {
typedef AndroidConfig = {

@:optional var installLocation:String;
@:optional var minimumSDKVersion:Int;
@:optional var targetSDKVersion:Int;

}

Expand Down
2 changes: 2 additions & 0 deletions src/platforms/AndroidPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ class AndroidPlatform implements IPlatformTool {

context.CPP_DIR = project.app.path + "/android/obj";
context.ANDROID_INSTALL_LOCATION = project.config.android.installLocation;
context.ANDROID_MINIMUM_SDK_VERSION = project.config.android.minimumSDKVersion;
context.ANDROID_TARGET_SDK_VERSION = project.config.android.targetSDKVersion;

var iconTypes = [ "ldpi", "mdpi", "hdpi", "xhdpi" ];
var iconSizes = [ 36, 48, 72, 96 ];
Expand Down

0 comments on commit ed44d3f

Please sign in to comment.