Skip to content

Commit

Permalink
build.gradle: add the "unpackJoltSource" task
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jun 26, 2024
1 parent de5a1f7 commit 0f819b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.cxx/
/downloads/
/src/main/native/auto/
/src/main/native/Jolt/

# Ignore Gradle's project-specific cache directory:
/.gradle/
Expand Down
18 changes: 16 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,35 @@ tasks.withType(JavaCompile) { // Java compile-time options:

javadoc.dependsOn('compileTestJava')

// download archived JoltPhysics source code
// Download and extract archived JoltPhysics source code

tasks.register('download', Download) {
src 'https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.0.0.zip'
dest file('downloads/JoltPhysics-5.0.0.zip')
overwrite false
}
tasks.register('unpackJoltSource', Copy) {
dependsOn 'download'
from (zipTree('downloads/JoltPhysics-5.0.0.zip')) {
include 'JoltPhysics-5.0.0/Jolt/**'
eachFile { fcd ->
fcd.relativePath = new RelativePath(true, fcd.relativePath.segments.drop(2))
}
includeEmptyDirs = false
}
into layout.projectDirectory.dir('src/main/native/Jolt')
}

// Register cleanup tasks:

clean.dependsOn('cleanAutoHeaders', 'cleanDownloads')
clean.dependsOn('cleanAutoHeaders', 'cleanDownloads', 'cleanJoltSource')

tasks.register('cleanAutoHeaders', Delete) { // auto-generated JNI headers
delete 'src/main/native/auto'
}
tasks.register('cleanDownloads', Delete) { // downloaded files
delete 'downloads'
}
tasks.register('cleanJoltSource', Delete) { // unpacked Jolt Physics source code
delete 'src/main/native/Jolt'
}

0 comments on commit 0f819b7

Please sign in to comment.