You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/01/10 20:43:49 UTC

[2/2] git commit: rejiggered to avoid extra bat files. RegReading is done in jscript

rejiggered to avoid extra bat files.  RegReading is done in jscript


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/6e9b38f2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/6e9b38f2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/6e9b38f2

Branch: refs/heads/master
Commit: 6e9b38f24ee8bfd9aad61d7bd3b6e70de17c2fc7
Parents: 64afa53
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jan 10 11:41:10 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jan 10 11:41:10 2014 -0800

----------------------------------------------------------------------
 wp7/bin/GetMSBuildToolsVersion.bat | 16 ----------------
 wp7/bin/check_reqs.js              | 17 ++++++++++++-----
 wp8/bin/GetMSBuildToolsVersion.bat | 16 ----------------
 wp8/bin/check_reqs.js              | 17 ++++++++++++-----
 4 files changed, 24 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/6e9b38f2/wp7/bin/GetMSBuildToolsVersion.bat
----------------------------------------------------------------------
diff --git a/wp7/bin/GetMSBuildToolsVersion.bat b/wp7/bin/GetMSBuildToolsVersion.bat
deleted file mode 100644
index bf22eb9..0000000
--- a/wp7/bin/GetMSBuildToolsVersion.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-
-@echo off
-
-SET REG_QUERY="HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildRuntimeVersion
-
-REG QUERY %REG_QUERY% > nul 2>&1
-if ERRORLEVEL 1 goto MissingMSBuildRegistry
-
-for /f "skip=2 tokens=2,*" %%A in ('REG QUERY %REG_QUERY%') do SET MSBUILDRTVERSION=%%B
-echo %MSBUILDRTVERSION%
-goto:eof
-
-:MissingMSBuildRegistry
-echo ERROR: Cannot obtain MSBuild version info from registry
-goto:eof
-

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/6e9b38f2/wp7/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/wp7/bin/check_reqs.js b/wp7/bin/check_reqs.js
index 3104a24..ba397e2 100644
--- a/wp7/bin/check_reqs.js
+++ b/wp7/bin/check_reqs.js
@@ -87,13 +87,20 @@ else {
  *  in the environment PATH variable.
  * - msbuild (ex. C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319)
  */
-    var cmd = 'GetMSBuildToolsVersion.bat';
-    var fail_msg = 'The command `msbuild` failed. Make sure you have the latest Windows Phone SDKs installed, AND have the latest .NET framework added to your path (i.e C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319).'
-    var output = check_command(cmd, fail_msg);
+    var version;
 
-    if(output.indexOf("4.0") != 0) {
+    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);
-        Log("Reported version is : " + output);
         WScript.Quit(1);
     }
 }

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/6e9b38f2/wp8/bin/GetMSBuildToolsVersion.bat
----------------------------------------------------------------------
diff --git a/wp8/bin/GetMSBuildToolsVersion.bat b/wp8/bin/GetMSBuildToolsVersion.bat
deleted file mode 100644
index bf22eb9..0000000
--- a/wp8/bin/GetMSBuildToolsVersion.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-
-@echo off
-
-SET REG_QUERY="HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildRuntimeVersion
-
-REG QUERY %REG_QUERY% > nul 2>&1
-if ERRORLEVEL 1 goto MissingMSBuildRegistry
-
-for /f "skip=2 tokens=2,*" %%A in ('REG QUERY %REG_QUERY%') do SET MSBUILDRTVERSION=%%B
-echo %MSBUILDRTVERSION%
-goto:eof
-
-:MissingMSBuildRegistry
-echo ERROR: Cannot obtain MSBuild version info from registry
-goto:eof
-

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/6e9b38f2/wp8/bin/check_reqs.js
----------------------------------------------------------------------
diff --git a/wp8/bin/check_reqs.js b/wp8/bin/check_reqs.js
index 3104a24..ba397e2 100644
--- a/wp8/bin/check_reqs.js
+++ b/wp8/bin/check_reqs.js
@@ -87,13 +87,20 @@ else {
  *  in the environment PATH variable.
  * - msbuild (ex. C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319)
  */
-    var cmd = 'GetMSBuildToolsVersion.bat';
-    var fail_msg = 'The command `msbuild` failed. Make sure you have the latest Windows Phone SDKs installed, AND have the latest .NET framework added to your path (i.e C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319).'
-    var output = check_command(cmd, fail_msg);
+    var version;
 
-    if(output.indexOf("4.0") != 0) {
+    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);
-        Log("Reported version is : " + output);
         WScript.Quit(1);
     }
 }