cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject git commit: CB-4533 return error code 2 on fail, CB-5359 get tools version from the registry
Date Wed, 29 Jan 2014 00:32:46 GMT
Updated Branches:
  refs/heads/master ef4bbec0b -> 37ac53602


CB-4533 return error code 2 on fail, CB-5359 get tools version from the registry


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/37ac5360
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/37ac5360
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/37ac5360

Branch: refs/heads/master
Commit: 37ac5360266dc54f577ee8a27d5ea1af84e0bd17
Parents: ef4bbec
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Tue Jan 28 16:32:26 2014 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Jan 28 16:32:26 2014 -0800

----------------------------------------------------------------------
 windows8/bin/check_reqs.js | 53 ++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/37ac5360/windows8/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/windows8/bin/check_reqs.js b/windows8/bin/check_reqs.js
index 33e575b..fd0fd8c 100644
--- a/windows8/bin/check_reqs.js
+++ b/windows8/bin/check_reqs.js
@@ -21,12 +21,10 @@
 var args = WScript.Arguments;
 var wscript_shell = WScript.CreateObject("WScript.Shell");
 
-var REQUIRE_GIT = false;
-
 function Usage() {
     Log("Usage: [ check_reqs | cscript check_reqs.js ]");
     Log("examples:");
-    Log("    cscript C:\\Users\\anonymous\\cordova-wp8\\bin\\check_reqs.js");
+    Log("    cscript C:\\Users\\anonymous\\cordova-windows\\windows8\\bin\\check_reqs.js");
     Log("    CordovaWindowsPhone\\bin\\check_reqs");
 
 }
@@ -67,34 +65,6 @@ function check_command(cmd, fail_msg) {
     }
 }
 
-/* The tooling for cordova windows requires these commands
- *  in the environment PATH variable.
- * - msbuild (C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319)
- * - git? (for dynamic cli loading of projects?)
- * TODO: Check for SDK and whatnot.
- */
-function CheckSystem() {
-    var cmd = 'msbuild -version'
-    var fail_msg = 'The command `msbuild` failed. Make sure you have the latest Windows 8
SDKs installed, and the `msbuild.exe` command (inside C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319)
is added to your path.'
-    var output = check_command(cmd, fail_msg);
-    var msversion = output.match(/Microsoft\s\(R\)\s+Build\sEngine,?\s[a-z]+\s4\.0/i);
-    if (!msversion) {
-        Log('Please install the .NET Framwork v4.0.30319 (in the latest windows 8 SDK\'s).',
true);
-        Log('Make sure the "msbuild" command in your path is pointing to  v4.0.30319 of msbuild
as well (inside C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319).', true);
-        WScript.Quit(1);
-    }
-
-    if(REQUIRE_GIT) {
-        cmd = 'git --version';
-        fail_msg = 'The command `git` failed. Make sure you have git installed as well ad
in your PATH environment so the tool can use it';
-        output = check_command(cmd, fail_msg);
-        var gitVersion = output.match(/git\sversion\s1\./);
-        if (!gitVersion) {
-            Log('Please ensure you have at least git v1 installed and added to you PATH so
this tool can use it to get the latest codova.');
-        }
-    }
-}
-
 
 if (args.Count() > 0) {
     Usage();
@@ -102,6 +72,25 @@ if (args.Count() > 0) {
 }
 else
 {
-    CheckSystem();
+/* The tooling for cordova windows phone requires these commands
+ *  in the environment PATH variable.
+ * - msbuild (ex. C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319)
+ */
+    var version;
+
+    try {
+        version = wscript_shell.RegRead("HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0\\MSBuildRuntimeVersion");
+        if(version != null && version.indexOf("4.0") == 0) {
+            // All good!
+            Log(version);
+        }
+        else {
+            throw(new Error("version not 4.0"));
+        }
+    }
+    catch(err) {
+        Log('Please install the .NET Framework v4.0 (part of the latest windows phone SDK\'s).',
true);
+        WScript.Quit(2);
+    }
 }
 


Mime
View raw message