incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/3] android commit: fixing windows appinfo.jar
Date Tue, 18 Sep 2012 21:45:26 GMT
fixing windows appinfo.jar


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/45d7c124
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/45d7c124
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/45d7c124

Branch: refs/heads/master
Commit: 45d7c124c83b03aed8d81877836c1f74b38eaad3
Parents: d859bb8
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Tue Sep 18 14:11:22 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Tue Sep 18 14:11:22 2012 -0700

----------------------------------------------------------------------
 bin/create.bat |    2 +-
 bin/create.js  |   24 ++++++++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/45d7c124/bin/create.bat
----------------------------------------------------------------------
diff --git a/bin/create.bat b/bin/create.bat
index 2987dc5..35fdc3b 100644
--- a/bin/create.bat
+++ b/bin/create.bat
@@ -17,7 +17,7 @@
 
 @ECHO OFF
 IF NOT DEFINED JAVA_HOME GOTO MISSING
-FOR %%X in (java.exe ant.bat android.bat) do (
+FOR %%X in (java.exe javac.exe ant.bat android.bat) do (
     SET FOUND=%%~$PATH:X
     IF NOT DEFINED FOUND GOTO MISSING
 )

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/45d7c124/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index e95250a..48364ed 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -49,14 +49,24 @@ function replaceInFile(filename, regexp, replacement) {
 function exec(command) {
     var oShell=shell.Exec(command);
     while (oShell.Status == 0) {
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            // XXX: Change to verbose mode 
+            WScript.StdOut.WriteLine(line);
+        }
         WScript.sleep(100);
     }
 }
 
 function createAppInfoJar() {
-    exec("cd "+ROOT+"bin\\templates\\cordova");
-    exec("javac bin\\templates\\cordova\\ApplicationInfo\\ApplicationInfo.java");
-    exec("jar -cfe ..\\appinfo.jar ApplicationInfo ApplicationInfo.class");
+    if(!fso.FileExists(ROOT+"\\bin\\templates\\cordova\\appinfo.jar")) {
+        WScript.Echo("Creating appinfo.jar...");
+        var cur = shell.CurrentDirectory;
+        shell.CurrentDirectory = ROOT+"\\bin\\templates\\cordova\\ApplicationInfo";
+        exec("javac ApplicationInfo.java");
+        exec("jar -cfe ..\\appinfo.jar ApplicationInfo ApplicationInfo.class");
+        shell.CurrentDirectory = cur;
+    }
 }
 
 function cleanup() {
@@ -119,7 +129,6 @@ var args = WScript.Arguments, PROJECT_PATH="example",
     
 // working dir
 var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
-WScript.echo("Root Directory:" + ROOT);
 
 if (args.Count() == 3) {
     PROJECT_PATH=args(0);
@@ -138,11 +147,13 @@ var MANIFEST_PATH=PROJECT_PATH+'\\AndroidManifest.xml';
 var TARGET=setTarget();
 var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
 // create the project
+WScript.Echo("Creating new android project...");
 exec('android.bat create project --target '+TARGET+' --path '+PROJECT_PATH+' --package '+PACKAGE+'
--activity '+ACTIVITY);
 
 // build from source. distro should have these files
 if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
     !fso.FileExists(ROOT+'\\cordova-'+VERSION+'.js')) {
+    WScript.Echo("Building jar and js files...");
     // update the cordova framework project to a target that exists on this machine
     exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework');
     // pull down commons codec if necessary
@@ -151,12 +162,14 @@ if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
 }
 
 // copy in the project template
+WScript.Echo("Copying template files...");
 exec('%comspec% /c xcopy '+ ROOT + '\\bin\\templates\\project\\res '+PROJECT_PATH+'\\res\\
/E /Y');
 exec('%comspec% /c xcopy '+ ROOT + '\\bin\\templates\\project\\assets '+PROJECT_PATH+'\\assets\\
/E /Y');
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\project\\AndroidManifest.xml ' + PROJECT_PATH
+ '\\AndroidManifest.xml /Y');
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH
+' /Y');
 
 // check if we have the source or the distro files
+WScript.Echo("Copying js, jar & config.xml files...");
 if(fso.FolderExists(ROOT + '\\framework')) {
     exec('%comspec% /c copy '+ROOT+'\\framework\\assets\\www\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js
/Y');
     exec('%comspec% /c copy '+ROOT+'\\framework\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar
/Y');
@@ -174,6 +187,8 @@ if(fso.FolderExists(ROOT + '\\framework')) {
 
 // copy cordova scripts
 fso.CreateFolder(PROJECT_PATH + '\\cordova');
+createAppInfoJar();
+WScript.Echo("Copying cordova command tools...");
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH +
'\\cordova\\appinfo.jar /Y');
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\cordova.js ' + PROJECT_PATH +
'\\cordova\\cordova.js /Y');
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH +
'\\cordova\\cordova.bat /Y');
@@ -184,6 +199,7 @@ exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\emulate.bat
' + PROJE
 exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\BOOM.bat ' + PROJECT_PATH + '\\cordova\\BOOM.bat
/Y');
 
 // interpolate the activity name and package
+WScript.Echo("Updating AndroidManifest.xml and Main Activity...");
 replaceInFile(ACTIVITY_PATH, /__ACTIVITY__/, ACTIVITY);
 replaceInFile(ACTIVITY_PATH, /__ID__/, PACKAGE);
 


Mime
View raw message