// 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("stack-version") { description = "show haskell-stack version" group = "Haskell" dependsOn(taskStackInstall) setCommandLine(stackBinary,"--version") } val taskStackInit = tasks.create("stack-init") { description = "initialize stack from the package.yaml" group = "Haskell" dependsOn(taskStackInstall) setCommandLine(stackBinary,"init","--force") } val taskStackBuild = tasks.create("stack-build") { description = "build project" group = "Haskell" dependsOn(taskStackInit) setCommandLine(stackBinary,"build") } val taskStackExec = tasks.create("stack-exec") { description = "run project" group = "Haskell" dependsOn(taskStackBuild) setCommandLine(stackBinary,"exec","gradle-jenkins-haskell-exe") }