Skip to content

Commit

Permalink
Add gradle tasks related to zipping sample projects
Browse files Browse the repository at this point in the history
  • Loading branch information
devloglogan committed Oct 3, 2024
1 parent 9349841 commit c7b903c
Show file tree
Hide file tree
Showing 2 changed files with 29 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
28 changes: 28 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,30 @@ 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 zipTask = tasks.create(name: "zip${dir.name.capitalize()}", type: Zip) {
from dir
archiveFileName = "${dir.name}.zip"
destinationDirectory = destinationDir
}

dependsOn zipTask
}
}

task cleanZippedSamples {
delete 'zippedSamples'
}

0 comments on commit c7b903c

Please sign in to comment.