WIP: [android] Compose benchmark using new module structure #5825
2428 changed files with 1480 additions and 1206 deletions
|
@ -1 +1,2 @@
|
|||
6aa73face8b5eb8e026cfafa40d1983d4a0502c0
|
||||
54c9882c122134bacda6cac1a698b63fd833c847
|
||||
|
|
|
@ -4,8 +4,8 @@ on:
|
|||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/android-check-metadata.yaml # Run check on self change
|
||||
- android/src/fdroid/**
|
||||
- android/src/google/**
|
||||
- android/app/src/main/fdroid/**
|
||||
- android/app/src/main/google/**
|
||||
- tools/python/check_store_metadata.py
|
||||
|
||||
jobs:
|
||||
|
|
6
.github/workflows/android-check.yaml
vendored
6
.github/workflows/android-check.yaml
vendored
|
@ -14,8 +14,8 @@ on:
|
|||
- LICENSE
|
||||
- NOTICE
|
||||
- README.md
|
||||
- android/src/fdroid/**
|
||||
- android/src/google/**
|
||||
- android/app/src/main/fdroid/**
|
||||
- android/app/src/main/google/**
|
||||
- iphone/**
|
||||
- data/strings/**
|
||||
- docs/**
|
||||
|
@ -106,5 +106,5 @@ jobs:
|
|||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android-arm64-v8a-${{ matrix.flavor }}
|
||||
path: android/build/outputs/apk/**/OrganicMaps-*.apk
|
||||
path: android/app/build/outputs/apk/**/OrganicMaps-*.apk
|
||||
if-no-files-found: error
|
||||
|
|
2
.github/workflows/android-monkey.yaml
vendored
2
.github/workflows/android-monkey.yaml
vendored
|
@ -82,7 +82,7 @@ jobs:
|
|||
run: |
|
||||
gcloud auth activate-service-account --key-file android/firebase-test-lab.json
|
||||
gcloud config set project omapsapp
|
||||
gcloud firebase test android run --app ./android/build/outputs/apk/google/debug/OrganicMaps-*-google-debug.apk \
|
||||
gcloud firebase test android run --app ./android/app/build/outputs/apk/google/debug/OrganicMaps-*-google-debug.apk \
|
||||
--device model=panther,version=33 \
|
||||
--device model=bluejay,version=32 \
|
||||
--device model=b2q,version=31 \
|
||||
|
|
8
.github/workflows/android-release.yaml
vendored
8
.github/workflows/android-release.yaml
vendored
|
@ -3,8 +3,8 @@ on:
|
|||
workflow_dispatch: # Manual trigger
|
||||
|
||||
env:
|
||||
RELEASE_NOTES: android/src/google/play/release-notes/en-US/default.txt
|
||||
FDROID_VERSION: android/src/fdroid/play/version.yaml
|
||||
RELEASE_NOTES: android/app/src/main/google/play/release-notes/en-US/default.txt
|
||||
FDROID_VERSION: android/app/src/main/fdroid/play/version.yaml
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
|
@ -151,7 +151,7 @@ jobs:
|
|||
echo ""
|
||||
echo "sha256sum:"
|
||||
echo -e '\n```'
|
||||
(cd ./android/build/outputs/apk/web/release/ && sha256sum OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk) | tr -d '\n'
|
||||
(cd ./android/app/build/outputs/apk/web/release/ && sha256sum OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk) | tr -d '\n'
|
||||
echo -e '\n```'
|
||||
} > ${{ runner.temp }}/release-notes.txt
|
||||
|
||||
|
@ -164,5 +164,5 @@ jobs:
|
|||
name: ${{ needs.tag.outputs.tag }}
|
||||
tag_name: ${{ needs.tag.outputs.tag }}
|
||||
discussion_category_name: 'Announcements'
|
||||
files: ./android/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk
|
||||
files: ./android/app/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk
|
||||
fail_on_unmatched_files: true
|
||||
|
|
|
@ -353,5 +353,5 @@ endif()
|
|||
omim_add_test_subdirectory(qt_tstfrm)
|
||||
|
||||
if (PLATFORM_ANDROID)
|
||||
add_subdirectory(android/jni)
|
||||
add_subdirectory(android/app/src/main/cpp)
|
||||
endif()
|
||||
|
|
47
android/.gitignore
vendored
47
android/.gitignore
vendored
|
@ -1,40 +1,23 @@
|
|||
bin
|
||||
gen
|
||||
/libs/
|
||||
.settings
|
||||
resbuilder
|
||||
spoon-output
|
||||
obj
|
||||
local
|
||||
.gradle
|
||||
build
|
||||
3rd_party/api-android/
|
||||
RELEASE
|
||||
.idea
|
||||
.externalNativeBuild
|
||||
nativeOutputs
|
||||
|
||||
# For now, ignore Android Studio projects
|
||||
# default android studio ignore list
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
|
||||
*.class
|
||||
.classpath
|
||||
.cproject
|
||||
.project
|
||||
local.properties
|
||||
lint.xml
|
||||
.gradletasknamecache
|
||||
|
||||
# ignore flags symlinks
|
||||
res/drawable-xhdpi/??.png
|
||||
res/drawable-xhdpi/do_hack.png
|
||||
res/drawable-xhdpi/uk_england.png
|
||||
res/drawable-xhdpi/uk_northern_ireland.png
|
||||
res/drawable-xhdpi/uk_scotland.png
|
||||
res/drawable-xhdpi/uk_wales.png
|
||||
res/drawable-mdpi/??.png
|
||||
res/drawable-mdpi/do_hack.png
|
||||
res/drawable-mdpi/uk_england.png
|
||||
res/drawable-mdpi/uk_northern_ireland.png
|
||||
res/drawable-mdpi/uk_scotland.png
|
||||
res/drawable-mdpi/uk_wales.png
|
||||
|
|
20
android/app/.gitignore
vendored
Normal file
20
android/app/.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/build
|
||||
/nativeOutputs
|
||||
google-services.json
|
||||
secure.properties
|
||||
|
||||
src/main/res/xml/network_security_config.xml
|
||||
|
||||
# ignore flags symlinks
|
||||
/src/main/res/drawable-xhdpi/??.png
|
||||
/src/main/res/drawable-xhdpi/do_hack.png
|
||||
/src/main/res/drawable-xhdpi/uk_england.png
|
||||
/src/main/res/drawable-xhdpi/uk_northern_ireland.png
|
||||
/src/main/res/drawable-xhdpi/uk_scotland.png
|
||||
/src/main/res/drawable-xhdpi/uk_wales.png
|
||||
/src/main/res/drawable-mdpi/??.png
|
||||
/src/main/res/drawable-mdpi/do_hack.png
|
||||
/src/main/res/drawable-mdpi/uk_england.png
|
||||
/src/main/res/drawable-mdpi/uk_northern_ireland.png
|
||||
/src/main/res/drawable-mdpi/uk_scotland.png
|
||||
/src/main/res/drawable-mdpi/uk_wales.png
|
1
android/app/assets/00_NotoNaskhArabic-Regular.ttf
Symbolic link
1
android/app/assets/00_NotoNaskhArabic-Regular.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/00_NotoNaskhArabic-Regular.ttf
|
1
android/app/assets/00_NotoSansThai-Regular.ttf
Symbolic link
1
android/app/assets/00_NotoSansThai-Regular.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/00_NotoSansThai-Regular.ttf
|
1
android/app/assets/00_NotoSerifDevanagari-Regular.ttf
Symbolic link
1
android/app/assets/00_NotoSerifDevanagari-Regular.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/00_NotoSerifDevanagari-Regular.ttf
|
1
android/app/assets/01_dejavusans.ttf
Symbolic link
1
android/app/assets/01_dejavusans.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/01_dejavusans.ttf
|
1
android/app/assets/02_droidsans-fallback.ttf
Symbolic link
1
android/app/assets/02_droidsans-fallback.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/02_droidsans-fallback.ttf
|
1
android/app/assets/03_jomolhari-id-a3d.ttf
Symbolic link
1
android/app/assets/03_jomolhari-id-a3d.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/03_jomolhari-id-a3d.ttf
|
1
android/app/assets/04_padauk.ttf
Symbolic link
1
android/app/assets/04_padauk.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/04_padauk.ttf
|
1
android/app/assets/05_khmeros.ttf
Symbolic link
1
android/app/assets/05_khmeros.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/05_khmeros.ttf
|
1
android/app/assets/06_code2000.ttf
Symbolic link
1
android/app/assets/06_code2000.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/06_code2000.ttf
|
1
android/app/assets/07_roboto_medium.ttf
Symbolic link
1
android/app/assets/07_roboto_medium.ttf
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/07_roboto_medium.ttf
|
1
android/app/assets/categories.txt
Symbolic link
1
android/app/assets/categories.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/categories.txt
|
1
android/app/assets/categories_brands.txt
Symbolic link
1
android/app/assets/categories_brands.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/categories_brands.txt
|
1
android/app/assets/categories_cuisines.txt
Symbolic link
1
android/app/assets/categories_cuisines.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/categories_cuisines.txt
|
1
android/app/assets/classificator.txt
Symbolic link
1
android/app/assets/classificator.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/classificator.txt
|
1
android/app/assets/colors.txt
Symbolic link
1
android/app/assets/colors.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/colors.txt
|
1
android/app/assets/copyright.html
Symbolic link
1
android/app/assets/copyright.html
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/copyright.html
|
1
android/app/assets/countries-strings
Symbolic link
1
android/app/assets/countries-strings
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/countries-strings/
|
1
android/app/assets/countries.txt
Symbolic link
1
android/app/assets/countries.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/countries.txt
|
1
android/app/assets/drules_proto_clear.bin
Symbolic link
1
android/app/assets/drules_proto_clear.bin
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/drules_proto_clear.bin
|
1
android/app/assets/drules_proto_dark.bin
Symbolic link
1
android/app/assets/drules_proto_dark.bin
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/drules_proto_dark.bin
|
1
android/app/assets/drules_proto_vehicle_clear.bin
Symbolic link
1
android/app/assets/drules_proto_vehicle_clear.bin
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/drules_proto_vehicle_clear.bin
|
1
android/app/assets/drules_proto_vehicle_dark.bin
Symbolic link
1
android/app/assets/drules_proto_vehicle_dark.bin
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/drules_proto_vehicle_dark.bin
|
1
android/app/assets/editor.config
Symbolic link
1
android/app/assets/editor.config
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/editor.config
|
1
android/app/assets/faq.html
Symbolic link
1
android/app/assets/faq.html
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/faq.html
|
1
android/app/assets/fonts_blacklist.txt
Symbolic link
1
android/app/assets/fonts_blacklist.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/fonts_blacklist.txt
|
1
android/app/assets/fonts_whitelist.txt
Symbolic link
1
android/app/assets/fonts_whitelist.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/fonts_whitelist.txt
|
1
android/app/assets/icudt73l.dat
Symbolic link
1
android/app/assets/icudt73l.dat
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/icudt73l.dat
|
1
android/app/assets/languages.txt
Symbolic link
1
android/app/assets/languages.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/languages.txt
|
1
android/app/assets/opening_hours_how_to_edit.html
Symbolic link
1
android/app/assets/opening_hours_how_to_edit.html
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/opening_hours_how_to_edit.html
|
1
android/app/assets/packed_polygons.bin
Symbolic link
1
android/app/assets/packed_polygons.bin
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/packed_polygons.bin
|
1
android/app/assets/patterns.txt
Symbolic link
1
android/app/assets/patterns.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/patterns.txt
|
1
android/app/assets/resources-6plus_clear
Symbolic link
1
android/app/assets/resources-6plus_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-6plus_clear
|
1
android/app/assets/resources-6plus_dark
Symbolic link
1
android/app/assets/resources-6plus_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-6plus_dark
|
1
android/app/assets/resources-default
Symbolic link
1
android/app/assets/resources-default
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-default
|
1
android/app/assets/resources-hdpi_clear
Symbolic link
1
android/app/assets/resources-hdpi_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-hdpi_clear
|
1
android/app/assets/resources-hdpi_dark
Symbolic link
1
android/app/assets/resources-hdpi_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-hdpi_dark
|
1
android/app/assets/resources-mdpi_clear
Symbolic link
1
android/app/assets/resources-mdpi_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-mdpi_clear
|
1
android/app/assets/resources-mdpi_dark
Symbolic link
1
android/app/assets/resources-mdpi_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-mdpi_dark
|
1
android/app/assets/resources-xhdpi_clear
Symbolic link
1
android/app/assets/resources-xhdpi_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xhdpi_clear
|
1
android/app/assets/resources-xhdpi_dark
Symbolic link
1
android/app/assets/resources-xhdpi_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xhdpi_dark
|
1
android/app/assets/resources-xxhdpi_clear
Symbolic link
1
android/app/assets/resources-xxhdpi_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xxhdpi_clear
|
1
android/app/assets/resources-xxhdpi_dark
Symbolic link
1
android/app/assets/resources-xxhdpi_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xxhdpi_dark
|
1
android/app/assets/resources-xxxhdpi_clear
Symbolic link
1
android/app/assets/resources-xxxhdpi_clear
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xxxhdpi_clear
|
1
android/app/assets/resources-xxxhdpi_dark
Symbolic link
1
android/app/assets/resources-xxxhdpi_dark
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/resources-xxxhdpi_dark
|
1
android/app/assets/sound-strings
Symbolic link
1
android/app/assets/sound-strings
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/sound-strings
|
1
android/app/assets/transit_colors.txt
Symbolic link
1
android/app/assets/transit_colors.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/transit_colors.txt
|
1
android/app/assets/types.txt
Symbolic link
1
android/app/assets/types.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/types.txt
|
1
android/app/assets/unicode_blocks.txt
Symbolic link
1
android/app/assets/unicode_blocks.txt
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/unicode_blocks.txt
|
1
android/app/assets/vulkan_shaders
Symbolic link
1
android/app/assets/vulkan_shaders
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../data/vulkan_shaders
|
545
android/app/build.gradle
Normal file
545
android/app/build.gradle
Normal file
|
@ -0,0 +1,545 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
//
|
||||
// The magic below is needed to disable Google Mobile Services (a.k.a GMS) and
|
||||
// Google Firebase Services during the build time. Unfortunately, the only way
|
||||
// to disable Gradle plugins is to add these hardcore switches to buildscript().
|
||||
//
|
||||
|
||||
// Detect flavors from the task name.
|
||||
def taskName = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
|
||||
def isFdroid = taskName.contains('fdroid')
|
||||
def isBeta = taskName.contains('beta')
|
||||
|
||||
// Enable Google Mobile Services for all flavors except fdroid.
|
||||
def googleMobileServicesDefault = !isFdroid
|
||||
// Add a parameter to force GMS.
|
||||
ext.googleMobileServicesEnabled = project.hasProperty('gms') ?: googleMobileServicesDefault
|
||||
|
||||
// Enable Firebase for all beta flavors except fdroid only if google-services.json exists.
|
||||
def googleFirebaseServicesDefault = isBeta && !isFdroid && file('google-services.json').exists()
|
||||
// Add a parameter to force Firebase.
|
||||
ext.googleFirebaseServicesEnabled = project.hasProperty('firebase') ?: googleFirebaseServicesDefault
|
||||
|
||||
// See https://developer.android.com/jetpack/androidx/releases/compose-kotlin
|
||||
// to see which kotlin version is compatible with compose
|
||||
ext.kotlin_version = '1.9.0'
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.0'
|
||||
|
||||
if (googleMobileServicesEnabled) {
|
||||
println('Building with Google Mobile Services')
|
||||
classpath 'com.google.gms:google-services:4.3.15'
|
||||
} else {
|
||||
println('Building without Google Services')
|
||||
}
|
||||
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
println('Building with Google Firebase Services')
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
|
||||
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.0'
|
||||
} else {
|
||||
println('Building without Google Firebase Services')
|
||||
}
|
||||
|
||||
classpath('com.github.triplet.gradle:play-publisher:3.8.3')
|
||||
classpath('ru.cian:huawei-publish-gradle-plugin:1.4.0')
|
||||
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://www.jitpack.io' } // MPAndroidChart
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: 'secure.properties'
|
||||
if (googleMobileServicesEnabled) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
}
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'com.google.firebase.appdistribution'
|
||||
}
|
||||
apply plugin: 'com.github.triplet.play'
|
||||
apply plugin: 'ru.cian.huawei-publish-gradle-plugin'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
dependencies {
|
||||
// Google Mobile Services
|
||||
if (googleMobileServicesEnabled) {
|
||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||
}
|
||||
|
||||
// Google Firebase Services
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
// Import the BoM for the Firebase platform
|
||||
implementation platform('com.google.firebase:firebase-bom:32.1.0')
|
||||
// Add the dependencies for the Crashlytics and Analytics libraries
|
||||
// When using the BoM, you don't specify versions in Firebase library dependencies
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ndk'
|
||||
}
|
||||
|
||||
|
||||
// Kotlin
|
||||
implementation 'androidx.core:core-ktx:1.10.1'
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlin_version"))
|
||||
|
||||
// Dependencies for Jetpack Compose
|
||||
// See https://developer.android.com/jetpack/compose/setup#setup-compose
|
||||
def composeBom = platform('androidx.compose:compose-bom:2023.04.01')
|
||||
implementation composeBom
|
||||
androidTestImplementation composeBom
|
||||
// Material Design 2
|
||||
implementation 'androidx.compose.material:material'
|
||||
// Android Studio Preview support
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||
// Optional - Integration with activities
|
||||
implementation 'androidx.activity:activity-compose:1.7.1'
|
||||
// Optional - Integration with ViewModels
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1'
|
||||
// Optional - Integration with LiveData
|
||||
implementation 'androidx.compose.runtime:runtime-livedata'
|
||||
// Optional - Allows controlling status bar and navigation bar
|
||||
implementation "com.google.accompanist:accompanist-systemuicontroller:0.31.2-alpha"
|
||||
|
||||
implementation 'androidx.annotation:annotation:1.6.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.fragment:fragment:1.5.7'
|
||||
implementation 'androidx.preference:preference:1.2.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
||||
implementation 'androidx.work:work-runtime:2.8.1'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'com.github.devnullorthrow:MPAndroidChart:3.2.0-alpha'
|
||||
implementation 'net.jcip:jcip-annotations:1.0'
|
||||
|
||||
// Test Dependencies
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.3.1'
|
||||
testImplementation 'org.mockito:mockito-inline:5.2.0'
|
||||
}
|
||||
|
||||
def run(cmd) {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine = cmd
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString()
|
||||
}
|
||||
|
||||
|
||||
import com.github.triplet.gradle.androidpublisher.ReleaseStatus
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
|
||||
def getVersion() {
|
||||
def isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows()
|
||||
def bash = isWindows ? 'C:\\Program Files\\Git\\bin\\bash.exe' : 'bash'
|
||||
def versionCode = Integer.parseInt(run([bash, '../../tools/unix/version.sh', 'android_code']).trim())
|
||||
def versionName = run([bash, '../../tools/unix/version.sh', 'android_name']).trim()
|
||||
return new Tuple2(versionCode, versionName)
|
||||
}
|
||||
|
||||
def getCommitMessage() {
|
||||
return run(['git', '--no-pager', 'show', '-s', '--format=%s%n%n%b', 'HEAD']).trim()
|
||||
}
|
||||
|
||||
def osName = System.properties['os.name'].toLowerCase()
|
||||
|
||||
project.ext.appId = 'app.organicmaps'
|
||||
project.ext.appName = 'Organic Maps'
|
||||
|
||||
android {
|
||||
namespace 'app.organicmaps'
|
||||
|
||||
buildFeatures {
|
||||
dataBinding = true
|
||||
compose true
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.2"
|
||||
}
|
||||
// All properties are read from gradle.properties file
|
||||
compileSdkVersion propCompileSdkVersion.toInteger()
|
||||
buildToolsVersion propBuildToolsVersion
|
||||
|
||||
ndkVersion '25.2.9519653'
|
||||
|
||||
defaultConfig {
|
||||
// Default package name is taken from the manifest and should be app.organicmaps
|
||||
def ver = getVersion()
|
||||
versionCode = ver.V1
|
||||
versionName = ver.V2
|
||||
println('Version: ' + versionName)
|
||||
println('VersionCode: ' + versionCode)
|
||||
minSdkVersion propMinSdkVersion.toInteger()
|
||||
targetSdkVersion propTargetSdkVersion.toInteger()
|
||||
applicationId project.ext.appId
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"android@organicmaps.app"'
|
||||
// Should be customized in flavors.
|
||||
buildConfigField 'String', 'REVIEW_URL', '""'
|
||||
resourceConfigurations += [project.ext.supportedLocalizations]
|
||||
|
||||
multiDexEnabled true
|
||||
multiDexKeepFile file('multidex-config.txt')
|
||||
|
||||
externalNativeBuild {
|
||||
def pchFlag = 'OFF'
|
||||
if (project.hasProperty('pch')) pchFlag = 'ON'
|
||||
|
||||
def njobs = ''
|
||||
if (project.hasProperty('njobs')) njobs = project.getProperty('njobs')
|
||||
|
||||
cmake {
|
||||
cppFlags '-fexceptions', '-frtti'
|
||||
// There is no sense to enable sections without gcc's --gc-sections flag.
|
||||
cFlags '-fno-function-sections', '-fno-data-sections',
|
||||
'-Wno-extern-c-compat'
|
||||
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static',
|
||||
"-DOS=$osName", '-DSKIP_TESTS=ON', "-DUSE_PCH=$pchFlag",
|
||||
"-DNJOBS=$njobs"
|
||||
targets 'organicmaps'
|
||||
}
|
||||
}
|
||||
|
||||
// Use, for example, -Parm32 gradle parameter to build only for armeabi-v7a.
|
||||
ndk {
|
||||
abiFilters = new HashSet<>()
|
||||
if (project.hasProperty('arm32') || project.hasProperty('armeabi-v7a')) {
|
||||
abiFilters.add('armeabi-v7a')
|
||||
}
|
||||
if (project.hasProperty('arm64') || project.hasProperty('arm64-v8a')) {
|
||||
abiFilters.add('arm64-v8a')
|
||||
}
|
||||
if (project.hasProperty('x86')) {
|
||||
abiFilters.add('x86')
|
||||
}
|
||||
if (project.hasProperty('x86_64') || project.hasProperty('x64')) {
|
||||
abiFilters.add('x86_64')
|
||||
}
|
||||
if (abiFilters.isEmpty()) {
|
||||
abiFilters.add('armeabi-v7a')
|
||||
abiFilters.add('arm64-v8a')
|
||||
// For the emulator, chromebooks and some Intel Atom devices.
|
||||
abiFilters.add('x86_64')
|
||||
}
|
||||
println("Building for " + abiFilters + " archs.")
|
||||
}
|
||||
|
||||
setProperty("archivesBaseName", appName.replaceAll("\\s","") + "-" + defaultConfig.versionCode)
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
// manifest.srcFile 'AndroidManifest.xml'
|
||||
// res.srcDirs = ['res']
|
||||
// java.srcDirs = ['src']
|
||||
if (googleMobileServicesEnabled) {
|
||||
java.srcDirs += 'src/flavors/gms-enabled'
|
||||
} else {
|
||||
java.srcDirs += 'src/flavors/gms-disabled'
|
||||
}
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
java.srcDirs += 'src/flavors/firebase-enabled'
|
||||
} else {
|
||||
java.srcDirs += 'src/flavors/firebase-disabled'
|
||||
}
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
|
||||
productFlavors {
|
||||
// 01 is a historical artefact, sorry.
|
||||
final int HUAWEI_VERSION_CODE_BASE = 01_00_00_00_00
|
||||
|
||||
google {
|
||||
dimension "default"
|
||||
versionName = android.defaultConfig.versionName + '-Google'
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"googleplay@organicmaps.app"'
|
||||
buildConfigField 'String', 'REVIEW_URL', '"market://details?id=app.organicmaps"'
|
||||
android.sourceSets.google.assets.srcDirs = ['flavors/world-enabled']
|
||||
}
|
||||
|
||||
web {
|
||||
dimension "default"
|
||||
versionName = android.defaultConfig.versionName + '-Web'
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"apk@organicmaps.app"'
|
||||
//android.sourceSets.web.assets.srcDirs = ['flavors/world-enabled']
|
||||
}
|
||||
|
||||
fdroid {
|
||||
dimension "default"
|
||||
versionName = android.defaultConfig.versionName + '-FDroid'
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"fdroid@organicmaps.app"'
|
||||
//android.sourceSets.fdroid.assets.srcDirs = ['flavors/world-enabled']
|
||||
}
|
||||
|
||||
huawei {
|
||||
dimension "default"
|
||||
versionName = android.defaultConfig.versionName + '-Huawei'
|
||||
versionCode = HUAWEI_VERSION_CODE_BASE + android.defaultConfig.versionCode
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"huawei@organicmaps.app"'
|
||||
buildConfigField 'String', 'REVIEW_URL', '"appmarket://details?id=app.organicmaps"'
|
||||
android.sourceSets.huawei.assets.srcDirs = ['flavors/world-enabled']
|
||||
}
|
||||
}
|
||||
|
||||
playConfigs {
|
||||
googleRelease {
|
||||
enabled.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
splits.abi {
|
||||
boolean enabled = project.hasProperty('splitApk')
|
||||
println ("Create separate apks: " + enabled)
|
||||
enable enabled
|
||||
reset()
|
||||
include 'x86', 'armeabi-v7a', 'arm64-v8a', 'x86_64'
|
||||
universalApk true
|
||||
}
|
||||
|
||||
lint {
|
||||
disable 'MissingTranslation'
|
||||
// https://github.com/organicmaps/organicmaps/issues/3551
|
||||
disable 'MissingQuantity', 'UnusedQuantity'
|
||||
// https://github.com/organicmaps/organicmaps/issues/3550
|
||||
disable 'ByteOrderMark'
|
||||
// https://github.com/organicmaps/organicmaps/issues/1077
|
||||
disable 'CustomSplashScreen'
|
||||
// https://github.com/organicmaps/organicmaps/issues/3610
|
||||
disable 'InsecureBaseConfiguration'
|
||||
// https://github.com/organicmaps/organicmaps/issues/3608
|
||||
disable 'UnusedResources'
|
||||
abortOnError true
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
android.applicationVariants.all { variant ->
|
||||
def task = variant.name.capitalize()
|
||||
project.task(type: Exec, "run${task}", dependsOn: "install${task}") {
|
||||
commandLine android.getAdbExe(), 'shell', 'am', 'start', '-n', "${applicationId}/app.organicmaps.SplashActivity"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('debug.keystore')
|
||||
storePassword '12345678'
|
||||
keyAlias 'debug'
|
||||
keyPassword '12345678'
|
||||
}
|
||||
|
||||
release {
|
||||
storeFile file(spropStoreFile)
|
||||
storePassword spropStorePassword
|
||||
keyAlias spropKeyAlias
|
||||
keyPassword spropKeyPassword
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
benchmark {
|
||||
initWith release
|
||||
signingConfig signingConfigs.debug
|
||||
matchingFallbacks = ['release']
|
||||
debuggable false
|
||||
resValue 'string', 'app_id', android.defaultConfig.applicationId
|
||||
resValue 'string', 'app_name', project.ext.appName
|
||||
}
|
||||
debug {
|
||||
applicationIdSuffix '.debug' // Allows to install debug and release builds together
|
||||
versionNameSuffix '-debug'
|
||||
jniDebuggable true // Enable jni debug build
|
||||
zipAlignEnabled true
|
||||
signingConfig signingConfigs.debug
|
||||
resValue 'string', 'app_id', android.defaultConfig.applicationId + applicationIdSuffix
|
||||
resValue 'string', 'app_name', project.ext.appName + ' ' + '(Debug)'
|
||||
// Do not generate separate debug symbols for debug apps, because we don't distribute them.
|
||||
ndk.debugSymbolLevel = 'none'
|
||||
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
// Keep debug symbols for test lab.
|
||||
ndk.debugSymbolLevel = 'symbol_table'
|
||||
firebaseCrashlytics {
|
||||
nativeSymbolUploadEnabled true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
|
||||
// To learn more, go to the documentation section about R8 configuration files.
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-mwm.txt'
|
||||
resValue 'string', 'app_id', android.defaultConfig.applicationId
|
||||
resValue 'string', 'app_name', project.ext.appName
|
||||
// Full size symbols are too big for Google, 217mb aab vs 95mb.
|
||||
ndk.debugSymbolLevel = 'symbol_table'
|
||||
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
firebaseCrashlytics {
|
||||
nativeSymbolUploadEnabled true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
beta {
|
||||
applicationIdSuffix '.beta'
|
||||
versionNameSuffix '-beta'
|
||||
signingConfig signingConfigs.release
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
|
||||
// To learn more, go to the documentation section about R8 configuration files.
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-mwm.txt'
|
||||
matchingFallbacks = ['debug', 'release']
|
||||
resValue 'string', 'app_id', android.defaultConfig.applicationId + applicationIdSuffix
|
||||
resValue 'string', 'app_name', project.ext.appName + ' ' + '(Beta)'
|
||||
// Full size symbols are too big for Google, 217mb aab vs 95mb.
|
||||
ndk.debugSymbolLevel = 'symbol_table'
|
||||
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
firebaseCrashlytics {
|
||||
nativeSymbolUploadEnabled true
|
||||
}
|
||||
firebaseAppDistribution {
|
||||
// A new beta release is created for each commit.
|
||||
// Use the last commit message for the release notes.
|
||||
releaseNotes = getCommitMessage()
|
||||
groups = "qa" // Notify only selected people.
|
||||
serviceCredentialsFile = "firebase-app-distribution.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.22.1+"
|
||||
buildStagingDirectory "./nativeOutputs"
|
||||
path "../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
||||
// We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk.
|
||||
// TODO: Load all minor files via separate call to ReadAsString which can correctly handle compressed files in zip containers.
|
||||
androidResources {
|
||||
ignoreAssetsPattern '!.svn:!.git:!.DS_Store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
noCompress 'txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config', 'csv', 'spv', 'obj'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
packagingOptions.jniLibs {
|
||||
excludes += [
|
||||
'lib/**/libVkLayer_khronos_validation.so',
|
||||
'lib/**/libVkLayer_core_validation.so',
|
||||
'lib/**/libVkLayer_threading.so',
|
||||
'lib/**/libVkLayer_image.so',
|
||||
'lib/**/libVkLayer_parameter_validation.so',
|
||||
'lib/**/libVkLayer_object_tracker.so',
|
||||
'lib/**/libVkLayer_swapchain.so',
|
||||
'lib/**/libVkLayer_unique_objects.so',
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
|
||||
android.buildTypes.all { buildType ->
|
||||
def suffix = applicationIdSuffix != null ? applicationIdSuffix : ""
|
||||
def authorityValue = android.defaultConfig.applicationId + suffix + ".provider"
|
||||
def authority = "\"" + authorityValue + "\""
|
||||
buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', authority
|
||||
manifestPlaceholders += [FILE_PROVIDER_PLACEHOLDER : authorityValue]
|
||||
}
|
||||
|
||||
task prepareGoogleReleaseListing {
|
||||
// Prepares Google Play metainfo from F-Droid metainfo.
|
||||
final sourceFlavor = 'fdroid'
|
||||
final targetFlavor = 'google'
|
||||
doLast {
|
||||
final sourceDir = new File("${projectDir}/src/main/$sourceFlavor/play/listings")
|
||||
final targetDir = new File("${projectDir}/src/main/$targetFlavor/play/listings")
|
||||
final sourceFiles = fileTree(dir: sourceDir,
|
||||
include: "**/*.txt", exclude: "**/*-${targetFlavor}.txt")
|
||||
sourceFiles.each { File sourceFile ->
|
||||
final locale = sourceFile.parentFile.getName()
|
||||
final targetLocaleDir = new File(targetDir, locale)
|
||||
if (!targetLocaleDir.isDirectory())
|
||||
targetLocaleDir.mkdirs()
|
||||
final targetFile = new File(targetLocaleDir, sourceFile.getName())
|
||||
// Override Google-specific values by using ${name}-google.txt files.
|
||||
final overrideFile = new File(sourceFile.getPath().replace(".txt", "-${targetFlavor}.txt"))
|
||||
targetFile.text = overrideFile.exists() ? overrideFile.text : sourceFile.text
|
||||
}
|
||||
copy {
|
||||
from "${projectDir}/../../screenshots/android"
|
||||
into targetDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
play {
|
||||
enabled.set(false)
|
||||
track.set("production")
|
||||
userFraction.set(Double.valueOf(0.10)) // 10%
|
||||
defaultToAppBundles.set(true)
|
||||
releaseStatus.set(ReleaseStatus.IN_PROGRESS)
|
||||
serviceAccountCredentials.set(file("google-play.json"))
|
||||
}
|
||||
|
||||
huaweiPublish {
|
||||
instances {
|
||||
huaweiRelease {
|
||||
credentialsPath = "$rootDir/huawei-appgallery.json"
|
||||
buildFormat = 'aab'
|
||||
deployType = 'draft' // confirm manually
|
||||
releaseNotes = []
|
||||
def localeOverride = [
|
||||
'am' : 'am-ET',
|
||||
'gu': 'gu_IN',
|
||||
'iw-IL': 'he_IL',
|
||||
'kn-IN': 'kn_IN',
|
||||
'ml-IN': 'ml_IN',
|
||||
'mn-MN': 'mn_MN',
|
||||
'mr-IN': 'mr_IN',
|
||||
'ta-IN': 'ta_IN',
|
||||
'te-IN': 'te_IN',
|
||||
]
|
||||
def files = fileTree(dir: "$projectDir/src/main/fdroid/play/listings",
|
||||
include: '**/release-notes.txt')
|
||||
files.each { File file ->
|
||||
def path = file.getPath()
|
||||
def locale = file.parentFile.getName()
|
||||
locale = localeOverride.get(locale, locale)
|
||||
releaseNotes.add(new ru.cian.huawei.publish.ReleaseNote(locale, path))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
@ -0,0 +1,28 @@
|
|||
package app.organicmaps;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest
|
||||
{
|
||||
@Test
|
||||
public void useAppContext()
|
||||
{
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("app.organicmaps", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -69,7 +69,7 @@
|
|||
android:supportsRtl="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:targetApi="t">
|
||||
|
||||
<profileable android:shell="true" />
|
||||
<activity
|
||||
android:name="app.organicmaps.SplashActivity"
|
||||
android:exported="true">
|
|
@ -4,7 +4,7 @@ project(organicmaps C CXX)
|
|||
|
||||
set(SRC
|
||||
# JNI headers
|
||||
../../private.h
|
||||
../../../../../private.h
|
||||
app/organicmaps/core/jni_helper.hpp
|
||||
app/organicmaps/core/jni_java_methods.hpp
|
||||
app/organicmaps/core/logging.hpp
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue