From 5b5eb72ba74179c43aa285fdd6f0d1d1781f0e2c Mon Sep 17 00:00:00 2001 From: Ellen Poe Date: Fri, 23 Jan 2026 13:55:05 -0800 Subject: [PATCH 1/2] chore: move to murena infra --- cardinal-android/.gitignore | 2 +- cardinal-android/app/build.gradle.kts | 34 +++++++++++++++++++ .../maps/cardinal/data/AppPreferences.kt | 33 +++++++++++++----- .../tileserver/TileDownloadManager.kt | 2 +- .../app/src/main/res/values/strings.xml | 2 +- cardinal-android/gradle/libs.versions.toml | 2 +- docs/BASEMAP_GENERATION.md | 4 +-- 7 files changed, 65 insertions(+), 14 deletions(-) diff --git a/cardinal-android/.gitignore b/cardinal-android/.gitignore index 79e5d67..aeb393a 100644 --- a/cardinal-android/.gitignore +++ b/cardinal-android/.gitignore @@ -9,4 +9,4 @@ .externalNativeBuild .cxx local.properties - +secrets.properties diff --git a/cardinal-android/app/build.gradle.kts b/cardinal-android/app/build.gradle.kts index e1190a3..5e9a4be 100644 --- a/cardinal-android/app/build.gradle.kts +++ b/cardinal-android/app/build.gradle.kts @@ -17,6 +17,9 @@ */ import com.android.build.api.dsl.ApkSigningConfig +import java.io.FileInputStream +import java.io.FileNotFoundException +import java.util.Properties plugins { alias(libs.plugins.android.application) @@ -29,6 +32,30 @@ plugins { kotlin("plugin.serialization") version "2.2.21" } +val stadiaKey = + Properties().apply { + try { + load(FileInputStream(File(rootProject.projectDir, "secrets.properties"))) + } catch (ex: FileNotFoundException) { + // No-op. + } + }.getProperty("stadiaKey", "").ifEmpty { + val keyFromEnv = System.getenv("STADIA_KEY") + if (keyFromEnv.isNullOrEmpty()) { keyFromEnv } else { null } + } + +val defaultPeliasEndpoint = if (stadiaKey != null) { + "https://api.stadiamaps.com/geocoding/v1" +} else { + "https://maps.earth/pelias/v1" +} + +val defaultValhallaEndpoint = if (stadiaKey != null) { + "https://api.stadiamaps.com/route/v1" +} else { + "https://maps.earth/valhalla/route" +} + android { namespace = "earth.maps.cardinal" compileSdk = 36 @@ -80,11 +107,17 @@ android { signingConfig = signingConfigs["release"] as ApkSigningConfig manifestPlaceholders["icon"] = "@mipmap/ic_launcher" manifestPlaceholders["round_icon"] = "@mipmap/ic_launcher_round" + resValue("string", "default_pelias_endpoint", defaultPeliasEndpoint) + resValue("string", "default_valhalla_endpoint", defaultValhallaEndpoint) + resValue("string", "default_api_key", stadiaKey.orEmpty()) } debug { applicationIdSuffix = ".debug" manifestPlaceholders["icon"] = "@mipmap/ic_launcher_debug" manifestPlaceholders["round_icon"] = "@mipmap/ic_launcher_round_debug" + resValue("string", "default_pelias_endpoint", defaultPeliasEndpoint) + resValue("string", "default_valhalla_endpoint", defaultValhallaEndpoint) + resValue("string", "default_api_key", stadiaKey.orEmpty()) } } @@ -121,6 +154,7 @@ android { commandLine = listOf( "cargo", "run", + "--locked", "--bin", "uniffi-bindgen", "-p", diff --git a/cardinal-android/app/src/main/java/earth/maps/cardinal/data/AppPreferences.kt b/cardinal-android/app/src/main/java/earth/maps/cardinal/data/AppPreferences.kt index 66fa70b..0c8d07d 100644 --- a/cardinal-android/app/src/main/java/earth/maps/cardinal/data/AppPreferences.kt +++ b/cardinal-android/app/src/main/java/earth/maps/cardinal/data/AppPreferences.kt @@ -22,6 +22,7 @@ import android.content.Context import android.content.SharedPreferences import android.text.format.DateFormat import androidx.core.content.edit +import earth.maps.cardinal.R import java.util.Locale /** @@ -55,8 +56,6 @@ class AppPreferences(private val context: Context) { private const val KEY_VALHALLA_API_KEY = "valhalla_api_key" // Default values - private const val DEFAULT_PELIAS_BASE_URL = "https://maps.earth/pelias/v1" - private const val DEFAULT_VALHALLA_BASE_URL = "https://maps.earth/valhalla/route" private const val DEFAULT_LAST_ROUTING_MODE = "auto" // Contrast level constants @@ -338,8 +337,12 @@ class AppPreferences(private val context: Context) { * Returns the default Pelias base URL if none is saved. */ fun loadPeliasBaseUrl(): String { - return prefs.getString(KEY_PELIAS_BASE_URL, DEFAULT_PELIAS_BASE_URL) - ?: DEFAULT_PELIAS_BASE_URL + val url = prefs.getString(KEY_PELIAS_BASE_URL, null) + return if (url.isNullOrBlank()) { + context.getString(R.string.default_pelias_endpoint) + } else { + url + } } /** @@ -360,7 +363,12 @@ class AppPreferences(private val context: Context) { * Returns null if no API key is saved. */ fun loadPeliasApiKey(): String? { - return prefs.getString(KEY_PELIAS_API_KEY, null) + val key = prefs.getString(KEY_PELIAS_API_KEY, null) + return if (key.isNullOrBlank() && loadPeliasBaseUrl() == context.getString(R.string.default_pelias_endpoint)) { + context.getString(R.string.default_api_key) + } else { + key + } } // Valhalla API configuration methods @@ -379,8 +387,12 @@ class AppPreferences(private val context: Context) { * Returns the default Valhalla base URL if none is saved. */ fun loadValhallaBaseUrl(): String { - return prefs.getString(KEY_VALHALLA_BASE_URL, DEFAULT_VALHALLA_BASE_URL) - ?: DEFAULT_VALHALLA_BASE_URL + val url = prefs.getString(KEY_VALHALLA_BASE_URL, null) + return if (url.isNullOrBlank()) { + context.getString(R.string.default_valhalla_endpoint) + } else { + url + } } /** @@ -401,6 +413,11 @@ class AppPreferences(private val context: Context) { * Returns null if no API key is saved. */ fun loadValhallaApiKey(): String? { - return prefs.getString(KEY_VALHALLA_API_KEY, null) + val key = prefs.getString(KEY_VALHALLA_API_KEY, null) + return if (key.isNullOrBlank() && loadValhallaBaseUrl() == context.getString(R.string.default_valhalla_endpoint)) { + context.getString(R.string.default_api_key) + } else { + key + } } } diff --git a/cardinal-android/app/src/main/java/earth/maps/cardinal/tileserver/TileDownloadManager.kt b/cardinal-android/app/src/main/java/earth/maps/cardinal/tileserver/TileDownloadManager.kt index 0e725f5..ef8eea0 100644 --- a/cardinal-android/app/src/main/java/earth/maps/cardinal/tileserver/TileDownloadManager.kt +++ b/cardinal-android/app/src/main/java/earth/maps/cardinal/tileserver/TileDownloadManager.kt @@ -893,7 +893,7 @@ class TileDownloadManager( var fileOutputStream: FileOutputStream? = null try { val url = ValhallaTileUtils.getTileUrl( - "https://cardinaldata.airmail.rs/valhalla-250825", hierarchyLevel, tileIndex + "https://tiles.maps.murena.com/valhalla-250825", hierarchyLevel, tileIndex ) Log.v(TAG, "Downloading Valhalla tile $hierarchyLevel/$tileIndex from $url") diff --git a/cardinal-android/app/src/main/res/values/strings.xml b/cardinal-android/app/src/main/res/values/strings.xml index 0a4607d..12c8f68 100644 --- a/cardinal-android/app/src/main/res/values/strings.xml +++ b/cardinal-android/app/src/main/res/values/strings.xml @@ -118,7 +118,7 @@ Disabled - https://pmtiles.ellenhp.workers.dev/planet-250825.pmtiles/planet-250825/{z}/{x}/{y}.mvt + https://tiles.maps.murena.com/tiles/planet-260112/planet/{z}/{x}/{y}.mvt Offline Settings diff --git a/cardinal-android/gradle/libs.versions.toml b/cardinal-android/gradle/libs.versions.toml index 76c8a36..0693e64 100644 --- a/cardinal-android/gradle/libs.versions.toml +++ b/cardinal-android/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.13.1" +agp = "8.13.2" androidaddressformatter = "8f279fe" assertjCore = "3.27.6" desugar_jdk_libs = "2.1.5" diff --git a/docs/BASEMAP_GENERATION.md b/docs/BASEMAP_GENERATION.md index 6d6fd3f..e01af4e 100644 --- a/docs/BASEMAP_GENERATION.md +++ b/docs/BASEMAP_GENERATION.md @@ -73,7 +73,7 @@ You can refer to the [Planetiler documentation on full-planet builds](https://gi As of late 2025, the following command is recommended in the documentation for full-planet builds, and should work unmodified on sufficiently powerful hardware: ```bash -java -Xmx20g \ +java -Xmx40g \ -jar target/*with-deps.jar \ `# Use the planet.osm.pbf file downloaded earlier here.` \ --osm_path=$OSM_PATH --download \ @@ -96,7 +96,7 @@ PMTiles is a cloud-native format for collections of map tiles that allows a tile Latency between the tileserver instances and the Object Store should be minimized for good performance, and the Object Store must support HTTP range requests. -To perform the conversion, ensure a sufficiently modern version of **Go** is installed, and clone the PMTiles repository: https://github.com/protomaps/PMTiles +To perform the conversion, ensure a sufficiently modern version of **Go** is installed, and install the pmtiles utilities according to the [documentation](https://docs.protomaps.com/guide/getting-started) In the root of the PMTiles repo, run the following: `pmtiles convert $MBTILES_PATH planet.pmtiles` -- GitLab From 052fb0a942aeb992dd6e8844d21bc6357875da6f Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Thu, 29 Jan 2026 19:33:20 +0100 Subject: [PATCH 2/2] ci: build everytime --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63398a0..d3217d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -175,9 +175,6 @@ build_release: stage: release # Use an image with Android SDK pre-installed image: cimg/android:2024.01.1-ndk - # Only run on version tags (v*) - rules: - - if: '$CI_COMMIT_TAG =~ /^v.*/' # Resource group for concurrency control resource_group: android-release-${CI_COMMIT_REF_SLUG} variables: -- GitLab