1+ import org.apache.tools.ant.filters.ReplaceTokens
2+
3+ import static org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
4+
15plugins {
26 id(' groovy' )
37}
@@ -20,8 +24,6 @@ println("Release set to: $release")
2024println (" Candidtes API: $candidatesApi " )
2125println (" Version: $sdkmanVersion " )
2226
23- apply from : ' gradle/archive.gradle'
24-
2527repositories {
2628 mavenCentral()
2729}
@@ -43,3 +45,72 @@ dependencies {
4345 exclude module : ' groovy-all'
4446 }
4547}
48+
49+ task prepareScripts (type : Copy ) {
50+ from(' src/main/bash' )
51+ into(' build/scripts' )
52+ include(' **/*' )
53+ filter(
54+ ReplaceTokens ,
55+ tokens : [
56+ SDKMAN_VERSION : sdkmanVersion,
57+ SDKMAN_CANDIDATES_API : candidatesApi
58+ ]
59+ )
60+ }
61+
62+ task prepareContrib (type : Copy ) {
63+ from(' contrib' )
64+ into(' build/contrib' )
65+ }
66+
67+ tasks. test. configure {
68+ dependsOn(prepareScripts)
69+ testLogging. exceptionFormat = FULL
70+ }
71+
72+ task assembleArchive (type : Zip , dependsOn : [prepareScripts, prepareContrib]) {
73+ archiveVersion = sdkmanVersion
74+ from(' build/scripts' ) {
75+ include(' *.sh*' )
76+ }
77+ from(' build' ) {
78+ include(' contrib/**' )
79+ }
80+ }
81+
82+ tasks. assemble. configure {
83+ dependsOn(assembleArchive)
84+ }
85+
86+ task cleanInstallInit (type : Delete ) {
87+ delete(installBinDir)
88+ }
89+
90+ task cleanContribInit (type : Delete ) {
91+ delete(installContribDir)
92+ }
93+
94+ task cleanInstallModules (type : Delete ) {
95+ delete(installSrcDir)
96+ }
97+
98+ task installContrib (type : Copy , dependsOn : [cleanContribInit, prepareContrib]) {
99+ from(' build/contrib' )
100+ into(installContribDir)
101+ }
102+
103+ task installInit (type : Copy , dependsOn : [cleanInstallInit, prepareScripts]) {
104+ from(' build/scripts' )
105+ into(installBinDir)
106+ include(' sdkman-init.sh' )
107+ }
108+
109+ task installModules (type : Copy , dependsOn : [cleanInstallModules, prepareScripts]) {
110+ from(' build/scripts' )
111+ into(installSrcDir)
112+ include(' sdkman-*.sh' )
113+ exclude(' sdkman-init.sh' )
114+ }
115+
116+ task install (dependsOn : [installInit, installContrib, installModules])
0 commit comments