Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,16 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.ktor) apply false
alias(libs.plugins.aboutLibraries) apply false
}

// Regenerate all three iOS Version.xcconfig files from gradle/libs.versions.toml.
// Run this after bumping appVersionString / appBuildNumber, then commit the result.
tasks.register("updateIosVersions") {
group = "versioning"
description = "Regenerate iosApp/*/Configuration/Version.xcconfig from libs.versions.toml"
dependsOn(
":composeJournalsApp:generateIosVersionConfig",
":composeNotesApp:generateIosVersionConfig",
":composeTasksApp:generateIosVersionConfig",
)
}
36 changes: 36 additions & 0 deletions composeJournalsApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,39 @@ compose.desktop {
}
}
}

// --- iOS app versioning ---------------------------------------------------
// Single source of truth for the version lives in gradle/libs.versions.toml, the
// same values Android reads. This task writes them into the iOS xcconfig so the
// iOS app version stays in lockstep:
// MARKETING_VERSION <- appVersionString (-> CFBundleShortVersionString)
// CURRENT_PROJECT_VERSION <- appBuildNumber (-> CFBundleVersion)
// The generated file is #included by iosApp/iosJournalsApp/Configuration/Config.xcconfig.
// It's rewritten only when the values change, so normal builds don't dirty git.
val generateIosVersionConfig by tasks.registering {
val versionName = libs.versions.appVersionString.get()
val buildNumber = libs.versions.appBuildNumber.get()
val xcconfig = rootProject.file("iosApp/iosJournalsApp/Configuration/Version.xcconfig")
inputs.property("versionName", versionName)
inputs.property("buildNumber", buildNumber)
outputs.file(xcconfig)
doLast {
val content = buildString {
appendLine("// Generated from gradle/libs.versions.toml - do not edit by hand.")
appendLine("// Bump appVersionString / appBuildNumber there instead, then rebuild")
appendLine("// (or run ./gradlew :composeJournalsApp:generateIosVersionConfig).")
appendLine("MARKETING_VERSION = $versionName")
appendLine("CURRENT_PROJECT_VERSION = $buildNumber")
}
if (!xcconfig.exists() || xcconfig.readText() != content) {
xcconfig.parentFile.mkdirs()
xcconfig.writeText(content)
}
}
}

// Xcode's "Compile Kotlin Framework" build phase runs embedAndSignAppleFrameworkForXcode,
// so hooking in here keeps Version.xcconfig fresh on every iOS build.
tasks.matching { it.name == "embedAndSignAppleFrameworkForXcode" }.configureEach {
dependsOn(generateIosVersionConfig)
}
36 changes: 36 additions & 0 deletions composeNotesApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,39 @@ compose.desktop {
}
}
}

// --- iOS app versioning ---------------------------------------------------
// Single source of truth for the version lives in gradle/libs.versions.toml, the
// same values Android reads. This task writes them into the iOS xcconfig so the
// iOS app version stays in lockstep:
// MARKETING_VERSION <- appVersionString (-> CFBundleShortVersionString)
// CURRENT_PROJECT_VERSION <- appBuildNumber (-> CFBundleVersion)
// The generated file is #included by iosApp/iosNotesApp/Configuration/Config.xcconfig.
// It's rewritten only when the values change, so normal builds don't dirty git.
val generateIosVersionConfig by tasks.registering {
val versionName = libs.versions.appVersionString.get()
val buildNumber = libs.versions.appBuildNumber.get()
val xcconfig = rootProject.file("iosApp/iosNotesApp/Configuration/Version.xcconfig")
inputs.property("versionName", versionName)
inputs.property("buildNumber", buildNumber)
outputs.file(xcconfig)
doLast {
val content = buildString {
appendLine("// Generated from gradle/libs.versions.toml - do not edit by hand.")
appendLine("// Bump appVersionString / appBuildNumber there instead, then rebuild")
appendLine("// (or run ./gradlew :composeNotesApp:generateIosVersionConfig).")
appendLine("MARKETING_VERSION = $versionName")
appendLine("CURRENT_PROJECT_VERSION = $buildNumber")
}
if (!xcconfig.exists() || xcconfig.readText() != content) {
xcconfig.parentFile.mkdirs()
xcconfig.writeText(content)
}
}
}

// Xcode's "Compile Kotlin Framework" build phase runs embedAndSignAppleFrameworkForXcode,
// so hooking in here keeps Version.xcconfig fresh on every iOS build.
tasks.matching { it.name == "embedAndSignAppleFrameworkForXcode" }.configureEach {
dependsOn(generateIosVersionConfig)
}
36 changes: 36 additions & 0 deletions composeTasksApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,39 @@ compose.desktop {
}
}
}

