From 79861349291f7e7d18a0b4d229d527d9da8410b7 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 4 May 2022 19:03:47 +0300 Subject: [PATCH] Update latest fastlane changelog entry when generating translation files --- .../translations/TranslationFileWriter.kt | 25 ++++++++++++++++--- .../metadata/android/en-US/changelogs/704.txt | 24 +++++------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/core/src/com/unciv/models/translations/TranslationFileWriter.kt b/core/src/com/unciv/models/translations/TranslationFileWriter.kt index 4b4a0710b8..7ef124b0c9 100644 --- a/core/src/com/unciv/models/translations/TranslationFileWriter.kt +++ b/core/src/com/unciv/models/translations/TranslationFileWriter.kt @@ -483,13 +483,15 @@ object TranslationFileWriter { * @return Success or error message. */ private fun writeTranslatedFastlaneFiles(translations: Translations): String { - return try { + try { writeFastlaneFiles(shortDescriptionFile, translations[shortDescriptionKey], false) writeFastlaneFiles(fullDescriptionFile, translations[fullDescriptionKey], true) - "Fastlane files are generated successfully." + updateFastlaneChangelog() + + return "Fastlane files are generated successfully." } catch (ex: Throwable) { ex.printStackTrace() - ex.localizedMessage ?: ex.javaClass.simpleName + return ex.localizedMessage ?: ex.javaClass.simpleName } } @@ -507,6 +509,23 @@ object TranslationFileWriter { File(path + File.separator + fileName).writeText(fileContent) } } + + // Original changelog entry, written by incrementVersionAndChangelog, is often changed manually for readability. + // This updates the fastlane changelog entry to match the latest one in changelog.md + private fun updateFastlaneChangelog() { + // Relative path since we're in android/assets + val changelogFile = File("../../changelog.md").readText() + // first group catches the version name, second group catches the rest of the version changelog + // changelogs by definition do not have #'s in them so we can use it as a delimiter + val latestVersionRegexGroup = Regex("## \\S*([^#]*)").find(changelogFile) + val versionChangelog = latestVersionRegexGroup!!.groups[1]!!.value.trim() + val buildConfigFile = File("../../buildSrc/src/main/kotlin/BuildConfig.kt").readText() + val versionNumber = + Regex("appCodeNumber = (\\d*)").find(buildConfigFile)!!.groups[1]!!.value + + val fileName = "$fastlanePath/en-US/changelogs/$versionNumber.txt" + File(fileName).writeText(versionChangelog) + } //endregion } diff --git a/fastlane/metadata/android/en-US/changelogs/704.txt b/fastlane/metadata/android/en-US/changelogs/704.txt index 43885ca7f0..a205a300ff 100644 --- a/fastlane/metadata/android/en-US/changelogs/704.txt +++ b/fastlane/metadata/android/en-US/changelogs/704.txt @@ -1,27 +1,15 @@ -## 4.0.12 - -Minor performance improvement for border strings - By SomeTroglodyte: -- Optimize String to Stat and Translation mod list somewhat -- Implement fastlane step 2: Translating -- Show available resources from CityScreen (bottom right info only) -- Fastlane - sort screenshots by renaming -- Unciv Adaptive Android Icon -- Fix TileInfo.neighbors being incomplete in rare circumstances +- Show available resources from CityScreen +- F-droid integration improvements! By JackRainy: - Allow city connections via open borders and own harbors only -- Fix of the broken link in the uniques.md (once again) -- Enable scrolling for the oversized popups +- Enable scrolling for the oversized popups -Make 'Followers of this religion" translatable - By heipizhu4 - -Fix minimap actor leak - By Azzurite +Performance improvements - By Azzurite By xlenstra: - Fixed `provides [amount] [resource]` on buildings not accepting conditionals -- Implemented most easy things from comments on moddable victory PR - -check for internet before starting a mp game to avoid freeze - By alexban011 +- Implemented most things for moddable victory conditions +Check internet before starting mp game to avoid freeze - By alexban011 \ No newline at end of file