2014-12-16 12:23:45 +01:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2015-04-23 17:26:29 +02:00
|
|
|
// Global Parameters accepted
|
2015-01-21 23:32:16 +01:00
|
|
|
// APK_NUMBER_VERSION - version number of apk
|
2015-01-27 00:25:40 +01:00
|
|
|
// APK_VERSION - build number like #9999Z, for dev builds appended to app_version like 2.0.0 in no_translate.xml)
|
|
|
|
// flavor Z : M=-master, D=-design, B=-Blackberry, MD=-main-default, MQA=-main-qt-arm, MQDA=-main-qt-default-arm, S=-sherpafy
|
2015-01-27 00:03:55 +01:00
|
|
|
// TARGET_APP_NAME - app name
|
2015-01-27 00:25:40 +01:00
|
|
|
// APP_EDITION - date stamp of builds
|
2015-01-21 23:32:16 +01:00
|
|
|
// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
|
|
|
|
|
2015-04-24 23:20:54 +02:00
|
|
|
// 1. To be done Filter fonts
|
2015-01-21 00:51:32 +01:00
|
|
|
// <unzip src="OsmAndCore_android.aar" dest=".">
|
|
|
|
// <patternset>
|
|
|
|
// <include name="assets/**/map/fonts/OpenSans/*"/>
|
|
|
|
// <include name="assets/**/map/fonts/NotoSans/*"/>
|
|
|
|
// </patternset>
|
|
|
|
// </unzip>
|
2015-01-23 13:32:07 +01:00
|
|
|
// Less important
|
2015-01-21 00:51:32 +01:00
|
|
|
|
2014-12-16 12:23:45 +01:00
|
|
|
android {
|
2015-01-28 10:58:19 +01:00
|
|
|
compileSdkVersion 21
|
2015-09-09 18:22:47 +02:00
|
|
|
buildToolsVersion "23.0.1"
|
2015-01-28 10:58:19 +01:00
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
development {
|
|
|
|
storeFile file("../keystores/debug.keystore")
|
|
|
|
storePassword "android"
|
|
|
|
keyAlias "androiddebugkey"
|
|
|
|
keyPassword "android"
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
2015-04-23 17:39:46 +02:00
|
|
|
storeFile file("/var/lib/jenkins/osmand_key")
|
2015-02-01 11:56:19 +01:00
|
|
|
storePassword System.getenv("OSMAND_APK_PASSWORD")
|
2015-04-23 17:26:29 +02:00
|
|
|
keyAlias "osmand"
|
2015-02-01 11:56:19 +01:00
|
|
|
keyPassword System.getenv("OSMAND_APK_PASSWORD")
|
2015-01-28 10:58:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultConfig {
|
2015-08-29 23:21:42 +02:00
|
|
|
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 14
|
2015-01-28 10:58:19 +01:00
|
|
|
targetSdkVersion 21
|
|
|
|
|
|
|
|
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
|
|
|
//versionName already assigned in code
|
|
|
|
//versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): 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"]
|
2015-02-02 16:54:43 +01:00
|
|
|
java.srcDirs = ["src"]
|
|
|
|
resources.srcDirs = ["src"]
|
2015-01-28 10:58:19 +01:00
|
|
|
renderscript.srcDirs = ["src"]
|
2015-02-02 16:54:43 +01:00
|
|
|
res.srcDirs = ["res"]
|
|
|
|
assets.srcDirs = ["assets"]
|
2015-01-28 10:58:19 +01:00
|
|
|
}
|
|
|
|
free {
|
|
|
|
manifest.srcFile "AndroidManifest-free.xml"
|
|
|
|
}
|
|
|
|
|
|
|
|
legacy {
|
2015-02-02 16:54:43 +01:00
|
|
|
jniLibs.srcDirs = ["libgnustl"]
|
2015-01-28 10:58:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
flavorDimensions "version", "coreversion", "abi"
|
|
|
|
productFlavors {
|
|
|
|
// ABI
|
|
|
|
armv7 {
|
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "armeabi-v7a"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
armv5 {
|
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "armeabi"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x86 {
|
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "x86"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mips {
|
|
|
|
flavorDimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "mips"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fat {
|
|
|
|
flavorDimension "abi"
|
|
|
|
}
|
|
|
|
|
|
|
|
// Version
|
|
|
|
free {
|
|
|
|
flavorDimension "version"
|
|
|
|
applicationId "net.osmand"
|
|
|
|
}
|
|
|
|
full {
|
|
|
|
flavorDimension "version"
|
|
|
|
applicationId "net.osmand.plus"
|
|
|
|
}
|
|
|
|
|
|
|
|
// CoreVersion
|
|
|
|
legacy {
|
|
|
|
flavorDimension "coreversion"
|
|
|
|
}
|
|
|
|
|
|
|
|
qtcore {
|
|
|
|
flavorDimension "coreversion"
|
|
|
|
}
|
|
|
|
|
|
|
|
qtcoredebug {
|
|
|
|
flavorDimension "coreversion"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
debug {
|
2015-05-03 12:15:48 +02:00
|
|
|
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
2015-05-03 14:56:07 +02:00
|
|
|
// minifyEnabled true
|
|
|
|
// proguardFiles 'proguard-project.txt'
|
2015-01-28 10:58:19 +01:00
|
|
|
signingConfig signingConfigs.development
|
|
|
|
}
|
|
|
|
release {
|
2015-05-03 12:15:48 +02:00
|
|
|
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
|
2015-05-03 14:56:07 +02:00
|
|
|
// minifyEnabled true
|
|
|
|
//proguardFiles 'proguard-project.txt'
|
2015-01-28 10:58:19 +01:00
|
|
|
signingConfig signingConfigs.publishing
|
|
|
|
}
|
2015-01-26 12:30:23 +01:00
|
|
|
}
|
2015-01-21 23:32:16 +01:00
|
|
|
}
|
2015-01-21 02:58:28 +01:00
|
|
|
|
2015-01-21 23:32:16 +01:00
|
|
|
def replaceNoTranslate(line) {
|
2015-01-28 10:58:19 +01:00
|
|
|
if (line.contains("\"app_name\"") && System.getenv("TARGET_APP_NAME")) {
|
|
|
|
return line.replaceAll(">[^<]*<", ">" + System.getenv("TARGET_APP_NAME") + "<")
|
|
|
|
}
|
|
|
|
if (line.contains("\"app_edition\"") && System.getenv("APP_EDITION")) {
|
|
|
|
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_EDITION") + "<")
|
|
|
|
}
|
|
|
|
if (line.contains("\"app_version\"") && System.getenv("APK_VERSION")) {
|
2015-04-28 19:57:26 +02:00
|
|
|
return line.replaceAll(">[^<]*<", ">" + System.getenv("APK_VERSION") + "<")
|
|
|
|
}
|
|
|
|
if (line.contains("\"app_version\"") && System.getenv("APK_VERSION_SUFFIX")) {
|
2015-01-28 10:58:19 +01:00
|
|
|
// appends build number to version number for dev builds
|
2015-04-28 19:57:26 +02:00
|
|
|
return line.replaceAll("</", System.getenv("APK_VERSION_SUFFIX") + "</")
|
2015-01-28 10:58:19 +01:00
|
|
|
}
|
|
|
|
if (line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
|
|
|
|
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_FEATURES") + "<")
|
|
|
|
}
|
|
|
|
return line;
|
2015-01-21 23:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task updateNoTranslate(type: Copy) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from('.') {
|
|
|
|
include 'no_translate.xml'
|
|
|
|
filter {
|
|
|
|
line -> replaceNoTranslate(line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
into 'res/values/'
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task collectVoiceAssets(type: Sync) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from "../../resources/voice"
|
|
|
|
into "assets/voice"
|
|
|
|
include "**/*.p"
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
2015-09-09 18:22:47 +02:00
|
|
|
|
|
|
|
task collectFonts(type: Copy) {
|
|
|
|
from "../../resources/fonts"
|
|
|
|
from "../../resources/rendering_styles/fonts/OpenSans"
|
|
|
|
into "assets/fonts"
|
|
|
|
include "*.ttf"
|
|
|
|
}
|
|
|
|
|
2015-01-21 23:32:16 +01:00
|
|
|
task collectHelpContentsAssets(type: Sync) {
|
2015-04-25 22:37:51 +02:00
|
|
|
from "../../help/help"
|
2015-01-28 10:58:19 +01:00
|
|
|
into "assets/help"
|
|
|
|
include "*.html"
|
|
|
|
include "images/**/*.png"
|
|
|
|
|
|
|
|
from "assets/"
|
|
|
|
into "assets/help"
|
|
|
|
include "style.css"
|
2015-10-30 16:16:16 +01:00
|
|
|
|
|
|
|
from "../../help/website/feature_articles"
|
|
|
|
into "assets/feature_articles"
|
|
|
|
include "*.html"
|
2015-11-03 09:46:06 +01:00
|
|
|
|
|
|
|
from "../../help/help_online"
|
|
|
|
into "assets/feature_articles"
|
|
|
|
include "TechnicalArticles.html"
|
|
|
|
include "about.html"
|
2015-01-21 23:32:16 +01:00
|
|
|
}
|
|
|
|
|
2014-12-17 16:32:31 +01:00
|
|
|
task collectRoutingResources(type: Sync) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from "../../resources/routing"
|
|
|
|
into "src/net/osmand/router"
|
|
|
|
include "*.xml"
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
2015-01-21 23:32:16 +01:00
|
|
|
task collectMiscResources(type: Copy) {
|
2015-08-14 13:12:59 +02:00
|
|
|
into "src/net/osmand/osm"
|
|
|
|
from("../../resources/obf_creation") {
|
|
|
|
include "rendering_types.xml"
|
|
|
|
}
|
|
|
|
from("../../resources/poi") {
|
|
|
|
include "poi_types.xml"
|
|
|
|
}
|
2015-01-21 23:32:16 +01:00
|
|
|
}
|
|
|
|
|
2015-01-21 13:43:07 +01:00
|
|
|
task collectRenderingStylesResources(type: Sync) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from "../../resources/rendering_styles"
|
|
|
|
into "src/net/osmand/render"
|
|
|
|
include "*.xml"
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
2015-01-21 13:43:07 +01:00
|
|
|
task collectRegionsInfoResources(type: Copy) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from "../../resources/countries-info"
|
|
|
|
into "src/net/osmand/map"
|
|
|
|
include "regions.ocbf"
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
2015-01-21 23:32:16 +01:00
|
|
|
task copyStyleIcons(type: Copy) {
|
2015-01-28 10:58:19 +01:00
|
|
|
from "../../resources/rendering_styles/style-icons/"
|
|
|
|
into "res/"
|
|
|
|
include "**/*.png"
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
task collectExternalResources << {}
|
|
|
|
collectExternalResources.dependsOn collectVoiceAssets,
|
2015-09-09 18:22:47 +02:00
|
|
|
collectFonts,
|
2015-01-28 10:58:19 +01:00
|
|
|
collectHelpContentsAssets,
|
|
|
|
collectRoutingResources,
|
|
|
|
collectRenderingStylesResources,
|
|
|
|
collectRegionsInfoResources,
|
|
|
|
collectMiscResources,
|
|
|
|
copyStyleIcons,
|
|
|
|
updateNoTranslate
|
2015-04-28 22:36:04 +02:00
|
|
|
// tasks.whenTaskAdded { task ->
|
|
|
|
// if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
|
|
|
|
// task.dependsOn collectExternalResources
|
|
|
|
// }
|
|
|
|
// }
|
2015-01-21 10:52:10 +01:00
|
|
|
|
2014-12-17 16:32:31 +01:00
|
|
|
// Legacy core build
|
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
2015-01-28 10:58:19 +01:00
|
|
|
|
2014-12-17 16:32:31 +01:00
|
|
|
task buildOsmAndCore(type: Exec) {
|
2015-01-28 10:58:19 +01:00
|
|
|
description "Build Legacy OsmAndCore"
|
2014-12-17 16:32:31 +01:00
|
|
|
|
2015-01-28 10:58:19 +01:00
|
|
|
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
|
|
commandLine "bash", file("./old-ndk-build.sh").getAbsolutePath()
|
|
|
|
} else {
|
|
|
|
commandLine "cmd", "/c", "echo", "Not supported"
|
|
|
|
}
|
2014-12-17 16:32:31 +01:00
|
|
|
}
|
2015-01-23 13:32:07 +01:00
|
|
|
|
|
|
|
task cleanupDuplicatesInCore() {
|
2015-01-28 10:58:19 +01:00
|
|
|
dependsOn buildOsmAndCore
|
|
|
|
// doesn't work for legacy debug builds
|
|
|
|
doLast {
|
|
|
|
file("libgnustl/armeabi").mkdirs()
|
2015-05-02 11:30:02 +02:00
|
|
|
file("libs/armeabi/libgnustl_shared.so").renameTo(file("libgnustl/armeabi/libgnustl_shared.so"))
|
2015-01-28 10:58:19 +01:00
|
|
|
file("libgnustl/armeabi-v7a").mkdirs()
|
2015-05-02 11:30:02 +02:00
|
|
|
file("libs/armeabi-v7a/libgnustl_shared.so").renameTo(file("libgnustl/armeabi-v7a/libgnustl_shared.so"))
|
2015-01-28 10:58:19 +01:00
|
|
|
file("libgnustl/mips").mkdirs()
|
2015-05-02 11:30:02 +02:00
|
|
|
file("libs/mips/libgnustl_shared.so").renameTo(file("libgnustl/mips/libgnustl_shared.so"))
|
2015-01-28 10:58:19 +01:00
|
|
|
file("libgnustl/x86").mkdirs()
|
2015-05-02 11:30:02 +02:00
|
|
|
file("libs/x86/libgnustl_shared.so").renameTo(file("libgnustl/x86/libgnustl_shared.so"))
|
2015-01-28 10:58:19 +01:00
|
|
|
}
|
2014-12-17 17:35:16 +01:00
|
|
|
}
|
2014-12-17 16:32:31 +01:00
|
|
|
tasks.withType(JavaCompile) {
|
2015-04-28 21:30:34 +02:00
|
|
|
compileTask -> compileTask.dependsOn << [collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore]
|
2015-01-23 13:32:07 +01:00
|
|
|
}
|
|
|
|
|
2015-05-03 19:47:20 +02:00
|
|
|
clean.dependsOn 'cleanNoTranslate'
|
2015-05-03 19:44:37 +02:00
|
|
|
|
2015-05-03 19:52:15 +02:00
|
|
|
task cleanNoTranslate() {
|
2015-05-03 19:36:03 +02:00
|
|
|
delete ('res/values/no_translate.xml')
|
|
|
|
}
|
|
|
|
|
2014-12-17 16:32:31 +01:00
|
|
|
repositories {
|
2015-01-28 10:58:19 +01:00
|
|
|
ivy {
|
|
|
|
name = "OsmAndBinariesIvy"
|
|
|
|
url = "http://builder.osmand.net"
|
|
|
|
layout "pattern", {
|
|
|
|
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
|
|
|
|
}
|
|
|
|
}
|
2015-03-23 01:54:51 +01:00
|
|
|
// mavenCentral()
|
2014-12-16 12:23:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-02-03 10:13:11 +01:00
|
|
|
compile project(path: ":OsmAnd-java", configuration: "android")
|
2015-08-05 11:53:48 +02:00
|
|
|
compile project(":eclipse-compile:design")
|
2015-08-19 00:04:46 +02:00
|
|
|
compile project(":eclipse-compile:cardview")
|
|
|
|
// compile project(":eclipse-compile:recyclerview")
|
2015-01-28 10:58:19 +01:00
|
|
|
compile fileTree(
|
|
|
|
dir: "libs",
|
|
|
|
include: ["*.jar"],
|
|
|
|
exclude: [
|
|
|
|
"QtAndroid-bundled.jar",
|
|
|
|
"QtAndroidAccessibility-bundled.jar",
|
|
|
|
"OsmAndCore_android.jar",
|
|
|
|
"OsmAndCore_wrapper.jar"])
|
2015-05-03 15:57:11 +02:00
|
|
|
// compile "com.github.ksoichiro:android-observablescrollview:1.5.0"
|
2015-08-19 00:04:46 +02:00
|
|
|
// compile "com.android.support:appcompat-v7:22.2.1"
|
2015-05-03 14:56:07 +02:00
|
|
|
// compile "com.github.shell-software:fab:1.0.5"
|
2015-08-19 00:04:46 +02:00
|
|
|
// compile 'com.android.support:design:22.2.1'
|
2015-01-28 10:58:19 +01:00
|
|
|
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
|
|
|
|
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
|
|
|
|
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
|
|
|
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
|
|
|
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
2015-08-19 00:04:46 +02:00
|
|
|
|
2014-12-16 12:23:45 +01:00
|
|
|
}
|