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 71555df commit efc98f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 38 deletions.
23 changes: 4 additions & 19 deletions apps/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
plugins {
id 'application' // to build JVM applications
id 'checkstyle' // to analyze Java sourcecode for style violations
alias(libs.plugins.download) // to retrive files from URLs
}

checkstyle {
Expand Down Expand Up @@ -317,24 +318,8 @@ void registerPlatformTasks(String platform, String suffix) {
delete downloadsDir + filename
}

tasks.register('download' + platform, MyDownload) {
sourceUrl = libbulletjmeUrl + filename
target = file(downloadsDir + filename)
}
}

// 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)
println sourceUrl
tasks.register('download' + platform, Download) {
src libbulletjmeUrl + filename
dest file(downloadsDir + filename)
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ sport = "com.github.stephengold:sport:0.9.4"

[plugins]

download = { id = "de.undercouch.download", version = "5.6.0" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.0.0" }
23 changes: 4 additions & 19 deletions kotlin-apps/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

plugins {
id 'application' // to build JVM applications
alias(libs.plugins.download) // to retrieve files from URLs
alias(libs.plugins.kotlin.jvm) // to compile Kotlin
}

Expand Down Expand Up @@ -254,24 +255,8 @@ void registerPlatformTasks(String platform, String suffix) {
delete downloadsDir + filename
}

tasks.register('download' + platform, MyDownload) {
sourceUrl = libbulletjmeUrl + filename
target = file(downloadsDir + filename)
}
}

// 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)
println sourceUrl
tasks.register('download' + platform, Download) {
src libbulletjmeUrl + filename
dest file(downloadsDir + filename)
}
}

0 comments on commit efc98f7

Please sign in to comment.