From cd5f128fac5e3f203cced47618f53abcb134e9b0 Mon Sep 17 00:00:00 2001 From: Dara Keon Date: Sun, 3 Dec 2023 15:57:49 +0000 Subject: [PATCH] android: move test logs to main outputs --- .circleci/config.yml | 16 ++++++++-------- .circleci/pieces/20-test-android-lib-debug.yml | 4 ++-- .circleci/pieces/21-test-android-lib-release.yml | 4 ++-- .circleci/pieces/22-test-android-app-debug.yml | 4 ++-- .circleci/pieces/23-test-android-app-release.yml | 4 ++-- .../src/main/kotlin/com/darakeon/dfm/lib/Log.kt | 6 +----- outputs/logs/android/.gitignore | 1 + 7 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 outputs/logs/android/.gitignore diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d134bb929..f5143bc26e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -556,8 +556,8 @@ jobs: path: android command: gradle-with-metadata :Lib:testDebugUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/Lib/log - destination: log/lib + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml @@ -580,8 +580,8 @@ jobs: path: android command: gradle-with-metadata :Lib:testReleaseUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/Lib/log - destination: log/lib + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml @@ -604,8 +604,8 @@ jobs: path: android command: gradle-with-metadata :App:testDebugUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/App/log - destination: log/app + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml @@ -628,8 +628,8 @@ jobs: path: android command: gradle-with-metadata :App:testReleaseUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/App/log - destination: log/app + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml diff --git a/.circleci/pieces/20-test-android-lib-debug.yml b/.circleci/pieces/20-test-android-lib-debug.yml index 2ae3eb3363..afcc12645a 100644 --- a/.circleci/pieces/20-test-android-lib-debug.yml +++ b/.circleci/pieces/20-test-android-lib-debug.yml @@ -14,8 +14,8 @@ path: android command: gradle-with-metadata :Lib:testDebugUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/Lib/log - destination: log/lib + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml diff --git a/.circleci/pieces/21-test-android-lib-release.yml b/.circleci/pieces/21-test-android-lib-release.yml index af3aef5fcd..71dc970b94 100644 --- a/.circleci/pieces/21-test-android-lib-release.yml +++ b/.circleci/pieces/21-test-android-lib-release.yml @@ -14,8 +14,8 @@ path: android command: gradle-with-metadata :Lib:testReleaseUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/Lib/log - destination: log/lib + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml diff --git a/.circleci/pieces/22-test-android-app-debug.yml b/.circleci/pieces/22-test-android-app-debug.yml index 839587ed95..fbb833b3a9 100644 --- a/.circleci/pieces/22-test-android-app-debug.yml +++ b/.circleci/pieces/22-test-android-app-debug.yml @@ -14,8 +14,8 @@ path: android command: gradle-with-metadata :App:testDebugUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/App/log - destination: log/app + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml diff --git a/.circleci/pieces/23-test-android-app-release.yml b/.circleci/pieces/23-test-android-app-release.yml index 49ce055a27..e791c7789c 100644 --- a/.circleci/pieces/23-test-android-app-release.yml +++ b/.circleci/pieces/23-test-android-app-release.yml @@ -14,8 +14,8 @@ path: android command: gradle-with-metadata :App:testReleaseUnitTest -x androidDependencies -x build -x packageRelease -x packageDebug - store_artifacts: - path: android/App/log - destination: log/app + path: outputs/logs/android + destination: logs - store_artifacts: path: android/gradle/verification-metadata.xml destination: verification-metadata.xml diff --git a/android/Lib/src/main/kotlin/com/darakeon/dfm/lib/Log.kt b/android/Lib/src/main/kotlin/com/darakeon/dfm/lib/Log.kt index 024daedfdf..9964b4b4e9 100644 --- a/android/Lib/src/main/kotlin/com/darakeon/dfm/lib/Log.kt +++ b/android/Lib/src/main/kotlin/com/darakeon/dfm/lib/Log.kt @@ -35,7 +35,7 @@ object Log { var record = text.toString() - val path = Paths.get("log", "${BuildConfig.BUILD_TYPE}_${start}.log") + val path = Paths.get("..", "..", "outputs", "logs", "android", "${BuildConfig.BUILD_TYPE}_${start}.log") if (Files.exists(path)) { val bytes = Files.readAllBytes(path) @@ -51,10 +51,6 @@ object Log { @RequiresApi(Build.VERSION_CODES.O) get() { if (path == "") { - val dir = Paths.get("log") - if (!Files.exists(dir)) - Files.createDirectory(dir) - path = now("yyyyMMdd_HHmmss_SSS") } return path diff --git a/outputs/logs/android/.gitignore b/outputs/logs/android/.gitignore new file mode 100644 index 0000000000..bf0824e596 --- /dev/null +++ b/outputs/logs/android/.gitignore @@ -0,0 +1 @@ +*.log \ No newline at end of file