From 121c5692bc67fc9374fb72eccaef15f809b0d4e2 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 17 Dec 2016 00:27:24 +0100 Subject: add activator task input/output declaration --- build.gradle | 21 +++++++++++++-------- packages/scripts-cern/build.gradle | 6 ++---- packages/scripts/build.gradle | 6 ++---- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 8087483..2664621 100644 --- a/build.gradle +++ b/build.gradle @@ -126,14 +126,12 @@ subprojects { final activatorExtension = [ env : [:], bin : [:], - requirements: [] ] project.extensions.add('activator', activatorExtension) final activatorTask = task('activator') + final activatorDir = new File(project.buildDir, 'activator') activatorTask.doLast { - final activatorDir = new File(project.buildDir, 'activator') - activatorExtension.bin.each { entry -> final starter = new File(activatorDir, "bin/${entry.key}") starter.parentFile.mkdirs() @@ -142,20 +140,27 @@ subprojects { it.append "${entry.value} \$*" } } - project.extensions.getByName('ospackage').from(new File(activatorDir, 'bin')) { - into("/opt/activator/${project.name}/bin") - fileMode = 0555 - } - activatorExtension.env.each { entry -> final envFile = new File(activatorDir, "env/${entry.key}") envFile.parentFile.mkdirs() envFile.write(entry.value as String) } + } + project.afterEvaluate { project.extensions.getByName('ospackage').from(new File(activatorDir, 'env')) { into("/opt/activator/${project.name}/env") fileMode = 0444 } + activatorExtension.env.each { + activatorTask.outputs.file(new File(activatorDir, "env/${it.key}")) + } + activatorExtension.bin.each { + activatorTask.outputs.file(new File(activatorDir, "bin/${it.key}")) + } + project.extensions.getByName('ospackage').from(new File(activatorDir, 'bin')) { + into("/opt/activator/${project.name}/bin") + fileMode = 0555 + } } tasks.getByName('buildDeb').dependsOn(activatorTask) diff --git a/packages/scripts-cern/build.gradle b/packages/scripts-cern/build.gradle index c6bdfa5..1c31991 100644 --- a/packages/scripts-cern/build.gradle +++ b/packages/scripts-cern/build.gradle @@ -5,8 +5,6 @@ ospackage { from files('resources') } -tasks.getByName('activator').doFirst { - new File("resources/bin").listFiles().each { - activator.bin[it.name] = "/opt/${project.name}/bin/${it.name}" - } +new File(project.projectDir, "resources/bin").listFiles().each { + activator.bin[it.name] = "/opt/${project.name}/bin/${it.name}" } diff --git a/packages/scripts/build.gradle b/packages/scripts/build.gradle index c6bdfa5..1c31991 100644 --- a/packages/scripts/build.gradle +++ b/packages/scripts/build.gradle @@ -5,8 +5,6 @@ ospackage { from files('resources') } -tasks.getByName('activator').doFirst { - new File("resources/bin").listFiles().each { - activator.bin[it.name] = "/opt/${project.name}/bin/${it.name}" - } +new File(project.projectDir, "resources/bin").listFiles().each { + activator.bin[it.name] = "/opt/${project.name}/bin/${it.name}" } -- cgit v1.2.1