summaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: 88698fccfafe42200519c96ffdd034b6f1101c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 // Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/

val stackBinary="./stack-bin/stack"

val taskStackInstall = tasks.create("stack-install") {

   	description = "download and un-tar haskell-stack"
	group= "Haskell"

	doLast{

		if( !File(stackBinary).exists() ) {

			exec{
				setCommandLine("wget","https://get.haskellstack.org/stable/linux-x86_64.tar.gz")
			}

			exec{
				setCommandLine("tar","-xvf","linux-x86_64.tar.gz")
			}

			exec{
				setCommandLine("mv","stack-*-linux-x86_64","stack-bin")
			}

		}
		else println("This taks seems up to date")
	}

}

val taskStackVersion = tasks.create<Exec>("stack-version") {

    description = "show haskell-stack version"
    group = "Haskell"
	
    dependsOn(taskStackInstall)
    setCommandLine(stackBinary,"--version")

}

val taskStackInit = tasks.create<Exec>("stack-init") {

    description = "initialize stack from the package.yaml"
    group = "Haskell"
	
    dependsOn(taskStackInstall)
    setCommandLine(stackBinary,"init")

}