mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
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`.
This commit is contained in:
parent
af60f71ea3
commit
893c0e9b67
23
bin/templates/cordova/lib/build.js
vendored
23
bin/templates/cordova/lib/build.js
vendored
@ -177,20 +177,16 @@ var builders = {
|
|||||||
},
|
},
|
||||||
gradle: {
|
gradle: {
|
||||||
getArgs: function(cmd, arch, extraArgs) {
|
getArgs: function(cmd, arch, extraArgs) {
|
||||||
if (arch == 'arm' && cmd == 'debug') {
|
if (cmd == 'release') {
|
||||||
cmd = 'assembleArmv7Debug';
|
cmd = 'cdvBuildRelease';
|
||||||
} else if (arch == 'arm' && cmd == 'release') {
|
|
||||||
cmd = 'assembleArmv7Release';
|
|
||||||
} else if (arch == 'x86' && cmd == 'debug') {
|
|
||||||
cmd = 'assembleX86Debug';
|
|
||||||
} else if (arch == 'x86' && cmd == 'release') {
|
|
||||||
cmd = 'assembleX86Release';
|
|
||||||
} else if (cmd == 'debug') {
|
} else if (cmd == 'debug') {
|
||||||
cmd = 'assembleDebug';
|
cmd = 'cdvBuildDebug';
|
||||||
} else if (cmd == 'release') {
|
|
||||||
cmd = 'assembleRelease';
|
|
||||||
}
|
}
|
||||||
var args = [cmd, '-b', path.join(ROOT, 'build.gradle')];
|
var args = [cmd, '-b', path.join(ROOT, 'build.gradle')];
|
||||||
|
if (arch) {
|
||||||
|
args.push('-PcdvBuildArch=' + arch);
|
||||||
|
}
|
||||||
|
|
||||||
// 10 seconds -> 6 seconds
|
// 10 seconds -> 6 seconds
|
||||||
args.push('-Dorg.gradle.daemon=true');
|
args.push('-Dorg.gradle.daemon=true');
|
||||||
args.push.apply(args, extraArgs);
|
args.push.apply(args, extraArgs);
|
||||||
@ -361,10 +357,7 @@ function parseOpts(options, resolvedTarget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var multiApk = ret.buildMethod == 'gradle' && process.env['BUILD_MULTIPLE_APKS'];
|
ret.arch = resolvedTarget && resolvedTarget.arch;
|
||||||
if (multiApk && !/0|false|no/i.exec(multiApk)) {
|
|
||||||
ret.arch = resolvedTarget && resolvedTarget.arch;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,10 @@ ext {
|
|||||||
if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
|
if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
|
||||||
cdvDebugSigningPropertiesFile = null
|
cdvDebugSigningPropertiesFile = null
|
||||||
}
|
}
|
||||||
|
// Set by build.js script.
|
||||||
|
if (!project.hasProperty('cdvBuildArch')) {
|
||||||
|
cdvBuildArch = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def hasBuildExtras = file('build-extras.gradle').exists()
|
def hasBuildExtras = file('build-extras.gradle').exists()
|
||||||
@ -93,6 +97,26 @@ if (hasBuildExtras) {
|
|||||||
apply from: 'build-extras.gradle'
|
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 START
|
||||||
// PLUGIN GRADLE EXTENSIONS END
|
// PLUGIN GRADLE EXTENSIONS END
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user