Skip to content

Commit

Permalink
Add gradle tasks related to zipping sample projects (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
devloglogan authored Oct 4, 2024
1 parent 26303f9 commit f1f71de
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ local.properties
# Misc
.DS_Store
/plugin/src/gen/
/zippedSamples
35 changes: 35 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ task clean(type: Delete) {

dependsOn 'cleanAddon'
dependsOn 'cleanBuildFromSamples'
dependsOn 'cleanZippedSamples'

dependsOn ':plugin:clean'
}
Expand Down Expand Up @@ -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'
}

0 comments on commit f1f71de

Please sign in to comment.