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