Skip to content

Commit

Permalink
Fix gradle scripts for SDK 34
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-osm committed Jul 16, 2024
1 parent a02e5dc commit 2c11f7c
Show file tree
Hide file tree
Showing 22 changed files with 106 additions and 99 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 18 additions & 19 deletions OsmAnd-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ configurations {
android
}

//tasks.withType(JavaCompile) {
// sourceCompatibility = "1.7"
// targetCompatibility = "1.7"
// options.encoding = 'UTF-8'
//}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = "17"
targetCompatibility = "17"
}

task collectRoutingResources(type: Sync) {
tasks.register('collectRoutingResources', Sync) {
from "../../resources/routing"
into "src/main/resources/net/osmand/router"
include "*.xml"
}

task collectMiscResources(type: Copy) {
tasks.register('collectMiscResources', Copy) {
into "src/main/resources/net/osmand/osm"
from("../../resources/obf_creation") {
include "rendering_types.xml"
Expand All @@ -28,27 +27,27 @@ task collectMiscResources(type: Copy) {
}
}

task collectRenderingStylesResources(type: Sync) {
tasks.register('collectRenderingStylesResources', Sync) {
from "../../resources/rendering_styles"
into "src/main/resources/net/osmand/render"
include "*.xml"
}

task collectRegionsInfoResources(type: Download) {
tasks.register('collectRegionsInfoResources', Download) {
src 'https://creator.osmand.net/basemap/regions.ocbf'
dest 'src/main/resources/net/osmand/map/regions.ocbf'
onlyIfModified true
}


task collectTestPhrasesResources(type: Copy) {
tasks.register('collectTestPhrasesResources', Copy) {
into "src/test/resources/phrases/en/"
from("../OsmAnd/res/values") {
include "phrases.xml"
}
}

task collectTestResources(type: Copy) {
tasks.register('collectTestResources', Copy) {
into "src/test/resources/"
from("../../resources/test-resources") {
include "*"
Expand All @@ -71,23 +70,23 @@ processTestResources {
dependsOn collectTestResources, collectTestPhrasesResources
}

task collectExternalResources {
tasks.register('collectExternalResources') {
dependsOn collectRoutingResources,
collectRenderingStylesResources,
collectRegionsInfoResources,
collectTestResources,
collectTestPhrasesResources,
collectMiscResources
collectRenderingStylesResources,
collectRegionsInfoResources,
collectTestResources,
collectTestPhrasesResources,
collectMiscResources
}

task androidJar(type: Jar) {
tasks.register('androidJar', Jar) {
if (!project.hasProperty('osmandCoreSimple')) {
dependsOn collectExternalResources, build
} else {
dependsOn build
}
archiveAppendix = "android"
from (sourceSets.main.java.classesDirectory) {
from(sourceSets.main.java.classesDirectory) {
exclude("**/PlatformUtil.*")
}
from sourceSets.main.resources
Expand Down
8 changes: 4 additions & 4 deletions OsmAnd-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
}
Expand Down Expand Up @@ -45,10 +45,10 @@ android {
namespace = "net.osmand.shared"
compileSdk = 34
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
minSdk = 23
minSdk = 24
}
}
36 changes: 21 additions & 15 deletions OsmAnd-telegram/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ apply plugin: 'kotlin-android'
android {
compileSdk 34
buildToolsVersion = "34.0.0"

namespace = "net.osmand.telegram"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
main {
manifest.srcFile "AndroidManifest.xml"
jni.srcDirs = []
jniLibs.srcDirs = ["libs"]
aidl.srcDirs = ["src"]
java.srcDirs = ["src"]
Expand Down Expand Up @@ -56,6 +59,7 @@ android {
dimension "abi"
}
}

signingConfigs {
development {
storeFile file("../keystores/debug.keystore")
Expand Down Expand Up @@ -101,58 +105,60 @@ android {
def variant = it
def taskName = variant.name.capitalize()
def mergeAssetsTaskName = "merge${taskName}Assets"
def osmandTask = tasks.findByName(mergeAssetsTaskName)
if (osmandTask != null) {
tasks.named(mergeAssetsTaskName).configure { osmandTask ->
println(osmandTask.getName())
osmandTask.dependsOn(collectFonts)
}
def mapSourceSetPathsName= "map${taskName}SourceSetPaths"
osmandTask = tasks.findByName(mapSourceSetPathsName)
if(osmandTask != null) {
tasks.named(mapSourceSetPathsName).configure { osmandTask ->
println(osmandTask.getName())
}
}

}

task downloadTdLibzip {
tasks.register('downloadTdLibzip') {
doLast {
ant.get(src: 'https://osmand.net/uploads/libs/tdlib.zip', dest: 'tdlib.zip', skipexisting: 'true')
ant.unzip(src: 'tdlib.zip', dest: 'tdlib/')
}
}

task copyNativeLibs(type: Copy) {
tasks.register('copyNativeLibs', Copy) {
dependsOn downloadTdLibzip
from "tdlib/tdlib/libs"
into "libs"
}

task copyJavaSources(type: Copy) {
tasks.register('copyJavaSources', Copy) {
dependsOn downloadTdLibzip
from "tdlib/tdlib/java"
into "src"
}

task downloadPrebuiltTelegram {
tasks.register('downloadPrebuiltTelegram') {
dependsOn downloadTdLibzip, copyNativeLibs, copyJavaSources
}

task collectFonts(type: Copy) {
tasks.register('collectFonts', Copy) {
from "../../resources/fonts"
from "../../resources/fonts-telegram"
into "assets/fonts"
include "*.ttf"
}

task collectExternalResources {
tasks.register('collectExternalResources') {
dependsOn collectFonts
}

afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompiler.dependsOn(downloadPrebuiltTelegram, collectExternalResources)
variant.preBuild.dependsOn(downloadPrebuiltTelegram)
android.applicationVariants.configureEach { variant ->
variant.javaCompileProvider.configure { compileTask ->
compileTask.dependsOn downloadPrebuiltTelegram, collectExternalResources
}
variant.preBuildProvider.configure { preBuildTask ->
preBuildTask.dependsOn downloadPrebuiltTelegram
}
}
}

Expand Down
Loading

0 comments on commit 2c11f7c

Please sign in to comment.