mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:42:53 +08:00
8aa813b862
These scripts will build an android project, in debug and release mode. They also support additional library projects, such as Crosswalk, being added to libraries.gradle (and settings.gradle). A flag can be set in libraries.gradle to enable multi-architecture builds.
82 lines
1.8 KiB
Groovy
82 lines
1.8 KiB
Groovy
import java.util.regex.Pattern
|
|
|
|
apply plugin: 'android'
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:0.10.+'
|
|
}
|
|
}
|
|
|
|
ext.multiarch=false
|
|
|
|
dependencies {
|
|
compile project(':CordovaLib')
|
|
}
|
|
apply from: 'libraries.gradle'
|
|
|
|
android {
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
}
|
|
|
|
defaultConfig {
|
|
versionCode Integer.parseInt("" + getVersionCodeFromManifest() + "0")
|
|
}
|
|
|
|
compileSdkVersion 19
|
|
buildToolsVersion "19.0.0"
|
|
|
|
if (multiarch) {
|
|
productFlavors {
|
|
armv7 {
|
|
versionCode defaultConfig.versionCode + 2
|
|
ndk {
|
|
abiFilters "armeabi-v7a", ""
|
|
}
|
|
}
|
|
x86 {
|
|
versionCode defaultConfig.versionCode + 4
|
|
ndk {
|
|
abiFilters "x86", ""
|
|
}
|
|
}
|
|
all {
|
|
ndk {
|
|
abiFilters "all", ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
}
|
|
|
|
}
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '1.12'
|
|
}
|
|
|
|
def getVersionCodeFromManifest() {
|
|
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
|
|
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
|
|
def matcher = pattern.matcher(manifestFile.getText())
|
|
matcher.find()
|
|
return Integer.parseInt(matcher.group(1))
|
|
}
|