Reformat gradle
This commit is contained in:
parent
03fa1df95e
commit
270439582e
1 changed files with 247 additions and 241 deletions
488
OsmAnd/build.gradle
Normal file → Executable file
488
OsmAnd/build.gradle
Normal file → Executable file
|
@ -7,7 +7,6 @@ apply plugin: 'com.android.application'
|
|||
// TARGET_APP_NAME - app name
|
||||
// APP_EDITION - date stamp of builds
|
||||
// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
|
||||
|
||||
|
||||
// TODO
|
||||
// 1. Filter fonts
|
||||
|
@ -23,301 +22,308 @@ apply plugin: 'com.android.application'
|
|||
// 4. Release signature
|
||||
// 5. TARGET_APP_NAME, APP_EDITION uses flavor
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
storeFile file("../keystores/debug.keystore")
|
||||
storePassword "android"
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword "android"
|
||||
}
|
||||
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")? 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"]
|
||||
java.srcDirs = [
|
||||
"src",
|
||||
fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java")
|
||||
]
|
||||
resources.srcDirs = [
|
||||
"src"
|
||||
]
|
||||
renderscript.srcDirs = ["src"]
|
||||
res.srcDirs = [
|
||||
'res'
|
||||
|
||||
]
|
||||
assets.srcDirs = [
|
||||
'assets'
|
||||
]
|
||||
}
|
||||
free {
|
||||
manifest.srcFile "AndroidManifest-free.xml"
|
||||
}
|
||||
|
||||
legacy {
|
||||
jniLibs.srcDirs = [
|
||||
"libgnustl"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
publishing {
|
||||
storeFile file("osmand_key")
|
||||
storePassword System.getenv("PWD")
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword System.getenv("PWD")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.development
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.publishing
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
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"]
|
||||
java.srcDirs = [
|
||||
"src",
|
||||
fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java")
|
||||
]
|
||||
resources.srcDirs = [
|
||||
"src"
|
||||
]
|
||||
renderscript.srcDirs = ["src"]
|
||||
res.srcDirs = [
|
||||
'res'
|
||||
|
||||
]
|
||||
assets.srcDirs = [
|
||||
'assets'
|
||||
]
|
||||
}
|
||||
free {
|
||||
manifest.srcFile "AndroidManifest-free.xml"
|
||||
}
|
||||
|
||||
legacy {
|
||||
jniLibs.srcDirs = [
|
||||
"libgnustl"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
signingConfig signingConfigs.development
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.publishing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def replaceNoTranslate(line) {
|
||||
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")) {
|
||||
// appends build number to version number for dev builds
|
||||
return line.replaceAll("</", System.getenv("APK_VERSION")+"</")
|
||||
}
|
||||
if(line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
|
||||
return line.replaceAll(">[^<]*<", ">"+System.getenv("APP_FEATURES")+"<")
|
||||
}
|
||||
return line;
|
||||
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")) {
|
||||
// appends build number to version number for dev builds
|
||||
return line.replaceAll("</", System.getenv("APK_VERSION") + "</")
|
||||
}
|
||||
if (line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
|
||||
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_FEATURES") + "<")
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
task updateNoTranslate(type: Copy) {
|
||||
inputs.property 'appName', System.getenv().get("APP_NAME")
|
||||
inputs.property 'appEdition', System.getenv().get("APP_EDITION")
|
||||
inputs.property 'appFeatures', System.getenv().get("APP_FEATURES")
|
||||
inputs.property 'apkVersion', System.getenv().get("APK_VERSION")
|
||||
from('.') {
|
||||
include 'no_translate.xml'
|
||||
filter {
|
||||
line -> replaceNoTranslate(line);
|
||||
}
|
||||
}
|
||||
into 'res/values/'
|
||||
inputs.property 'appName', System.getenv().get("APP_NAME")
|
||||
inputs.property 'appEdition', System.getenv().get("APP_EDITION")
|
||||
inputs.property 'appFeatures', System.getenv().get("APP_FEATURES")
|
||||
inputs.property 'apkVersion', System.getenv().get("APK_VERSION")
|
||||
from('.') {
|
||||
include 'no_translate.xml'
|
||||
filter {
|
||||
line -> replaceNoTranslate(line);
|
||||
}
|
||||
}
|
||||
into 'res/values/'
|
||||
}
|
||||
|
||||
task collectVoiceAssets(type: Sync) {
|
||||
from "../../resources/voice"
|
||||
into "assets/voice"
|
||||
include "**/*.p"
|
||||
from "../../resources/voice"
|
||||
into "assets/voice"
|
||||
include "**/*.p"
|
||||
}
|
||||
|
||||
task collectSpecialPhrasesAssets(type: Sync) {
|
||||
from "../../resources/specialphrases"
|
||||
into "assets/specialphrases"
|
||||
include "*.txt"
|
||||
from "../../resources/specialphrases"
|
||||
into "assets/specialphrases"
|
||||
include "*.txt"
|
||||
}
|
||||
|
||||
task collectHelpContentsAssets(type: Sync) {
|
||||
from "../../help"
|
||||
into "assets/help"
|
||||
include "*.html"
|
||||
include "images/**/*.png"
|
||||
from "../../help"
|
||||
into "assets/help"
|
||||
include "*.html"
|
||||
include "images/**/*.png"
|
||||
|
||||
from "assets/"
|
||||
into "assets/help"
|
||||
include "style.css"
|
||||
from "assets/"
|
||||
into "assets/help"
|
||||
include "style.css"
|
||||
}
|
||||
|
||||
task collectRoutingResources(type: Sync) {
|
||||
from "../../resources/routing"
|
||||
into "src/net/osmand/router"
|
||||
include "*.xml"
|
||||
from "../../resources/routing"
|
||||
into "src/net/osmand/router"
|
||||
include "*.xml"
|
||||
}
|
||||
|
||||
task collectMiscResources(type: Copy) {
|
||||
into "src/net/osmand/osm"
|
||||
from("../../resources/obf_creation") {
|
||||
include "rendering_types.xml"
|
||||
}
|
||||
from("../../resources/poi") {
|
||||
include "poi_types.xml"
|
||||
}
|
||||
into "src/net/osmand/osm"
|
||||
from("../../resources/obf_creation") {
|
||||
include "rendering_types.xml"
|
||||
}
|
||||
from("../../resources/poi") {
|
||||
include "poi_types.xml"
|
||||
}
|
||||
}
|
||||
|
||||
task collectRenderingStylesResources(type: Sync) {
|
||||
from "../../resources/rendering_styles"
|
||||
into "src/net/osmand/render"
|
||||
include "*.xml"
|
||||
from "../../resources/rendering_styles"
|
||||
into "src/net/osmand/render"
|
||||
include "*.xml"
|
||||
}
|
||||
|
||||
task collectRegionsInfoResources(type: Copy) {
|
||||
from "../../resources/countries-info"
|
||||
into "src/net/osmand/map"
|
||||
include "regions.ocbf"
|
||||
from "../../resources/countries-info"
|
||||
into "src/net/osmand/map"
|
||||
include "regions.ocbf"
|
||||
}
|
||||
|
||||
task copyStyleIcons(type: Copy) {
|
||||
from "../../resources/rendering_styles/style-icons/"
|
||||
into "res/"
|
||||
include "**/*.png"
|
||||
from "../../resources/rendering_styles/style-icons/"
|
||||
into "res/"
|
||||
include "**/*.png"
|
||||
}
|
||||
|
||||
task collectExternalResources << {}
|
||||
collectExternalResources.dependsOn collectVoiceAssets,
|
||||
collectSpecialPhrasesAssets,
|
||||
collectHelpContentsAssets,
|
||||
collectRoutingResources,
|
||||
collectRenderingStylesResources,
|
||||
collectRegionsInfoResources,
|
||||
collectMiscResources,
|
||||
copyStyleIcons,
|
||||
updateNoTranslate
|
||||
collectSpecialPhrasesAssets,
|
||||
collectHelpContentsAssets,
|
||||
collectRoutingResources,
|
||||
collectRenderingStylesResources,
|
||||
collectRegionsInfoResources,
|
||||
collectMiscResources,
|
||||
copyStyleIcons,
|
||||
updateNoTranslate
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
|
||||
task.dependsOn collectExternalResources
|
||||
}
|
||||
if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
|
||||
task.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 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() {
|
||||
dependsOn buildOsmAndCore
|
||||
// doesn't work for legacy debug builds
|
||||
doLast {
|
||||
file("libgnustl/armeabi").mkdirs()
|
||||
println file("libs/armeabi/libgnustl_shared.so").renameTo(file("libgnustl/armeabi/libgnustl_shared.so"))
|
||||
file("libgnustl/armeabi-v7a").mkdirs()
|
||||
println file("libs/armeabi-v7a/libgnustl_shared.so").renameTo(file("libgnustl/armeabi-v7a/libgnustl_shared.so"))
|
||||
file("libgnustl/mips").mkdirs()
|
||||
println file("libs/mips/libgnustl_shared.so").renameTo(file("libgnustl/mips/libgnustl_shared.so"))
|
||||
file("libgnustl/x86").mkdirs()
|
||||
println file("libs/x86/libgnustl_shared.so").renameTo(file("libgnustl/x86/libgnustl_shared.so"))
|
||||
}
|
||||
dependsOn buildOsmAndCore
|
||||
// doesn't work for legacy debug builds
|
||||
doLast {
|
||||
file("libgnustl/armeabi").mkdirs()
|
||||
println file("libs/armeabi/libgnustl_shared.so").renameTo(file("libgnustl/armeabi/libgnustl_shared.so"))
|
||||
file("libgnustl/armeabi-v7a").mkdirs()
|
||||
println file("libs/armeabi-v7a/libgnustl_shared.so").renameTo(file("libgnustl/armeabi-v7a/libgnustl_shared.so"))
|
||||
file("libgnustl/mips").mkdirs()
|
||||
println file("libs/mips/libgnustl_shared.so").renameTo(file("libgnustl/mips/libgnustl_shared.so"))
|
||||
file("libgnustl/x86").mkdirs()
|
||||
println file("libs/x86/libgnustl_shared.so").renameTo(file("libgnustl/x86/libgnustl_shared.so"))
|
||||
}
|
||||
}
|
||||
tasks.withType(JavaCompile) {
|
||||
compileTask -> compileTask.dependsOn << [buildOsmAndCore, cleanupDuplicatesInCore]
|
||||
compileTask -> compileTask.dependsOn << [buildOsmAndCore, cleanupDuplicatesInCore]
|
||||
}
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
name = "OsmAndBinariesIvy"
|
||||
url = "http://builder.osmand.net"
|
||||
layout "pattern" , {
|
||||
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
|
||||
}
|
||||
}
|
||||
ivy {
|
||||
name = "OsmAndBinariesIvy"
|
||||
url = "http://builder.osmand.net"
|
||||
layout "pattern", {
|
||||
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: "libs", include: ["*.jar"], exclude: ["QtAndroid-bundled.jar", "QtAndroidAccessibility-bundled.jar", "android-support*.jar", "OsmAndCore_android.jar",
|
||||
"OsmAndCore_wrapper.jar"])
|
||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||
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" // not a debug ?
|
||||
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
compile fileTree(
|
||||
dir: "libs",
|
||||
include: ["*.jar"],
|
||||
exclude: [
|
||||
"QtAndroid-bundled.jar",
|
||||
"QtAndroidAccessibility-bundled.jar",
|
||||
"android-support*.jar",
|
||||
"OsmAndCore_android.jar",
|
||||
"OsmAndCore_wrapper.jar"])
|
||||
compile "com.android.support:appcompat-v7:21.0.3"
|
||||
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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue