From 2aa6f70979dc21ef3425758117f2e900b28e3eb2 Mon Sep 17 00:00:00 2001 From: devloglogan Date: Thu, 3 Oct 2024 14:56:12 -0500 Subject: [PATCH] Add gradle tasks related to zipping sample projects --- .gitignore | 1 + build.gradle | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.gitignore b/.gitignore index d36d82b2..55182b22 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ local.properties # Misc .DS_Store /plugin/src/gen/ +/zippedSamples diff --git a/build.gradle b/build.gradle index f7038f59..2858ea4b 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ task clean(type: Delete) { dependsOn 'cleanAddon' dependsOn 'cleanBuildFromSamples' + dependsOn 'cleanZippedSamples' dependsOn ':plugin:clean' } @@ -149,3 +150,37 @@ task cleanBuildFromSamples { } } } + +task zipSamples { + def samplesDir = file 'samples' + def directoriesToZip = samplesDir.listFiles().findAll { it.isDirectory() && it.name != 'builds' } + + def destinationDir = file 'zippedSamples' + destinationDir.mkdirs() + + directoriesToZip.each { dir -> + def godotFolder = new File(dir, '.godot') + if (godotFolder.exists()) { + godotFolder.deleteDir() + } + + def androidFolder = new File(dir, 'android') + if (androidFolder.exists()) { + androidFolder.deleteDir() + } + + def zipTask = tasks.create(name: "zip${dir.name.capitalize()}", type: Zip) { + from(dir.parentFile) { + include "${dir.name}/**" + } + archiveFileName = "${dir.name}.zip" + destinationDirectory = destinationDir + } + + dependsOn zipTask + } +} + +task cleanZippedSamples { + delete 'zippedSamples' +} \ No newline at end of file