Skip to content

Instantly share code, notes, and snippets.

@lptr
Forked from agazso/gist:af9a27bf5ae2148ad5be
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lptr/8fdd585a764efe8ad866 to your computer and use it in GitHub Desktop.
Save lptr/8fdd585a764efe8ad866 to your computer and use it in GitHub Desktop.
diff --git a/build.gradle b/build.gradle
index 000d73a..72a2730 100644
--- a/build.gradle
+++ b/build.gradle
@@ -35,7 +35,7 @@ def schemaDir = "$buildDir/schema"
def rootBuild = "${rootProject.projectDir}/build"
def finalSandboxDir = "${rootBuild}/cabal-sandbox"
def rawSandboxDir = "${rootBuild}/raw-cabal-sandbox"
-def sandboxConfig = "${rootBuild}/cabal.sandbox.config"
+def sandboxConfig = "${projectDir}/cabal.sandbox.config"
configurations {
sandbox
@@ -63,8 +63,9 @@ task copySchema(type: Copy) {
}
task cabalInitConfig(type: Exec) {
- onlyIf{!file("${sandboxConfig}").exists()}
- commandLine "bash" , "-c", "cabal sandbox init --sandbox=$finalSandboxDir && mv cabal.sandbox.config ${rootBuild}/"
+ outputs.upToDateWhen{file("${sandboxConfig}").exists()}
+ // onlyIf
+ commandLine "bash" , "-c", "cabal sandbox init --sandbox=$finalSandboxDir"
outputs.file "${sandboxConfig}"
}
@@ -79,7 +80,7 @@ task copyCabalSandbox(type: Copy) {
def finalisedFile = "${rootBuild}/finalised"
task finaliseSandbox(type: FinaliseSandbox) {
- onlyIf{!file("${finalisedFile}").exists()}
+ outputs.upToDateWhen{file("${finalisedFile}").exists()}
dependsOn copyCabalSandbox
finalSandbox(finalSandboxDir)
rawSandbox(rawSandboxDir)
@@ -94,7 +95,7 @@ task addStuffToSandbox(type: Exec) {
dependsOn copySchema
def deps = []
def copyDeps = [copySchema]
- onlyIf {
+ onlyIf{
copyDeps.each {
it.outputs.files.each { it.eachFile {
def depBase = org.apache.commons.io.FilenameUtils.getBaseName("${it}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment