Skip to content

Commit

Permalink
buildscripts: replace Ant tasks with a de.undercouch plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jun 5, 2024
1 parent 592ec84 commit ec35b2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
38 changes: 13 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

plugins {
id 'base' // to add a "clean" task to the root project
alias(libs.plugins.download) // to retrieve files from URLs
}

ext {
Expand Down Expand Up @@ -45,34 +46,21 @@ tasks.register('cleanDownloads', Delete) { // downloaded assets

// Register downloading tasks:

tasks.register('bistro', MyDownload) {
sourceUrl = 'https://developer.nvidia.com/bistro'
target = file('downloads/Bistro_v5_2.zip')
tasks.register('bistro', Download) {
src 'https://developer.nvidia.com/bistro'
dest file('downloads/Bistro_v5_2.zip')
overwrite false
}
tasks.register('downloads') {
dependsOn 'testdata-31', 'testdata-36'
}
tasks.register('testdata-31', MyDownload) {
sourceUrl = 'https://repo1.maven.org/maven2/org/jmonkeyengine/jme3-testdata/3.1.0-stable/jme3-testdata-3.1.0-stable.jar'
target = file('downloads/jme3-testdata-3.1.0-stable.jar')
tasks.register('testdata-31', Download) {
src 'https://repo1.maven.org/maven2/org/jmonkeyengine/jme3-testdata/3.1.0-stable/jme3-testdata-3.1.0-stable.jar'
dest file('downloads/jme3-testdata-3.1.0-stable.jar')
overwrite false
}
tasks.register('testdata-36', MyDownload) {
sourceUrl = 'https://repo1.maven.org/maven2/org/jmonkeyengine/jme3-testdata/3.6.1-stable/jme3-testdata-3.6.1-stable.jar'
target = file('downloads/jme3-testdata-3.6.1-stable.jar')
}

// helper class to wrap the Ant download task:

class MyDownload extends DefaultTask {
@Input
String sourceUrl

@OutputFile
File target

@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
println sourceUrl
}
tasks.register('testdata-36', Download) {
src 'https://repo1.maven.org/maven2/org/jmonkeyengine/jme3-testdata/3.6.1-stable/jme3-testdata-3.6.1-stable.jar'
dest file('downloads/jme3-testdata-3.6.1-stable.jar')
overwrite false
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ wes = "com.github.stephengold:Wes:0.8.1"
[bundles]

[plugins]

download = { id = "de.undercouch.download", version = "5.6.0" }

0 comments on commit ec35b2b

Please # to comment.