Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gradle tasks related to zipping sample projects #215

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
}
Loading