-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
16,411 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
haxelib run nme %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
haxelib run nme "$@" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-main CommandLineTools | ||
-neko run.n | ||
-cp src | ||
-lib nme | ||
-lib format | ||
-lib swf | ||
-lib svg | ||
-lib xfl | ||
--remap flash:nme | ||
--remap browser:native | ||
-D nme_ver=3.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<project name="pazu-tools" url="" license="MIT"> | ||
<user name="elyon"/> | ||
<description>Pazu (Tools)</description> | ||
<version name="1.0.0"></version> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
package helpers; | ||
|
||
|
||
import sys.FileSystem; | ||
|
||
|
||
class AIRHelper { | ||
|
||
|
||
private static var defines:Hash <String>; | ||
private static var target:String; | ||
private static var targetFlags:Hash <String>; | ||
|
||
|
||
public static function initialize (defines:Hash <String>, targetFlags:Hash <String>, target:String, NME:String):Void { | ||
|
||
AIRHelper.defines = defines; | ||
AIRHelper.targetFlags = targetFlags; | ||
AIRHelper.target = target; | ||
|
||
switch (target) { | ||
|
||
case "ios": | ||
|
||
IOSHelper.initialize (defines, targetFlags, NME); | ||
|
||
case "android": | ||
|
||
AndroidHelper.initialize (defines); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static function build (workingDirectory:String, targetPath:String, applicationXML:String, files:Array <String>, debug:Bool):Void { | ||
|
||
var airTarget = "air"; | ||
var extension = ".air"; | ||
|
||
if (target == "ios") { | ||
|
||
if (targetFlags.exists ("simulator")) { | ||
|
||
if (debug) { | ||
|
||
airTarget = "ipa-debug-interpreter-simulator"; | ||
|
||
} else { | ||
|
||
airTarget = "ipa-test-interpreter-simulator"; | ||
|
||
} | ||
|
||
} else { | ||
|
||
if (debug) { | ||
|
||
airTarget = "ipa-debug"; | ||
|
||
} else { | ||
|
||
airTarget = "ipa-test"; | ||
|
||
} | ||
|
||
} | ||
|
||
extension = ".ipa"; | ||
|
||
} else if (target == "android") { | ||
|
||
if (debug) { | ||
|
||
airTarget = "apk-debug"; | ||
|
||
} else { | ||
|
||
airTarget = "apk"; | ||
|
||
} | ||
|
||
extension = ".apk"; | ||
|
||
} | ||
|
||
var signingOptions = [ "-storetype", defines.get ("KEY_STORE_TYPE"), "-keystore", defines.get ("KEY_STORE") ]; | ||
|
||
if (defines.exists ("KEY_STORE_ALIAS")) { | ||
|
||
signingOptions.push ("-alias"); | ||
signingOptions.push (defines.get ("KEY_STORE_ALIAS")); | ||
|
||
} | ||
|
||
if (defines.exists ("KEY_STORE_PASSWORD")) { | ||
|
||
signingOptions.push ("-storepass"); | ||
signingOptions.push (defines.get ("KEY_STORE_PASSWORD")); | ||
|
||
} | ||
|
||
if (defines.exists ("KEY_STORE_ALIAS_PASSWORD")) { | ||
|
||
signingOptions.push ("-keypass"); | ||
signingOptions.push (defines.get ("KEY_STORE_ALIAS_PASSWORD")); | ||
|
||
} | ||
|
||
var args = [ "-package" ]; | ||
|
||
if (airTarget == "air") { | ||
|
||
args = args.concat (signingOptions); | ||
args.push ("-target"); | ||
args.push ("air"); | ||
|
||
} else { | ||
|
||
args.push ("-target"); | ||
args.push (airTarget); | ||
args = args.concat (signingOptions); | ||
|
||
} | ||
|
||
if (target == "ios") { | ||
|
||
args.push ("-provisioning-profile"); | ||
args.push (IOSHelper.getProvisioningFile ()); | ||
|
||
} | ||
|
||
args = args.concat ([ targetPath, applicationXML ]); | ||
|
||
|
||
if (target == "ios") { | ||
|
||
args.push ("-platformsdk"); | ||
args.push (IOSHelper.getSDKDirectory ()); | ||
|
||
} | ||
|
||
args = args.concat (files); | ||
//args = args.concat ([ sourcePath /*, "icon_16.png", "icon_32.png", "icon_48.png", "icon_128.png"*/ ]); | ||
|
||
ProcessHelper.runCommand (workingDirectory, defines.get ("AIR_SDK") + "/bin/adt", args); | ||
|
||
} | ||
|
||
|
||
public static function run (workingDirectory:String, debug:Bool):Void { | ||
|
||
if (target == "android") { | ||
|
||
AndroidHelper.install (FileSystem.fullPath (workingDirectory) + "/" + defines.get ("APP_FILE") + ".apk"); | ||
AndroidHelper.run ("air." + defines.get ("APP_PACKAGE") + "/.AppEntry"); | ||
|
||
} else if (target == "ios") { | ||
|
||
var args = [ "-platform", "ios" ]; | ||
|
||
if (targetFlags.exists ("simulator")) { | ||
|
||
args.push ("-device"); | ||
args.push ("ios-simulator"); | ||
args.push ("-platformsdk"); | ||
args.push (IOSHelper.getSDKDirectory ()); | ||
|
||
ProcessHelper.runCommand ("", "killall", [ "iPhone Simulator" ], true, true); | ||
|
||
} | ||
|
||
ProcessHelper.runCommand (workingDirectory, defines.get ("AIR_SDK") + "/bin/adt", [ "-uninstallApp" ].concat (args).concat ([ "-appid", defines.get ("APP_PACKAGE") ])); | ||
ProcessHelper.runCommand (workingDirectory, defines.get ("AIR_SDK") + "/bin/adt", [ "-installApp" ].concat (args).concat ([ "-package", FileSystem.fullPath (workingDirectory) + "/" + defines.get ("APP_FILE") + ".ipa" ])); | ||
|
||
if (targetFlags.exists ("simulator")) { | ||
|
||
ProcessHelper.runCommand ("", "open", [ "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/" ]); | ||
|
||
} | ||
|
||
} else { | ||
|
||
var args = [ "-profile", "desktop" ]; | ||
|
||
if (!debug) { | ||
|
||
args.push ("-nodebug"); | ||
|
||
} | ||
|
||
args.push ("application.xml"); | ||
|
||
ProcessHelper.runCommand (workingDirectory, defines.get ("AIR_SDK") + "/bin/adl", args); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
package helpers; | ||
|
||
|
||
import helpers.LogHelper; | ||
import helpers.ProcessHelper; | ||
import project.NMEProject; | ||
import project.Platform; | ||
import sys.FileSystem; | ||
|
||
|
||
class AndroidHelper { | ||
|
||
|
||
private static var adbName:String; | ||
private static var adbPath:String; | ||
|
||
|
||
public static function build (project:NMEProject, projectDirectory:String):Void { | ||
|
||
if (project.environment.exists ("ANDROID_SDK")) { | ||
|
||
Sys.putEnv ("ANDROID_SDK", project.environment.get ("ANDROID_SDK")); | ||
|
||
} | ||
|
||
var ant = project.environment.get ("ANT_HOME"); | ||
|
||
if (ant == null || ant == "") { | ||
|
||
ant = "ant"; | ||
|
||
} else { | ||
|
||
ant += "/bin/ant"; | ||
|
||
} | ||
|
||
var build = "debug"; | ||
|
||
if (project.certificate != null) { | ||
|
||
build = "release"; | ||
|
||
} | ||
|
||
// Fix bug in Android build system, force compile | ||
|
||
var buildProperties = projectDirectory + "/bin/build.prop"; | ||
|
||
if (FileSystem.exists (buildProperties)) { | ||
|
||
FileSystem.deleteFile (buildProperties); | ||
|
||
} | ||
|
||
ProcessHelper.runCommand (projectDirectory, ant, [ build ]); | ||
|
||
} | ||
|
||
|
||
private static function getADB (project:NMEProject):Void { | ||
|
||
adbPath = project.environment.get ("ANDROID_SDK") + "/tools/"; | ||
adbName = "adb"; | ||
|
||
if (PlatformHelper.hostPlatform == Platform.WINDOWS) { | ||
|
||
adbName += ".exe"; | ||
|
||
} | ||
|
||
if (!FileSystem.exists (adbPath + adbName)) { | ||
|
||
adbPath = project.environment.get ("ANDROID_SDK") + "/platform-tools/"; | ||
|
||
} | ||
|
||
if (PlatformHelper.hostPlatform != Platform.WINDOWS) { | ||
|
||
adbName = "./" + adbName; | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static function initialize (project:NMEProject):Void { | ||
|
||
getADB (project); | ||
|
||
if (project.environment.exists ("JAVA_HOME")) { | ||
|
||
Sys.putEnv ("JAVA_HOME", project.environment.get ("JAVA_HOME")); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static function install (targetPath:String):Void { | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "install", "-r", targetPath ]); | ||
|
||
} | ||
|
||
|
||
public static function run (activityName:String):Void { | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "shell", "am", "start", "-a", "android.intent.action.MAIN", "-n", activityName ]); | ||
|
||
} | ||
|
||
|
||
public static function trace (project:NMEProject, debug:Bool):Void { | ||
|
||
// Use -DFULL_LOGCAT or <set name="FULL_LOGCAT" /> if you do not want to filter log messages | ||
|
||
if (project.environment.exists("FULL_LOGCAT") || LogHelper.verbose) { | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "logcat", "-c" ]); | ||
ProcessHelper.runCommand (adbPath, adbName, [ "logcat" ]); | ||
|
||
} else if (debug) { | ||
|
||
var filter = "*:E"; | ||
var includeTags = [ "NME", "Main", "GameActivity", "GLThread", "trace" ]; | ||
|
||
for (tag in includeTags) { | ||
|
||
filter += " " + tag + ":D"; | ||
|
||
} | ||
|
||
Sys.println (filter); | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "logcat", filter ]); | ||
|
||
} else { | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "logcat", "*:S trace:I" ]); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static function uninstall (packageName:String):Void { | ||
|
||
ProcessHelper.runCommand (adbPath, adbName, [ "uninstall", packageName ]); | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.