mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
OK, Going back to the old build.gradle for legacy projects
This commit is contained in:
parent
b67e9905bc
commit
40c9709445
@ -25,8 +25,12 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Switch the Android Gradle plugin version requirement depending on the
|
||||||
|
// installed version of Gradle. This dependency is documented at
|
||||||
|
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
|
||||||
|
// and https://issues.apache.org/jira/browse/CB-8143
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +43,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = '3.3.0'
|
gradleVersion = '2.14.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
||||||
@ -94,11 +98,9 @@ if (hasBuildExtras) {
|
|||||||
// Set property defaults after extension .gradle files.
|
// Set property defaults after extension .gradle files.
|
||||||
if (ext.cdvCompileSdkVersion == null) {
|
if (ext.cdvCompileSdkVersion == null) {
|
||||||
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
|
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
|
||||||
//ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion
|
|
||||||
}
|
}
|
||||||
if (ext.cdvBuildToolsVersion == null) {
|
if (ext.cdvBuildToolsVersion == null) {
|
||||||
ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
|
ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
|
||||||
//ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
|
|
||||||
}
|
}
|
||||||
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) {
|
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) {
|
||||||
ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties'
|
ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties'
|
||||||
@ -109,7 +111,7 @@ if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.propert
|
|||||||
|
|
||||||
// Cast to appropriate types.
|
// Cast to appropriate types.
|
||||||
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
|
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
|
||||||
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : defaultMinSdkVersion
|
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion)
|
||||||
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
|
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
|
||||||
|
|
||||||
def computeBuildTargetName(debugBuild) {
|
def computeBuildTargetName(debugBuild) {
|
||||||
@ -148,9 +150,7 @@ task cdvPrintProps << {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
sourceSets {
|
||||||
//Define a sourceset only if we have a top level AndroidManifest.xml file
|
|
||||||
sourcesets {
|
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
java.srcDirs = ['src']
|
java.srcDirs = ['src']
|
||||||
@ -179,11 +179,6 @@ android {
|
|||||||
compileSdkVersion cdvCompileSdkVersion
|
compileSdkVersion cdvCompileSdkVersion
|
||||||
buildToolsVersion cdvBuildToolsVersion
|
buildToolsVersion cdvBuildToolsVersion
|
||||||
|
|
||||||
//This code exists for Crosswalk and other Native APIs.
|
|
||||||
//By default, we multiply the existing version code in the Android Manifest by 10 and
|
|
||||||
//add a number for each architecture. If you are not using Crosswalk or SQLite, you can
|
|
||||||
//ignore this chunk of code, and your version codes will be respected.
|
|
||||||
|
|
||||||
if (Boolean.valueOf(cdvBuildMultipleApks)) {
|
if (Boolean.valueOf(cdvBuildMultipleApks)) {
|
||||||
productFlavors {
|
productFlavors {
|
||||||
armv7 {
|
armv7 {
|
||||||
@ -205,6 +200,22 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
|
ELSE NOTHING! DON'T MESS WITH THE VERSION CODE IF YOU DON'T HAVE TO!
|
||||||
|
|
||||||
|
else if (!cdvVersionCode) {
|
||||||
|
def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
|
||||||
|
// Vary versionCode by the two most common API levels:
|
||||||
|
// 14 is ICS, which is the lowest API level for many apps.
|
||||||
|
// 20 is Lollipop, which is the lowest API level for the updatable system webview.
|
||||||
|
if (minSdkVersion >= 20) {
|
||||||
|
defaultConfig.versionCode += 9
|
||||||
|
} else if (minSdkVersion >= 14) {
|
||||||
|
defaultConfig.versionCode += 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_6
|
sourceCompatibility JavaVersion.VERSION_1_6
|
||||||
@ -233,18 +244,9 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: Cordova Lib and platform scripts do management inside of this code here,
|
|
||||||
* if you are adding the dependencies manually, do so outside the comments, otherwise
|
|
||||||
* the Cordova tools will overwrite them
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: '*.jar')
|
compile fileTree(dir: 'libs', include: '*.jar')
|
||||||
// SUB-PROJECT DEPENDENCIES START
|
// SUB-PROJECT DEPENDENCIES START
|
||||||
debugCompile(project(path: ":CordovaLib", configuration: "debug"))
|
|
||||||
releaseCompile(project(path: ":CordovaLib", configuration: "release"))
|
|
||||||
// SUB-PROJECT DEPENDENCIES END
|
// SUB-PROJECT DEPENDENCIES END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user