Skip to content

Commit

Permalink
Added tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Mar 19, 2013
1 parent 87be0e6 commit 7847bda
Show file tree
Hide file tree
Showing 81 changed files with 16,411 additions and 0 deletions.
Binary file added bin/ReplaceVistaIcon.exe
Binary file not shown.
Binary file added bin/compiler.jar
Binary file not shown.
Binary file added bin/debug.keystore
Binary file not shown.
Binary file added bin/debug.p12
Binary file not shown.
Binary file added bin/fruitstrap
Binary file not shown.
Binary file added bin/ios-sim
Binary file not shown.
2 changes: 2 additions & 0 deletions bin/nme.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
haxelib run nme %*
2 changes: 2 additions & 0 deletions bin/nme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
haxelib run nme "$@"
Binary file added bin/yuicompressor-2.4.7.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions build.hxml
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
5 changes: 5 additions & 0 deletions haxelib.xml
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>
201 changes: 201 additions & 0 deletions helpers/AIRHelper.hx
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);

}

}


}
154 changes: 154 additions & 0 deletions helpers/AndroidHelper.hx
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 ]);

}


}
Loading

0 comments on commit 7847bda

Please sign in to comment.