Commits

Lorenzo Petrone committed 67c18ab

Base

Comments (0)

Files changed (6)

+#!/usr/bin/php
+<?php
+require_once 'includes.php';
+
+xsys("mv ../bin/classes /tmp/classes-".time()) and diex("Error");
+#!/usr/bin/php
+<?php
+require_once 'includes.php';
+
+list($name,$COMPILE)=get_name_compile($argv);
+
+remove_osx_fuffas();
+
+if ($COMPILE) {
+	$CE=xsys('ant debug>/tmp/antdebug.out');
+	xsys('cat /tmp/antdebug.out| awk \'BEGIN { skip = 0 } /unmappable character for encoding ascii/ { skip = 3 } { if (skip > 0) { skip-- } else { print $0 } }\'');
+	$CE and diex("Compile error");
+}
+xsys("adb -e install -r bin/$name-debug.apk") and diex("Install error");
+diex("Installed debug on emulator");
+#!/usr/bin/php
+<?php
+require_once 'includes.php';
+
+$name=get_name($argv);
+xsys("adb -e logcat ResourceType:E KeyCharacterMap:E NotificationService:W $name:V *:I");
+#!/usr/bin/php
+<?php
+require_once 'includes.php';
+
+$name=get_name($argv);
+xsys("adb -d logcat ResourceType:E KeyCharacterMap:E NotificationService:W $name:V VboCube:F *:E");
+#!/usr/bin/php
+<?php
+require_once 'includes.php';
+
+list($name,$COMPILE)=get_name_compile($argv);
+
+remove_osx_fuffas();
+
+if ($COMPILE) {
+	$CE=xsys('ant release>/tmp/antrelease.out');
+	xsys('cat /tmp/antrelease.out| awk \'BEGIN { skip = 0 } /unmappable character for encoding ascii/ { skip = 3 } { if (skip > 0) { skip-- } else { print $0 } }\'');
+	$CE and diex("Compile error");
+	xsys("echo 'pitale'|jarsigner -verbose -keystore ~/.keytool/1005.keystore bin/$name-unsigned.apk 1005") and diex("Sign error");
+	xsys("zipalign -f -v 4 bin/$name-unsigned.apk bin/$name-release.apk") and diex("Align error");
+}
+xsys("adb -d install -r bin/$name-release.apk") and diex("Install error");
+diex("Installed release on phone");
+<?php
+
+function xsys ($command) {
+	$ret=NULL;
+	system($command,$ret);
+	return $ret;
+}
+function diex ($message) {
+	echo "\n§ $message\n";
+	die(1);
+}
+function endx ($message) {
+	echo "\n§ $message\n";
+	exit(0);
+}
+
+function get_name ($argv) {
+	return get_name_complex($argv,FALSE);
+}
+function get_name_compile ($argv) {
+	return get_name_complex($argv,TRUE);
+}
+function get_name_complex ($argv, $CHKCOM) {
+	$name=NULL;
+	$COMPILE=TRUE;
+	if ($argv[1]) {
+		$name=$argv[1];
+		if ($CHKCOM && ($name=="install")) {
+			$COMPILE=FALSE;
+			$name=NULL;
+		}
+	}
+	if ($name===NULL) {
+		$name=system("ls bin/|grep apk|cut -d\- -f1|head -n1") or diex("Could't get name");
+		$name=rtrim($name);
+	}
+	
+	if ($CHKCOM) {
+		return array($name,$COMPILE);
+	}
+	return $name;
+}
+
+function remove_osx_fuffas () {
+	xsys('find . -name .DS_Store -exec rm {} \;');
+	xsys('find . -name ._* -exec rm {} \;'); // TODO: non funziona
+}