Skip to content

Commit cce4008

Browse files
authored
Merge pull request #226 from opatry/ktor-monitor
Ktor monitor
2 parents bb8da0b + 800159d commit cce4008

File tree

15 files changed

+105
-10
lines changed

15 files changed

+105
-10
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: ©️ Generate credits for ':tasks-app-desktop'
4747
id: check_desktop_app_credits
4848
run: |
49-
./gradlew --no-daemon :tasks-app-desktop:exportLibraryDefinitions
49+
./gradlew --no-daemon :tasks-app-desktop:exportLibraryDefinitions -Pci=true
5050
stale_credits=$(git diff tasks-app-desktop/src/main/resources/licenses_desktop.json)
5151
if [ -n "${stale_credits}" ]; then
5252
{
@@ -79,7 +79,7 @@ jobs:
7979
- name: ©️ Generate credits for ':tasks-app-android'
8080
id: check_android_app_credits
8181
run: |
82-
./gradlew --no-daemon :tasks-app-android:exportLibraryDefinitions
82+
./gradlew --no-daemon :tasks-app-android:exportLibraryDefinitions -Pci=true
8383
stale_credits=$(git diff tasks-app-android/src/main/assets/licenses_android.json)
8484
if [ -n "${stale_credits}" ]; then
8585
{

_ci/generate_github_comment_stale_credits.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ set -euo pipefail
88
case "$1" in
99
":tasks-app-android")
1010
diff=$(git diff tasks-app-android/src/main/assets/licenses_android.json | awk '{printf "%s\\n", $0}')
11-
update_cmd="./gradlew :tasks-app-android:exportLibraryDefinitions"
11+
update_cmd="./gradlew :tasks-app-android:exportLibraryDefinitions -Pci=true"
1212
;;
1313
":tasks-app-desktop")
1414
diff=$(git diff tasks-app-desktop/src/main/resources/licenses_desktop.json | awk '{printf "%s\\n", $0}')
15-
update_cmd="./gradlew :tasks-app-desktop:exportLibraryDefinitions"
15+
update_cmd="./gradlew :tasks-app-desktop:exportLibraryDefinitions -Pci=true"
1616
;;
1717
*)
1818
echo "Unsupported app module"

_ci/update_credits_json.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ origin=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) || exit
77
cd "${origin}/.."
88

99
find . -name "licenses*.json" -delete
10-
./gradlew "exportLibraryDefinitions"
10+
./gradlew "exportLibraryDefinitions" -Pci=true

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ kotlin = "2.2.0-RC"
88
ksp = "2.2.0-RC-2.0.1"
99
coroutines = "1.10.2"
1010
ktor = "3.1.3"
11+
ktor-monitor-logging = "1.7.1"
1112
activity-compose = "1.11.0-rc01"
1213
compose-plugin = "1.8.1"
1314
compose-hot-reload-plugin = "1.0.0-alpha10"
@@ -46,6 +47,9 @@ ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "k
4647
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
4748
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
4849

50+
ktor-monitor-logging = { module = "ro.cosminmihu.ktor:ktor-monitor-logging", version.ref = "ktor-monitor-logging" }
51+
ktor-monitor-logging-no-op = { module = "ro.cosminmihu.ktor:ktor-monitor-logging-no-op", version.ref = "ktor-monitor-logging" }
52+
4953
slf4j-nop = { module = "org.slf4j:slf4j-nop", version = "2.0.17" }
5054

5155
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }

