File tree Expand file tree Collapse file tree 8 files changed +41
-15
lines changed
androidMain/kotlin/com/tunjid/heron/data/logging
desktopMain/kotlin/com/tunjid/heron/data/logging
src/commonMain/kotlin/com/tunjid/heron/data/platform Expand file tree Collapse file tree 8 files changed +41
-15
lines changed Original file line number Diff line number Diff line change 4242 ./gradlew spotlessCheck \
4343 bundleRelease \
4444 -Pheron.versionCode=${{ github.run_number }} \
45- -Pheron.isPlayStore =true \
45+ -Pheron.isRelease =true \
4646 -Pheron.endpoint="$HERON_ENDPOINT"
4747
4848 - name : Sign AAB
Original file line number Diff line number Diff line change @@ -125,12 +125,12 @@ persisted across app restarts.
125125The following properties can be set in ` ~/.gradle/gradle.properties ` or passed via ` -P ` flags.
126126None are required for basic development builds.
127127
128- | Property | Description |
129- | ---| ---|
130- | ` heron.versionCode ` | Integer version code. Managed by CI via ` github.run_number ` . |
131- | ` heron.endpoint ` | Backend endpoint URL for the app. |
132- | ` heron.isPlayStore ` | Set to ` true ` when building for Play Store distribution. |
133- | ` heron.releaseBranch ` | Branch prefix (` bugfix/ ` , ` feature/ ` , ` release/ ` ) controlling version increments. |
128+ | Property | Description |
129+ | ---| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
130+ | ` heron.versionCode ` | Integer version code. Managed by CI via ` github.run_number ` . |
131+ | ` heron.endpoint ` | Backend endpoint URL for the app. |
132+ | ` heron.isRelease ` | Set to ` true ` when building release artifacts. |
133+ | ` heron.releaseBranch ` | Branch prefix (` bugfix/ ` , ` feature/ ` , ` release/ ` ) controlling version increments. |
134134| ` heron.macOS.signing.identity ` | Name of the Developer ID Application certificate in your Keychain (e.g. ` Developer ID Application: Name (TEAM_ID) ` ). When present, the macOS DMG will be code signed. |
135135macOS signing is only configured when ` heron.macOS.signing.identity ` is present,
136136so contributors without an Apple Developer account can still build unsigned DMGs with
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ android {
154154 }
155155 val releaseSigning = when {
156156 // Do not sign the build output, it will be signed on CI
157- providers.gradleProperty(" heron.isPlayStore " ).orNull.toBoolean() -> null
157+ providers.gradleProperty(" heron.isRelease " ).orNull.toBoolean() -> null
158158 file(" debugKeystore.properties" ).exists() -> signingConfigs.create(" release" ) {
159159 val props = Properties ()
160160 file(" debugKeystore.properties" )
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ kotlin {
2727 sourceSets {
2828 commonMain {
2929 dependencies {
30+ implementation(project(" :data:platform" ))
3031 }
3132 }
3233 androidMain {
Original file line number Diff line number Diff line change 1717package com.tunjid.heron.data.logging
1818
1919import android.content.Context
20+ import com.tunjid.heron.data.platform.Platform
21+ import com.tunjid.heron.data.platform.current
2022import logcat.AndroidLogcatLogger
2123import logcat.LogPriority as SquareLogPriority
2224import logcat.LogcatLogger
@@ -28,12 +30,7 @@ class AndroidLogger(
2830) : Logger {
2931
3032 override fun install () {
31- val shouldLog = when (context.packageName.split(" ." ).lastOrNull()?.lowercase()) {
32- DEBUG ,
33- STAGING ,
34- -> true
35- else -> false
36- }
33+ val shouldLog = ! Platform .current.isRelease
3734 if (! LogcatLogger .isInstalled && shouldLog) {
3835 LogcatLogger .install()
3936 LogcatLogger .loggers + = AndroidLogcatLogger (SquareLogPriority .VERBOSE )
Original file line number Diff line number Diff line change 1616
1717package com.tunjid.heron.data.logging
1818
19+ import com.tunjid.heron.data.platform.Platform
20+ import com.tunjid.heron.data.platform.current
1921import logcat.LogPriority as SquareLogPriority
22+ import logcat.LogcatLogger
23+ import logcat.PrintLogger
2024import logcat.asLog as squareAsLog
2125import logcat.logcat as squareLogcat
2226
2327class JvmLogger : Logger {
2428 override fun install () {
25- // no-op on JVM
29+ val shouldLog = ! Platform .current.isRelease
30+ if (! LogcatLogger .isInstalled && shouldLog) {
31+ LogcatLogger .install()
32+ LogcatLogger .loggers + = PrintLogger
33+ }
2634 }
2735}
2836
Original file line number Diff line number Diff line change 1717plugins {
1818 id(" android-library-convention" )
1919 id(" kotlin-library-convention" )
20+ alias(libs.plugins.buildConfig)
2021}
2122
2223android {
2324 namespace = " com.tunjid.heron.data.platform"
2425}
26+
27+ buildConfig {
28+ packageName(" com.tunjid.heron.data.platform" )
29+
30+ useKotlinOutput {
31+ internalVisibility = true
32+ }
33+
34+ forClass(" Build" ) {
35+ buildConfigField(
36+ name = " isRelease" ,
37+ value = providers.gradleProperty(" heron.isRelease" )
38+ .map(String ::toBoolean)
39+ .orElse(false ),
40+ )
41+ }
42+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ package com.tunjid.heron.data.platform
1818
1919interface Platform {
2020 val name: String
21+ val isRelease: Boolean
22+ get() = Build .isRelease
2123
2224 companion object
2325}
You can’t perform that action at this time.
0 commit comments