From d83002cd64f422e8a10b1a67c6309a8ee88fc3a2 Mon Sep 17 00:00:00 2001 From: Justin SB Date: Tue, 7 Oct 2014 14:15:42 -0700 Subject: [PATCH] We need a JDK, not a JVM For jarsigner, needed to sign an app for the Play Store --- tools/commands-cordova.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tools/commands-cordova.js b/tools/commands-cordova.js index 6f5842fba4..6e054d3788 100644 --- a/tools/commands-cordova.js +++ b/tools/commands-cordova.js @@ -1107,7 +1107,7 @@ var checkAgreePlatformTerms = function (platform, name) { }; var checkPlatformRequirements = function (platform, options) { - options = _.extend({fix: false, log: false}, options); + options = _.extend({log: false, fix: false, fixConsole: false}, options); if (platform == 'android') { return Android.checkRequirements(options); } else if (platform == 'ios') { @@ -1893,6 +1893,16 @@ _.extend(Android.prototype, { } }, + hasJdk: function () { + var self = this; + + if (Host.isMac()) { + return files.statOrNull('/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK') != null; + } else { + return !!Host.which('jarsigner'); + } + }, + installJava: function () { var self = this; @@ -1944,6 +1954,12 @@ _.extend(Android.prototype, { throw new Error("Cannot automatically install Java on host: " + Host.getName()); }, + installJdk: function () { + var self = this; + + throw new Error("Cannot automatically install JDK on host: " + Host.getName()); + }, + hasAndroidBundle: function () { var self = this; @@ -2038,13 +2054,13 @@ _.extend(Android.prototype, { var result = { acceptable: true, missing: [] }; - if (self.hasJava()) { - log && Console.info(Console.success("Java is installed")); + if (self.hasJdk()) { + log && Console.info(Console.success("A JDK is installed")); } else { - log && Console.info(Console.fail("Java is not installed")); + log && Console.info(Console.fail("A JDK is not installed")); if (fix) { - self.installJava(); + self.installJdk(); } else { result.missing.push("jdk"); result.acceptable = false;