OsmAnd/OsmAnd/build.gradle
Alexey Pelykh 87401b3f62 Fix
2014-12-18 09:13:56 +02:00

254 lines
6.7 KiB
Groovy

apply plugin: 'com.android.application'
//<target name="fix_apostrophe_issues">
//<replace token="version='1.0'" value="version=&quot;1.0&quot;" encoding="UTF-8">
//<fileset dir="res" includes="**/strings.xml" />
//</replace>
// <replace token="encoding='utf-8'" value="encoding=&quot;utf-8&quot;" encoding="UTF-8">
// <fileset dir="res" includes="**/strings.xml" />
//</replace>
//
// <replaceregexp match="([^\\])'" replace="\1\\\\'" flags="-g" byline="off" encoding="UTF-8">
// <fileset dir="res" includes="**/strings.xml" />
//</replaceregexp>
// </target>
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
signingConfigs {
development {
storeFile file("../keystores/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
publishing {
storeFile file("osmand_key")
storePassword System.getenv("PWD")
keyAlias "androiddebugkey"
keyPassword System.getenv("PWD")
}
}
defaultConfig {
minSdkVersion 9
targetSdkVersion 21
versionCode System.getenv("APK_NUMBER_VERSION") ?: versionCode
versionName System.getenv("APK_VERSION") ?: versionName
}
lintOptions {
lintConfig file("lint.xml")
abortOnError false
warningsAsErrors false
}
// This is from OsmAndCore_android.aar - for some reason it's not inherited
aaptOptions {
// Don't compress any embedded resources
noCompress "qz"
}
dexOptions {
jumboMode = true
}
sourceSets {
main {
manifest.srcFile "AndroidManifest.xml"
jni.srcDirs = []
jniLibs.srcDirs = ["libs"]
aidl.srcDirs = ["src"]
java.srcDirs = [
"src",
fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java"),
"resourcesSrc"
]
resources.srcDirs = [
"src",
"../OsmAnd-java/src",
"resourcesSrc"
]
renderscript.srcDirs = ["src"]
res.srcDirs = [
"res",
"../../resources/rendering_styles/style-icons/"
]
assets.srcDirs = [
"assets",
"voiceAssets",
"helpAssets"
]
}
}
flavorDimensions "version", "distribution", "abi"
productFlavors {
// ABI
x86 {
flavorDimension "abi"
ndk {
abiFilter "x86"
}
}
mips {
flavorDimension "abi"
ndk {
abiFilter "mips"
}
}
armv7 {
flavorDimension "abi"
ndk {
abiFilter "armeabi-v7a"
}
}
armv5 {
flavorDimension "abi"
ndk {
abiFilter "armeabi"
}
}
fat {
flavorDimension "abi"
}
// Version
free {
flavorDimension "version"
applicationId "net.osmand"
}
paid {
flavorDimension "version"
applicationId "net.osmand.plus"
}
/*
sherpafy {
flavorDimension "version"
applicationId "net.osmand.sherpafy"
}
*/
// Distribution
googleplay {
flavorDimension "distribution"
}
/*
amazon {
flavorDimension "distribution"
}
*/
}
buildTypes {
debug {
signingConfig signingConfigs.development
}
nativeDebug {
signingConfig signingConfigs.development
}
release {
signingConfig signingConfigs.publishing
}
}
}
task collectVoiceAssets(type: Sync) {
from "../../resources"
into "voiceAssets"
include "specialphrases/**"
include "voice/**/*.p"
}
task collectRoutingResources(type: Sync) {
from "../../resources/routing"
into "resourcesSrc/net/osmand/router"
include "*.xml"
}
task collectRenderingStyles(type: Sync) {
from "../../resources/rendering_styles"
into "resourcesSrc/net/osmand/render"
include "*.xml"
}
task collectRegionsInfo(type: Copy) {
from "../../resources/countries-info"
into "resourcesSrc/net/osmand/map"
include "regions.ocbf"
}
task collectHelpContents(type: Sync) {
from "../../help"
into "helpAssets/help"
include "*.html"
include "images/**/*.png"
}
task collectMiscResources(type: Copy) {
from("../../../resources/obf_creation") {
include "rendering_types.xml"
}
from("../../../resources/poi") {
include "poi_types.xml"
}
into "resourcesSrc/net/osmand/osm"
}
task collectExternalResources << {}
collectExternalResources.dependsOn collectVoiceAssets,
collectRoutingResources,
collectRenderingStyles,
collectRegionsInfo,
collectHelpContents,
collectMiscResources
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn << collectExternalResources
}
// Legacy core build
import org.apache.tools.ant.taskdefs.condition.Os
task buildOsmAndCore(type: Exec) {
description "Build Legacy OsmAndCore"
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine "bash", file("./old-ndk-build.sh").getAbsolutePath()
} else {
commandLine "cmd", "/c", "echo", "Not supported"
}
}
task cleanupDuplicatesInCore(type: Delete) {
dependsOn buildOsmAndCore
delete "libs/armeabi/libgnustl_shared.so"
delete "libs/armeabi-v7a/libgnustl_shared.so"
delete "libs/mips/libgnustl_shared.so"
delete "libs/x86/libgnustl_shared.so"
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn << [buildOsmAndCore, cleanupDuplicatesInCore]
}
repositories {
ivy {
name = "OsmAndBinariesIvy"
url = "http://builder.osmand.net:81"
layout "pattern" , {
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
}
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"], exclude: ["QtAndroid-bundled.jar", "QtAndroidAccessibility-bundled.jar"])
compile "com.actionbarsherlock:actionbarsherlock:4.4.0@aar"
compile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
debugCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
nativeDebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
releaseCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
}