tasks-app-android/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ android {
105105
manifestPlaceholders["crashlyticsEnabled"] = true
106106

107107
// we allow dev signing config in release build when not in CI to allow release builds on dev machine
108-
val ciBuild = (findProperty("ci") as? String)?.toBoolean() ?: false
108+
val ciBuild = (findProperty("ci") as? String).toBoolean()
109109
signingConfig = if (signingConfigs.getByName("store").storeFile == null && !ciBuild) {
110110
signingConfigs.getByName("dev")
111111
} else {
@@ -175,7 +175,7 @@ dependencies {
175175

176176
aboutLibraries {
177177
// - If the automatic registered android tasks are disabled, a similar thing can be achieved manually
178-
// - `./gradlew :tasks-app-android:exportLibraryDefinitions`
178+
// - `./gradlew :tasks-app-android:exportLibraryDefinitions -Pci=true`
179179
// - the resulting file can for example be added as part of the SCM
180180
collect {
181181
configPath = file("$rootDir/license_config")

tasks-app-android/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
Copyright (c) 2024 Olivier Patry
3+
Copyright (c) 2025 Olivier Patry
44
55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the "Software"),
@@ -21,10 +21,13 @@
2121
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222
-->
2323

24-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
24+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
25+
xmlns:tools="http://schemas.android.com/tools">
2526

2627
<uses-permission android:name="android.permission.INTERNET" />
2728

29+
<uses-sdk tools:overrideLibrary="ro.cosminmihu.ktor.monitor" />
30+
2831
<application
2932
android:allowBackup="true"
3033
android:icon="@mipmap/ic_launcher"

tasks-app-android/src/main/assets/licenses_android.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,20 @@
29992999
"organization": {
30003000
"name": "QOS.ch"
30013001
}
3002+
},
3003+
{
3004+
"uniqueId": "ro.cosminmihu.ktor:ktor-monitor-logging-no-op",
3005+
"developers": [
3006+
{
3007+
"name": "Cosmin Mihu"
3008+
}
3009+
],
3010+
"artifactVersion": "1.7.1",
3011+
"description": "Powerful tools to log Ktor Client requests and responses, making it easier to debug and analyze network communication.",
3012+
"name": "Ktor Monitor",
3013+
"licenses": [
3014+
"Apache-2.0"
3015+
]
30023016
}
30033017
],
30043018
"licenses": {

tasks-app-desktop/build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ plugins {
3838
val appName = "Taskfolio"
3939
val appVersion = libs.versions.tasksApp.name.get()
4040
val appVersionCode = System.getenv("CI_BUILD_NUMBER")?.toIntOrNull() ?: 1
41+
val ciBuild = (findProperty("ci") as? String).toBoolean()
4142

4243
compose.resources {
4344
publicResClass = false
@@ -69,6 +70,12 @@ kotlin {
6970
implementation(projects.google.tasks)
7071
implementation(projects.tasksAppShared)
7172

73+
if (ciBuild) {
74+
implementation(libs.ktor.monitor.logging.no.op)
75+
} else {
76+
implementation(libs.ktor.monitor.logging)
77+
}
78+
7279
testImplementation(kotlin("test"))
7380
testImplementation(libs.koin.test)
7481
testImplementation(libs.ktor.client.core) {
@@ -95,6 +102,7 @@ compose.desktop {
95102
"-Dapp.name=$appName",
96103
"-Dapp.version=$appVersion",
97104
"-Dapp.version.full=${appVersion}.${appVersionCode}",
105+
"-Dbuild.release=$ciBuild"
98106
)
99107

100108
nativeDistributions {
@@ -161,7 +169,7 @@ compose.desktop {
161169

162170
aboutLibraries {
163171
// - If the automatic registered android tasks are disabled, a similar thing can be achieved manually
164-
// - `./gradlew :tasks-app-desktop:exportLibraryDefinitions`
172+
// - `./gradlew :tasks-app-desktop:exportLibraryDefinitions -Pci=true`
165173
// - the resulting file can for example be added as part of the SCM
166174
collect {
167175
configPath = file("$rootDir/license_config")

tasks-app-desktop/src/main/composeResources/values-fr/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
<string name="app_menu_edit">Édition</string>
2525
<string name="app_menu_edit_new_task_list">Nouvelle liste de tâches…</string>
2626
<string name="app_menu_edit_new_task">Nouvelle tâche…</string>
27+
<string name="app_menu_tools">Outils</string>
28+
<string name="app_menu_tools_show_network_logs">Afficher les logs réseau</string>
2729
</resources>

tasks-app-desktop/src/main/composeResources/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
<string name="app_menu_edit">Edit</string>
2525
<string name="app_menu_edit_new_task_list">New task list…</string>
2626
<string name="app_menu_edit_new_task">New task…</string>
27+
<string name="app_menu_tools">Tools</string>
28+
<string name="app_menu_tools_show_network_logs">Show network logs</string>
2729
</resources>

0 commit comments

Comments
 (0)