Move hxProject.certificate to .keystore, use iOS config for profile, identity and team ID, some file cleanup
This commit is contained in:
@@ -34,7 +34,6 @@ class HXProject {
|
||||
public var app:ApplicationData;
|
||||
public var architectures:Array<Architecture>;
|
||||
public var assets:Array<Asset>;
|
||||
public var certificate:Keystore;
|
||||
public var command:String;
|
||||
public var config:ConfigData;
|
||||
public var debug:Bool;
|
||||
@@ -47,6 +46,7 @@ class HXProject {
|
||||
public var host (get_host, null):Platform;
|
||||
public var icons:Array<Icon>;
|
||||
public var javaPaths:Array<String>;
|
||||
public var keystore:Keystore;
|
||||
public var libraries:Array<Library>;
|
||||
public var libraryHandlers:Map<String, String>;
|
||||
public var meta:MetaData;
|
||||
@@ -274,12 +274,6 @@ class HXProject {
|
||||
|
||||
}
|
||||
|
||||
if (certificate != null) {
|
||||
|
||||
project.certificate = certificate.clone ();
|
||||
|
||||
}
|
||||
|
||||
project.command = command;
|
||||
project.config = config.clone ();
|
||||
project.debug = debug;
|
||||
@@ -324,6 +318,12 @@ class HXProject {
|
||||
|
||||
project.javaPaths = javaPaths.copy ();
|
||||
|
||||
if (keystore != null) {
|
||||
|
||||
project.keystore = keystore.clone ();
|
||||
|
||||
}
|
||||
|
||||
for (library in libraries) {
|
||||
|
||||
project.libraries.push (library.clone ());
|
||||
@@ -750,16 +750,6 @@ class HXProject {
|
||||
StringMapHelper.copyUniqueKeys (project.libraryHandlers, libraryHandlers);
|
||||
StringMapHelper.copyUniqueKeys (project.targetHandlers, targetHandlers);
|
||||
|
||||
if (certificate == null) {
|
||||
|
||||
certificate = project.certificate;
|
||||
|
||||
} else {
|
||||
|
||||
certificate.merge (project.certificate);
|
||||
|
||||
}
|
||||
|
||||
config.merge (project.config);
|
||||
|
||||
assets = ArrayHelper.concatUnique (assets, project.assets);
|
||||
@@ -768,6 +758,18 @@ class HXProject {
|
||||
haxelibs = ArrayHelper.concatUnique (haxelibs, project.haxelibs, true, "name");
|
||||
icons = ArrayHelper.concatUnique (icons, project.icons);
|
||||
javaPaths = ArrayHelper.concatUnique (javaPaths, project.javaPaths, true);
|
||||
|
||||
if (keystore == null) {
|
||||
|
||||
keystore = project.keystore;
|
||||
|
||||
} else {
|
||||
|
||||
keystore.merge (project.keystore);
|
||||
|
||||
}
|
||||
|
||||
|
||||
libraries = ArrayHelper.concatUnique (libraries, project.libraries, true);
|
||||
|
||||
for (key in project.modules.keys ()) {
|
||||
@@ -1287,39 +1289,33 @@ class HXProject {
|
||||
context.SWF_VERSION = app.swfVersion;
|
||||
context.PRELOADER_NAME = app.preloader;
|
||||
|
||||
if (certificate != null) {
|
||||
if (keystore != null) {
|
||||
|
||||
context.KEY_STORE = PathHelper.tryFullPath (certificate.path);
|
||||
context.KEY_STORE = PathHelper.tryFullPath (keystore.path);
|
||||
|
||||
if (certificate.password != null) {
|
||||
if (keystore.password != null) {
|
||||
|
||||
context.KEY_STORE_PASSWORD = certificate.password;
|
||||
context.KEY_STORE_PASSWORD = keystore.password;
|
||||
|
||||
}
|
||||
|
||||
if (certificate.alias != null) {
|
||||
if (keystore.alias != null) {
|
||||
|
||||
context.KEY_STORE_ALIAS = certificate.alias;
|
||||
context.KEY_STORE_ALIAS = keystore.alias;
|
||||
|
||||
} else if (certificate.path != null) {
|
||||
} else if (keystore.path != null) {
|
||||
|
||||
context.KEY_STORE_ALIAS = Path.withoutExtension (Path.withoutDirectory (certificate.path));
|
||||
context.KEY_STORE_ALIAS = Path.withoutExtension (Path.withoutDirectory (keystore.path));
|
||||
|
||||
}
|
||||
|
||||
if (certificate.aliasPassword != null) {
|
||||
if (keystore.aliasPassword != null) {
|
||||
|
||||
context.KEY_STORE_ALIAS_PASSWORD = certificate.aliasPassword;
|
||||
context.KEY_STORE_ALIAS_PASSWORD = keystore.aliasPassword;
|
||||
|
||||
} else if (certificate.password != null) {
|
||||
} else if (keystore.password != null) {
|
||||
|
||||
context.KEY_STORE_ALIAS_PASSWORD = certificate.password;
|
||||
|
||||
}
|
||||
|
||||
if (certificate.identity != null) {
|
||||
|
||||
context.KEY_STORE_IDENTITY = certificate.identity;
|
||||
context.KEY_STORE_ALIAS_PASSWORD = keystore.password;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,26 +5,22 @@ class Keystore {
|
||||
|
||||
public var alias:String;
|
||||
public var aliasPassword:String;
|
||||
public var identity:String;
|
||||
public var password:String;
|
||||
public var path:String;
|
||||
public var teamID:String;
|
||||
public var type:String;
|
||||
|
||||
public function new (path:String = null, password:String = null, alias:String = null, aliasPassword:String = null, identity:String = null, teamID:String = null) {
|
||||
public function new (path:String = null, password:String = null, alias:String = null, aliasPassword:String = null) {
|
||||
|
||||
this.path = path;
|
||||
this.password = password;
|
||||
this.alias = alias;
|
||||
this.aliasPassword = aliasPassword;
|
||||
this.identity = identity;
|
||||
this.teamID = teamID;
|
||||
|
||||
}
|
||||
|
||||
public function clone ():Keystore {
|
||||
|
||||
return new Keystore (path, password, alias, aliasPassword, identity, teamID);
|
||||
return new Keystore (path, password, alias, aliasPassword);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +32,6 @@ class Keystore {
|
||||
if (keystore.password != null) path = keystore.password;
|
||||
if (keystore.alias != null) path = keystore.alias;
|
||||
if (keystore.aliasPassword != null) path = keystore.aliasPassword;
|
||||
if (keystore.identity != null) identity = keystore.identity;
|
||||
if (keystore.teamID != null) teamID = keystore.teamID;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1674,53 +1674,63 @@ class ProjectXMLParser extends HXProject {
|
||||
|
||||
case "certificate":
|
||||
|
||||
var path = null;
|
||||
|
||||
if (element.has.path) {
|
||||
|
||||
certificate = new Keystore (PathHelper.combine (extensionPath, substitute (element.att.path)));
|
||||
path = element.att.path;
|
||||
|
||||
} else if (element.has.keystore) {
|
||||
|
||||
path = element.att.keystore;
|
||||
|
||||
}
|
||||
|
||||
if (path != null) {
|
||||
|
||||
keystore = new Keystore (PathHelper.combine (extensionPath, substitute (element.att.path)));
|
||||
|
||||
if (element.has.type) {
|
||||
|
||||
certificate.type = substitute (element.att.type);
|
||||
keystore.type = substitute (element.att.type);
|
||||
|
||||
}
|
||||
|
||||
if (element.has.password) {
|
||||
|
||||
certificate.password = substitute (element.att.password);
|
||||
keystore.password = substitute (element.att.password);
|
||||
|
||||
}
|
||||
|
||||
if (element.has.alias) {
|
||||
|
||||
certificate.alias = substitute (element.att.alias);
|
||||
keystore.alias = substitute (element.att.alias);
|
||||
|
||||
}
|
||||
|
||||
if (element.has.resolve ("alias-password")) {
|
||||
|
||||
certificate.aliasPassword = substitute (element.att.resolve ("alias-password"));
|
||||
keystore.aliasPassword = substitute (element.att.resolve ("alias-password"));
|
||||
|
||||
} else if (element.has.alias_password) {
|
||||
|
||||
certificate.aliasPassword = substitute (element.att.alias_password);
|
||||
keystore.aliasPassword = substitute (element.att.alias_password);
|
||||
|
||||
}
|
||||
|
||||
} else if (element.has.identity || element.has.resolve ("team-id")) {
|
||||
|
||||
certificate = new Keystore ();
|
||||
}
|
||||
|
||||
if (element.has.identity) {
|
||||
|
||||
certificate.identity = substitute (element.att.identity);
|
||||
config.set ("ios.identity", element.att.identity);
|
||||
config.set ("tvos.identity", element.att.identity);
|
||||
|
||||
}
|
||||
|
||||
if (element.has.resolve ("team-id")) {
|
||||
|
||||
certificate.teamID = substitute (element.att.resolve ("team-id"));
|
||||
|
||||
}
|
||||
config.set ("ios.team-id", element.att.resolve ("team-id"));
|
||||
config.set ("tvos.team-id", element.att.resolve ("team-id"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class AndroidHelper {
|
||||
|
||||
var task = "assembleDebug";
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
task = "assembleRelease";
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ class BlackBerryHelper {
|
||||
var args = [ "-package", targetPath, descriptorFile ];
|
||||
var password = null;
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
password = project.certificate.password;
|
||||
password = project.keystore.password;
|
||||
|
||||
if (password == null) {
|
||||
|
||||
@@ -40,10 +40,10 @@ class BlackBerryHelper {
|
||||
|
||||
}
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
args.push ("-keystore");
|
||||
args.push (PathHelper.tryFullPath (project.certificate.path));
|
||||
args.push (PathHelper.tryFullPath (project.keystore.path));
|
||||
|
||||
if (password != null) {
|
||||
|
||||
@@ -75,9 +75,9 @@ class BlackBerryHelper {
|
||||
|
||||
ProcessHelper.runCommand (workingDirectory, exe, args);
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
args = [ "-keystore", PathHelper.tryFullPath (project.certificate.path) ];
|
||||
args = [ "-keystore", PathHelper.tryFullPath (project.keystore.path) ];
|
||||
|
||||
if (password != null) {
|
||||
|
||||
@@ -113,9 +113,9 @@ class BlackBerryHelper {
|
||||
var args = [ zipPath ];
|
||||
var params = "";
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
var password = project.certificate.password;
|
||||
var password = project.keystore.password;
|
||||
|
||||
if (password == null) {
|
||||
|
||||
@@ -126,11 +126,11 @@ class BlackBerryHelper {
|
||||
|
||||
args = args.concat ([ "--password", password, "--buildId", project.meta.buildNumber ]);
|
||||
|
||||
//params = "{\n\t\"blackberry-nativepackager\": {\n\t\t\"-keystore\": \"" + PathHelper.tryFullPath (project.certificate.path) + "\"\n\t}\n}";
|
||||
//params = "{\n\t\"blackberry-nativepackager\": {\n\t\t\"-keystore\": \"" + PathHelper.tryFullPath (project.keystore.path) + "\"\n\t}\n}";
|
||||
|
||||
try {
|
||||
|
||||
FileHelper.copyFile (PathHelper.tryFullPath (project.certificate.path), PathHelper.combine (project.environment.get ("BLACKBERRY_WEBWORKS_SDK"), "author.p12"));
|
||||
FileHelper.copyFile (PathHelper.tryFullPath (project.keystore.path), PathHelper.combine (project.environment.get ("BLACKBERRY_WEBWORKS_SDK"), "author.p12"));
|
||||
|
||||
} catch (e:Dynamic) {}
|
||||
|
||||
|
||||
@@ -338,15 +338,9 @@ class IOSHelper {
|
||||
|
||||
}
|
||||
|
||||
var identity = "iPhone Developer";
|
||||
var identity = project.config.getString ("ios.identity", "iPhone Developer");
|
||||
|
||||
if (project.certificate != null && project.certificate.identity != null) {
|
||||
|
||||
identity = project.certificate.identity;
|
||||
|
||||
}
|
||||
|
||||
var commands = [ "-s", identity ];
|
||||
var commands = [ "-s", identity, "CODE_SIGN_IDENTITY=" + identity ];
|
||||
|
||||
if (entitlementsPath != null) {
|
||||
|
||||
@@ -355,6 +349,12 @@ class IOSHelper {
|
||||
|
||||
}
|
||||
|
||||
if (project.config.exists ("ios.provisioning-profile")) {
|
||||
|
||||
commands.push ("PROVISIONING_PROFILE=" + project.config.getString ("ios.provisioning-profile"));
|
||||
|
||||
}
|
||||
|
||||
var applicationPath = "build/" + configuration + "-iphoneos/" + project.app.file + ".app";
|
||||
commands.push (applicationPath);
|
||||
|
||||
|
||||
@@ -338,15 +338,9 @@ class TVOSHelper {
|
||||
|
||||
}
|
||||
|
||||
var identity = "iPhone Developer";
|
||||
var identity = project.config.getString ("tvos.identity", "tvOS Developer");
|
||||
|
||||
if (project.certificate != null && project.certificate.identity != null) {
|
||||
|
||||
identity = project.certificate.identity;
|
||||
|
||||
}
|
||||
|
||||
var commands = [ "-s", identity ];
|
||||
var commands = [ "-s", identity, "CODE_SIGN_IDENTITY=" + identity ];
|
||||
|
||||
if (entitlementsPath != null) {
|
||||
|
||||
@@ -355,6 +349,12 @@ class TVOSHelper {
|
||||
|
||||
}
|
||||
|
||||
if (project.config.exists ("tvos.provisioning-profile")) {
|
||||
|
||||
commands.push ("PROVISIONING_PROFILE=" + project.config.getString ("ios.provisioning-profile"));
|
||||
|
||||
}
|
||||
|
||||
var applicationPath = "build/" + configuration + "-appletvos/" + project.app.file + ".app";
|
||||
commands.push (applicationPath);
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ class TizenHelper {
|
||||
var keystore = null;
|
||||
var password = null;
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
keystore = PathHelper.tryFullPath (project.certificate.path);
|
||||
password = project.certificate.password;
|
||||
keystore = PathHelper.tryFullPath (project.keystore.path);
|
||||
password = project.keystore.password;
|
||||
|
||||
if (password == null) {
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class AndroidPlatform extends PlatformTarget {
|
||||
|
||||
var build = "-debug";
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.keystore != null) {
|
||||
|
||||
build = "-release";
|
||||
|
||||
|
||||
@@ -106,12 +106,6 @@ class IOSPlatform extends PlatformTarget {
|
||||
project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe"));
|
||||
//project.dependencies.push ("stdc++");
|
||||
|
||||
if (project.certificate != null && project.certificate.identity == null) {
|
||||
|
||||
project.certificate.identity = "iPhone Developer";
|
||||
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists ("xml")) {
|
||||
|
||||
project.haxeflags.push ("-xml " + targetDirectory + "/types.xml");
|
||||
@@ -133,9 +127,9 @@ class IOSPlatform extends PlatformTarget {
|
||||
context.HAS_LAUNCH_IMAGE = false;
|
||||
context.OBJC_ARC = false;
|
||||
|
||||
if (project.certificate != null) {
|
||||
if (project.config.exists ("ios.team-id")) {
|
||||
|
||||
context.DEVELOPMENT_TEAM_ID = project.certificate.teamID;
|
||||
context.DEVELOPMENT_TEAM_ID = project.config.getString ("ios.team-id");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -106,13 +106,6 @@ class TVOSPlatform extends PlatformTarget {
|
||||
project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe"));
|
||||
//project.dependencies.push ("stdc++");
|
||||
|
||||
if (project.certificate == null || project.certificate.identity == null) {
|
||||
|
||||
project.certificate = new Keystore ();
|
||||
project.certificate.identity = "tvOS Developer";
|
||||
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists ("xml")) {
|
||||
|
||||
project.haxeflags.push ("-xml " + targetDirectory + "/types.xml");
|
||||
|
||||
@@ -1836,9 +1836,9 @@ class CommandLineTools {
|
||||
|
||||
} else if (StringTools.startsWith (field, "certificate-")) {
|
||||
|
||||
if (overrides.certificate == null) {
|
||||
if (overrides.keystore == null) {
|
||||
|
||||
overrides.certificate = new Keystore ();
|
||||
overrides.keystore = new Keystore ();
|
||||
|
||||
}
|
||||
|
||||
@@ -1846,9 +1846,21 @@ class CommandLineTools {
|
||||
|
||||
if (field == "alias-password") field = "aliasPassword";
|
||||
|
||||
if (Reflect.hasField (overrides.certificate, field)) {
|
||||
if (Reflect.hasField (overrides.keystore, field)) {
|
||||
|
||||
Reflect.setField (overrides.certificate, field, argValue);
|
||||
Reflect.setField (overrides.keystore, field, argValue);
|
||||
|
||||
}
|
||||
|
||||
if (field == "identity") {
|
||||
|
||||
overrides.config.set ("ios.identity", argValue);
|
||||
overrides.config.set ("tvos.identity", argValue);
|
||||
|
||||
} else if (field == "team-id") {
|
||||
|
||||
overrides.config.set ("ios.team-id", argValue);
|
||||
overrides.config.set ("tvos.team-id", argValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user