From c753f24327a3dc5f6de892fce1bd83653d6e55ae Mon Sep 17 00:00:00 2001 From: denbond7 Date: Wed, 7 May 2025 11:54:02 +0300 Subject: [PATCH 1/2] Fixed gradle 'copyReleaseApks' task.| #3038 --- FlowCrypt/build.gradle.kts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/FlowCrypt/build.gradle.kts b/FlowCrypt/build.gradle.kts index 5423810ff3..23f44561ac 100644 --- a/FlowCrypt/build.gradle.kts +++ b/FlowCrypt/build.gradle.kts @@ -373,12 +373,20 @@ tasks.register("renameReleaseBuilds") { } tasks.register("copyReleaseApks") { - from("${layout.buildDirectory}") { - include("**/*release*.apk") - } - includeEmptyDirs = false - into("${rootProject.rootDir}/release") + + into( + File(rootProject.rootDir, "release").apply { + exists().takeIf { true } ?: mkdir().takeIf { true } ?: error("Can't create $name") + } + ) + + with( + copySpec { + from(layout.buildDirectory) + include("**/*release*.apk") + } + ) eachFile { //replace path to copy only apk file to the destination folder(without subdirectories) From e00aa3a9fb5aecafb1809662aaf993b2c0e0f4d9 Mon Sep 17 00:00:00 2001 From: denbond7 Date: Thu, 8 May 2025 09:42:25 +0300 Subject: [PATCH 2/2] Refactored code --- FlowCrypt/build.gradle.kts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FlowCrypt/build.gradle.kts b/FlowCrypt/build.gradle.kts index 23f44561ac..cba06db396 100644 --- a/FlowCrypt/build.gradle.kts +++ b/FlowCrypt/build.gradle.kts @@ -377,7 +377,9 @@ tasks.register("copyReleaseApks") { into( File(rootProject.rootDir, "release").apply { - exists().takeIf { true } ?: mkdir().takeIf { true } ?: error("Can't create $name") + if (!exists() && !mkdirs()) { + error("Can't create $name") + } } )