Skip to content

Commit 0962013

Browse files
committed
Download Examples
Download the processing from the GitHub and include it in the resources
1 parent 957b61c commit 0962013

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

app/build.gradle.kts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,29 @@ tasks.register<Copy>("unzipJDK") {
141141
tarTree(dl.dest)
142142
}
143143

144-
from(archive)
144+
from(archive){ eachFile{ file.setWritable(true, false) } }
145145
into(layout.buildDirectory.dir("resources-bundled/common"))
146146
}
147147
tasks.register<Copy>("copyShared"){
148148
from("../build/shared/")
149149
into(layout.buildDirectory.dir("resources-bundled/common"))
150150
}
151+
tasks.register<Download>("downloadProcessingExamples") {
152+
src("https://github.com/processing/processing-examples/archive/refs/heads/main.zip")
153+
dest(layout.buildDirectory.file("tmp/processing-examples.zip"))
154+
overwrite(false)
155+
}
156+
tasks.register<Copy>("unzipExamples") {
157+
val dl = tasks.findByPath("downloadProcessingExamples") as Download
158+
dependsOn(dl)
159+
from(zipTree(dl.dest)){ // remove top level directory
160+
eachFile { relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray()) }
161+
}
162+
into(layout.buildDirectory.dir("resources-bundled/common/modes/java/examples"))
163+
}
164+
151165
afterEvaluate {
152-
tasks.findByName("prepareAppResources")?.dependsOn("unzipJDK","copyShared", "copyCore")
166+
tasks.findByName("prepareAppResources")?.dependsOn("unzipJDK","copyShared", "copyCore", "unzipExamples")
153167
tasks.register("setExecutablePermissions") {
154168
description = "Sets executable permissions on binaries in Processing.app resources"
155169
group = "compose desktop"

0 commit comments

Comments
 (0)