@@ -3,7 +3,7 @@ plugins {
33}
44
55group = ' dev.codeman'
6- version = ' 0.0.4 '
6+ version = ' 0.0.5 '
77
88repositories {
99 mavenCentral()
@@ -19,25 +19,36 @@ java {
1919 }
2020}
2121
22- def nativeDir = file(" $buildDir /resources/main/native" )
23- def dllFile = file(" $nativeDir /SMTC4J.dll" )
22+ def nativeDownloadDir = layout. buildDirectory. dir(" native-download" ). get(). asFile
23+ def nativeDllFile = nativeDownloadDir. toPath(). resolve(" SMTC4J.dll" ). toFile()
24+ def resourcesNativeDir = layout. buildDirectory. dir(" resources/main/native" ). get(). asFile
2425
25- tasks. register(' downloadNative' ) {
26+ tasks. register(" downloadNative" ) {
2627 doLast {
27- if (dllFile. exists()) return
28-
29- nativeDir. mkdirs()
28+ if (nativeDllFile. exists()) {
29+ println " Native DLL already exists, skipping download."
30+ return
31+ }
3032
33+ nativeDownloadDir. mkdirs()
3134 def tag = " v$version "
3235 def url = " https://github.com/CodeManDev/SMTC4J/releases/download/${ tag} /SMTC4J.dll"
36+ println " Downloading native DLL from $url "
3337
34- println " Downloading native library from $url "
35- URI . create(url). toURL(). withInputStream { i ->
36- dllFile. withOutputStream { it << i }
38+ new URL (url). withInputStream { input ->
39+ nativeDllFile. withOutputStream { output ->
40+ output << input
41+ }
3742 }
3843 }
3944}
4045
41- processResources {
42- dependsOn ' downloadNative'
46+ tasks. register(" copyNativeIntoResources" , Copy ) {
47+ dependsOn " downloadNative"
48+ from(nativeDllFile)
49+ into(resourcesNativeDir)
50+ }
51+
52+ tasks. named(" processResources" ) {
53+ dependsOn " copyNativeIntoResources"
4354}
0 commit comments