mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-14 14:45:33 +00:00
desktop: replace copy-assets shell script with gradle task (#6900)
This commit is contained in:
@@ -16,13 +16,19 @@ val simplexAssetsLocal = file("src/commonMain/resources/assets/simplex")
|
||||
val hasSimplexAssets = simplexAssetsDir != null
|
||||
|
||||
if (simplexAssetsDir != null) {
|
||||
val resolvedAssetsDir = rootProject.rootDir.resolve(simplexAssetsDir).absolutePath
|
||||
tasks.register<Exec>("copySimplexAssets") {
|
||||
commandLine(
|
||||
"${rootProject.rootDir}/../../scripts/android/copy-assets.sh",
|
||||
resolvedAssetsDir,
|
||||
simplexAssetsLocal.absolutePath
|
||||
)
|
||||
val resolvedAssetsDir = rootProject.rootDir.resolve(simplexAssetsDir)
|
||||
val srcImagesDir = resolvedAssetsDir.resolve("multiplatform/resources/MR/images")
|
||||
val verifySimplexAssets = tasks.register("verifySimplexAssets") {
|
||||
doLast {
|
||||
if (!srcImagesDir.isDirectory) {
|
||||
throw GradleException("Source assets not found: $srcImagesDir (run resize.sh first)")
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.register<Sync>("copySimplexAssets") {
|
||||
dependsOn(verifySimplexAssets)
|
||||
from(srcImagesDir)
|
||||
into(simplexAssetsLocal.resolve("MR/images"))
|
||||
}
|
||||
} else {
|
||||
tasks.register<Delete>("cleanSimplexAssets") {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Copies generated multiplatform assets into the SimpleX assets directory.
|
||||
# Called by Gradle build when simplex.assets.dir property is set.
|
||||
#
|
||||
# Usage: copy-assets.sh <source-dir> <dest-dir>
|
||||
|
||||
SRC_DIR="$1/multiplatform/resources/MR/images"
|
||||
DEST_DIR="$2/MR/images"
|
||||
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
echo "Error: source assets not found: $SRC_DIR (run resize.sh first)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$DEST_DIR"
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
cp "$SRC_DIR"/* "$DEST_DIR/"
|
||||
echo "Copied multiplatform assets to $DEST_DIR"
|
||||
Reference in New Issue
Block a user