// --- iOS app versioning ---------------------------------------------------
// Single source of truth for the version lives in gradle/libs.versions.toml, the
// same values Android reads. This task writes them into the iOS xcconfig so the
// iOS app version stays in lockstep:
// MARKETING_VERSION <- appVersionString (-> CFBundleShortVersionString)
// CURRENT_PROJECT_VERSION <- appBuildNumber (-> CFBundleVersion)
// The generated file is #included by iosApp/iosTasksApp/Configuration/Config.xcconfig.
// It's rewritten only when the values change, so normal builds don't dirty git.
val generateIosVersionConfig by tasks.registering {
val versionName = libs.versions.appVersionString.get()
val buildNumber = libs.versions.appBuildNumber.get()
val xcconfig = rootProject.file("iosApp/iosTasksApp/Configuration/Version.xcconfig")
inputs.property("versionName", versionName)
inputs.property("buildNumber", buildNumber)
outputs.file(xcconfig)
doLast {
val content = buildString {
appendLine("// Generated from gradle/libs.versions.toml - do not edit by hand.")
appendLine("// Bump appVersionString / appBuildNumber there instead, then rebuild")
appendLine("// (or run ./gradlew :composeTasksApp:generateIosVersionConfig).")
appendLine("MARKETING_VERSION = $versionName")
appendLine("CURRENT_PROJECT_VERSION = $buildNumber")
}
if (!xcconfig.exists() || xcconfig.readText() != content) {
xcconfig.parentFile.mkdirs()
xcconfig.writeText(content)
}
}
}

// Xcode's "Compile Kotlin Framework" build phase runs embedAndSignAppleFrameworkForXcode,
// so hooking in here keeps Version.xcconfig fresh on every iOS build.
tasks.matching { it.name == "embedAndSignAppleFrameworkForXcode" }.configureEach {
dependsOn(generateIosVersionConfig)
}
6 changes: 4 additions & 2 deletions iosApp/iosJournalsApp/Configuration/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Version.xcconfig"

DEVELOPMENT_TEAM=BZY8AT5K2W

PRODUCT_NAME=spectacledJournals
PRODUCT_BUNDLE_IDENTIFIER=at.techbee.spectacled.journals

CURRENT_PROJECT_VERSION=34
MARKETING_VERSION=1.0
// MARKETING_VERSION and CURRENT_PROJECT_VERSION come from Version.xcconfig, which is
// generated from gradle/libs.versions.toml. Do not set them here.
5 changes: 5 additions & 0 deletions iosApp/iosJournalsApp/Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Generated from gradle/libs.versions.toml - do not edit by hand.
// Bump appVersionString / appBuildNumber there instead, then rebuild
// (or run ./gradlew :composeJournalsApp:generateIosVersionConfig).
MARKETING_VERSION = 1.0.41
CURRENT_PROJECT_VERSION = 41
6 changes: 4 additions & 2 deletions iosApp/iosNotesApp/Configuration/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Version.xcconfig"

DEVELOPMENT_TEAM=BZY8AT5K2W

PRODUCT_NAME=spectacledNotes
PRODUCT_BUNDLE_IDENTIFIER=at.techbee.spectacled.notes

CURRENT_PROJECT_VERSION=34
MARKETING_VERSION=1.0
// MARKETING_VERSION and CURRENT_PROJECT_VERSION come from Version.xcconfig, which is
// generated from gradle/libs.versions.toml. Do not set them here.
5 changes: 5 additions & 0 deletions iosApp/iosNotesApp/Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Generated from gradle/libs.versions.toml - do not edit by hand.
// Bump appVersionString / appBuildNumber there instead, then rebuild
// (or run ./gradlew :composeNotesApp:generateIosVersionConfig).
MARKETING_VERSION = 1.0.41
CURRENT_PROJECT_VERSION = 41
6 changes: 4 additions & 2 deletions iosApp/iosTasksApp/Configuration/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Version.xcconfig"

DEVELOPMENT_TEAM=BZY8AT5K2W

PRODUCT_NAME=spectacledTasks
PRODUCT_BUNDLE_IDENTIFIER=at.techbee.spectacled.tasks

CURRENT_PROJECT_VERSION=34
MARKETING_VERSION=1.0
// MARKETING_VERSION and CURRENT_PROJECT_VERSION come from Version.xcconfig, which is
// generated from gradle/libs.versions.toml. Do not set them here.
5 changes: 5 additions & 0 deletions iosApp/iosTasksApp/Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Generated from gradle/libs.versions.toml - do not edit by hand.
// Bump appVersionString / appBuildNumber there instead, then rebuild
// (or run ./gradlew :composeTasksApp:generateIosVersionConfig).
MARKETING_VERSION = 1.0.41
CURRENT_PROJECT_VERSION = 41
Loading