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 39078f0 commit e8c25e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
25 changes: 8 additions & 17 deletions SkyAssets/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// for this project. This initialization is applied in the "build.gradle"
// of the root project.

plugins {
alias(libs.plugins.download) // to retrieve files from URLs
}

ext {
bsc = 'src/main/resources/bsc5.dat'
skies = '../SkyLibrary/src/main/resources/Textures/skies'
Expand Down Expand Up @@ -39,9 +43,10 @@ tasks.register('cleanCatalog', Delete) {
// download gzipped Yale Bright Star Catalog

processResources.dependsOn('download')
tasks.register('download', MyDownload) {
sourceUrl = 'http://tdc-www.harvard.edu/catalogs/bsc5.dat.gz'
target = file("${bsc}.gz")
tasks.register('download', Download) {
src 'http://tdc-www.harvard.edu/catalogs/bsc5.dat.gz'
dest file("${bsc}.gz")
overwrite false
}
tasks.register('cleanDownload', Delete) {
delete file("${bsc}.gz")
Expand Down Expand Up @@ -140,17 +145,3 @@ tasks.register('wiltshire16m', JavaExec) {
mainClass = 'jme3utilities.sky.textures.MakeStarMaps'
outputs.files("$skies/star-maps/16m/wiltshire.png")
}

// Helper class to wrap Ant download task
class MyDownload extends DefaultTask {
@Input
String sourceUrl

@OutputFile
File target

@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ nifty-style-black = "com.github.nifty-gui:nifty-style-black:1.4.3"
[bundles]

[plugins]

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

0 comments on commit e8c25e4

Please sign in to comment.