Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC601175FF for ; Tue, 20 Jan 2015 03:02:48 +0000 (UTC) Received: (qmail 14218 invoked by uid 500); 20 Jan 2015 03:02:50 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 14104 invoked by uid 500); 20 Jan 2015 03:02:50 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 13777 invoked by uid 99); 20 Jan 2015 03:02:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jan 2015 03:02:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6BE60E03A8; Tue, 20 Jan 2015 03:02:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Date: Tue, 20 Jan 2015 03:02:53 -0000 Message-Id: <3d21f4c703474cbeb54ed0c000ab8c1b@git.apache.org> In-Reply-To: <9910f69b7276445e8a3792843922a891@git.apache.org> References: <9910f69b7276445e8a3792843922a891@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [6/7] android commit: CB-8255 Pass `arch` to gradle regardless of `cdvBuildMultipleApks` CB-8255 Pass `arch` to gradle regardless of `cdvBuildMultipleApks` This also pushes the "which target to build" logic into gradle, since build.js doesn't actually know the value of `cdvBuildMultipleApks`. Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/893c0e9b Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/893c0e9b Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/893c0e9b Branch: refs/heads/master Commit: 893c0e9b6701762596d7bb1305af99070a0c12af Parents: af60f71 Author: Andrew Grieve Authored: Mon Jan 19 21:56:46 2015 -0500 Committer: Andrew Grieve Committed: Mon Jan 19 21:56:46 2015 -0500 ---------------------------------------------------------------------- bin/templates/cordova/lib/build.js | 23 ++++++++--------------- bin/templates/project/build.gradle | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/893c0e9b/bin/templates/cordova/lib/build.js ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index f2d60ae..e441caa 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -177,20 +177,16 @@ var builders = { }, gradle: { getArgs: function(cmd, arch, extraArgs) { - if (arch == 'arm' && cmd == 'debug') { - cmd = 'assembleArmv7Debug'; - } else if (arch == 'arm' && cmd == 'release') { - cmd = 'assembleArmv7Release'; - } else if (arch == 'x86' && cmd == 'debug') { - cmd = 'assembleX86Debug'; - } else if (arch == 'x86' && cmd == 'release') { - cmd = 'assembleX86Release'; + if (cmd == 'release') { + cmd = 'cdvBuildRelease'; } else if (cmd == 'debug') { - cmd = 'assembleDebug'; - } else if (cmd == 'release') { - cmd = 'assembleRelease'; + cmd = 'cdvBuildDebug'; } var args = [cmd, '-b', path.join(ROOT, 'build.gradle')]; + if (arch) { + args.push('-PcdvBuildArch=' + arch); + } + // 10 seconds -> 6 seconds args.push('-Dorg.gradle.daemon=true'); args.push.apply(args, extraArgs); @@ -361,10 +357,7 @@ function parseOpts(options, resolvedTarget) { } } - var multiApk = ret.buildMethod == 'gradle' && process.env['BUILD_MULTIPLE_APKS']; - if (multiApk && !/0|false|no/i.exec(multiApk)) { - ret.arch = resolvedTarget && resolvedTarget.arch; - } + ret.arch = resolvedTarget && resolvedTarget.arch; return ret; } http://git-wip-us.apache.org/repos/asf/cordova-android/blob/893c0e9b/bin/templates/project/build.gradle ---------------------------------------------------------------------- diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle index adbee75..9b7f8dc 100644 --- a/bin/templates/project/build.gradle +++ b/bin/templates/project/build.gradle @@ -86,6 +86,10 @@ ext { if (!project.hasProperty('cdvDebugSigningPropertiesFile')) { cdvDebugSigningPropertiesFile = null } + // Set by build.js script. + if (!project.hasProperty('cdvBuildArch')) { + cdvBuildArch = null + } } def hasBuildExtras = file('build-extras.gradle').exists() @@ -93,6 +97,26 @@ if (hasBuildExtras) { apply from: 'build-extras.gradle' } +def computeBuildTargetName(debugBuild) { + def ret = 'assemble' + if (cdvBuildMultipleApks && cdvBuildArch) { + def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch + ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1); + } + return ret + (debugBuild ? 'Debug' : 'Release') +} + +// Make cdvBuild a task that depends on the debug/arch-sepecific task. +task cdvBuildDebug +cdvBuildDebug.dependsOn { + return computeBuildTargetName(true) +} + +task cdvBuildRelease +cdvBuildRelease.dependsOn { + return computeBuildTargetName(false) +} + // PLUGIN GRADLE EXTENSIONS START // PLUGIN GRADLE EXTENSIONS END --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org