diff --git a/OsmAnd/.gitignore b/OsmAnd/.gitignore
index 557fe3b444..e443883b73 100644
--- a/OsmAnd/.gitignore
+++ b/OsmAnd/.gitignore
@@ -1,5 +1,6 @@
bin/
dist/
+res/values/no_translate.xml
assets/specialphrases/*
assets/voice/*
gen/
diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle
index 6eb31af020..c1ca141d70 100644
--- a/OsmAnd/build.gradle
+++ b/OsmAnd/build.gradle
@@ -1,23 +1,26 @@
apply plugin: 'com.android.application'
+// Global Paramers accepted
+// APK_NUMBER_VERSION - version number of apk
+// APK_VERSION - version name like 2.1 (subsitute of app_version in no_translate.xml)
+// APP_NAME - app name
+// APP_EDITION - used for build numbers
+// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
+
+
// TODO
-// 0. Update! OsmAndCore_wrapper for build ()
-// 1. no_translate.xml (versionFeatures, app.edition, build.version )
-//
-//
-//
-//
-//
-// 2. Filter fonts
+// 0. Update OsmAndCore_wrapper for build (implement )
+// 1. Filter fonts
//
//
//
//
//
//
-// 3. fix_apostrophe_issues (replace match="[^=]([^\\])'" replace="\1\\\\'") res/**/strings.xml
-// 4. sherpafy/free/paid
+// 2. fix_apostrophe_issues (replace match="[^=]([^\\])'" replace="\1\\\\'") res/**/strings.xml
+// 3. sherpafy/free/paid
+// 4. Release signature
+// 5. APP_NAME, APP_EDITION uses flavor
android {
compileSdkVersion 21
@@ -71,17 +74,18 @@ android {
aidl.srcDirs = ["src"]
java.srcDirs = [
"src",
- fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java"),
- "resourcesSrc"
+ fileTree(dir: "../OsmAnd-java/src", exclude: "**/PlatformUtil.java")
+ // "resourcesSrc"
]
resources.srcDirs = [
- "src",
- "../OsmAnd-java/src",
- "resourcesSrc"
+ "src"
+ // "../OsmAnd-java/src"
+ // "resourcesSrc"
]
renderscript.srcDirs = ["src"]
res.srcDirs = [
- "res"
+ 'res'
+
]
assets.srcDirs = [
'assets'
@@ -155,44 +159,42 @@ android {
signingConfig signingConfigs.publishing
}
-
}
}
+def replaceNoTranslate(line) {
+ if(line.contains("\"app_name\"") && System.getenv("APP_NAME")) {
+ return line.replaceAll(">[^<]*<", " >"+System.getenv("APP_NAME")+"<")
+ }
+ if(line.contains("\"app_edition\"") && System.getenv("APP_EDITION")) {
+ return line.replaceAll(">[^<]*<", " >"+System.getenv("APP_EDITION")+"<")
+ }
+ if(line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
+ return line.replaceAll(">[^<]*<", " >"+System.getenv("APP_FEATURES")+"<")
+ }
+ return line;
+}
+
+task updateNoTranslate(type: Copy) {
+ from('.') {
+ include 'no_translate.xml'
+ filter {
+ line -> replaceNoTranslate(line);
+ }
+ }
+ into 'res/values/'
+}
+
task collectVoiceAssets(type: Sync) {
from "../../resources/voice"
into "assets/voice"
- include "voice/**/*.p"
+ include "**/*.p"
}
task collectSpecialPhrasesAssets(type: Sync) {
- from "../../resources/voice"
+ from "../../resources/specialphrases"
into "assets/specialphrases"
- include "specialphrases/*.txt"
-}
-
-task collectRoutingResources(type: Sync) {
- from "../../resources/routing"
- into "resourcesSrc/net/osmand/router"
- include "*.xml"
-}
-
-task collectRenderingStylesResources(type: Sync) {
- from "../../resources/rendering_styles"
- into "resourcesSrc/net/osmand/render"
- include "*.xml"
-}
-
-task copyStyleIcons(type: Copy) {
- from "../../resources/rendering_styles/style-icons/"
- into "res/"
- include "**/*.png"
-}
-
-task collectRegionsInfoResources(type: Copy) {
- from "../../resources/countries-info"
- into "resourcesSrc/net/osmand/map"
- include "regions.ocbf"
+ include "*.txt"
}
task collectHelpContentsAssets(type: Sync) {
@@ -206,17 +208,44 @@ task collectHelpContentsAssets(type: Sync) {
include "style.css"
}
+task collectRoutingResources(type: Sync) {
+ from "../../resources/routing"
+ into "src/net/osmand/router"
+ include "*.xml"
+}
+
+
task collectMiscResources(type: Copy) {
- into "resourcesSrc/net/osmand/osm"
+ 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"
+}
+
+
+task collectRegionsInfoResources(type: Copy) {
+ 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"
+}
+
+
task collectExternalResources << {}
collectExternalResources.dependsOn collectVoiceAssets,
collectSpecialPhrasesAssets,
@@ -225,12 +254,14 @@ collectExternalResources.dependsOn collectVoiceAssets,
collectRenderingStylesResources,
collectRegionsInfoResources,
collectMiscResources,
- copyStyleIcons
+ copyStyleIcons,
+ updateNoTranslate
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn << collectExternalResources
}
+
task downloadAAR {
def f = new File("libs/OsmAndCore_wrapper.jar")
if (!f.exists()) {
diff --git a/OsmAnd/res/values/no_translate.xml b/OsmAnd/no_translate.xml
similarity index 97%
rename from OsmAnd/res/values/no_translate.xml
rename to OsmAnd/no_translate.xml
index 1a05ffeebc..e2d1cb3537 100644
--- a/OsmAnd/res/values/no_translate.xml
+++ b/OsmAnd/no_translate.xml
@@ -1,7 +1,6 @@
-
+
OsmAnd~
- OsmAnd 2.0.0
2.0.0