summaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: 1fb01512cdbe592536578980f0835127bbb969ed (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 // 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("/bin/bash", "-c","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","--force")

}

val taskStackBuild = tasks.create<Exec>("stack-build") {

    description = "build project"
    group = "Haskell"
	
    dependsOn(taskStackInit)
    setCommandLine(stackBinary,"build")

}

val taskStackExec = tasks.create<Exec>("stack-exec") {

    description = "run project"
    group = "Haskell"
	
    dependsOn(taskStackBuild)
    setCommandLine(stackBinary,"exec","gradle-jenkins-haskell-exe")

}