aboutsummaryrefslogtreecommitdiff
path: root/build-logic/android-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'build-logic/android-plugins')
-rw-r--r--build-logic/android-plugins/src/main/kotlin/artifacts/CollectApksTask.kt11
-rw-r--r--build-logic/android-plugins/src/main/kotlin/artifacts/CollectBundleTask.kt11
2 files changed, 15 insertions, 7 deletions
diff --git a/build-logic/android-plugins/src/main/kotlin/artifacts/CollectApksTask.kt b/build-logic/android-plugins/src/main/kotlin/artifacts/CollectApksTask.kt
index 23f94f22..07f52943 100644
--- a/build-logic/android-plugins/src/main/kotlin/artifacts/CollectApksTask.kt
+++ b/build-logic/android-plugins/src/main/kotlin/artifacts/CollectApksTask.kt
@@ -1,7 +1,9 @@
package artifacts
import com.android.build.api.variant.BuiltArtifactsLoader
-import java.io.File
+import java.nio.file.Files
+import java.nio.file.Paths
+import java.nio.file.StandardCopyOption
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
@@ -32,8 +34,11 @@ abstract class CollectApksTask : DefaultTask() {
val builtArtifacts =
builtArtifactsLoader.get().load(apkFolder.get()) ?: throw RuntimeException("Cannot load APKs")
builtArtifacts.elements.forEach { artifact ->
- File(artifact.outputFile)
- .renameTo(outputDir.resolve("APS-${variantName.get()}-${artifact.versionName}.apk"))
+ Files.copy(
+ Paths.get(artifact.outputFile),
+ outputDir.resolve("APS-${variantName.get()}-${artifact.versionName}.apk").toPath(),
+ StandardCopyOption.REPLACE_EXISTING,
+ )
}
}
}
diff --git a/build-logic/android-plugins/src/main/kotlin/artifacts/CollectBundleTask.kt b/build-logic/android-plugins/src/main/kotlin/artifacts/CollectBundleTask.kt
index a735fb7b..709744f2 100644
--- a/build-logic/android-plugins/src/main/kotlin/artifacts/CollectBundleTask.kt
+++ b/build-logic/android-plugins/src/main/kotlin/artifacts/CollectBundleTask.kt
@@ -1,5 +1,7 @@
package artifacts
+import java.nio.file.Files
+import java.nio.file.StandardCopyOption
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
@@ -22,9 +24,10 @@ abstract class CollectBundleTask : DefaultTask() {
fun taskAction() {
val outputDir = outputDirectory.asFile.get()
outputDir.mkdirs()
- bundleFile
- .get()
- .asFile
- .renameTo(outputDir.resolve("APS-${variantName.get()}-${versionName.get()}.aab"))
+ Files.copy(
+ bundleFile.get().asFile.toPath(),
+ outputDir.resolve("APS-${variantName.get()}-${versionName.get()}.aab").toPath(),
+ StandardCopyOption.REPLACE_EXISTING,
+ )
}
}