diff options
author | Yves Fischer <yves.fischer@cern.ch> | 2016-05-21 17:14:48 +0200 |
---|---|---|
committer | Yves Fischer <yves.fischer@cern.ch> | 2016-05-21 17:14:48 +0200 |
commit | de1e05cdea94cf97c9376f988f276daa39bfde2e (patch) | |
tree | a4c35b532d7cba5fe87ae1d0249434ae44a071af /build.gradle | |
parent | 948bf79906c4251999659fce51032405b7eac8cf (diff) | |
download | debian-packages-de1e05cdea94cf97c9376f988f276daa39bfde2e.tar.gz debian-packages-de1e05cdea94cf97c9376f988f276daa39bfde2e.zip |
update ospackage version, add "activator" support
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle index 856347d..ccdc612 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } plugins { - id "nebula.ospackage" version "3.2.0" + id "nebula.ospackage" version "3.5.0" } ext { @@ -36,7 +36,7 @@ allprojects { } } -def reindex = tasks.create('reindex') +final reindex = tasks.create('reindex') reindex << { ant.taskdef( name: 'antSsh', @@ -67,9 +67,9 @@ subprojects { user = 'root' } - def buildDeb = project.getTasks().getByName('buildDeb') + final buildDeb = project.getTasks().getByName('buildDeb') - def upload = tasks.create('upload') + final upload = tasks.create('upload') upload << { ant.antScp( file: buildDeb.archivePath, @@ -82,6 +82,44 @@ subprojects { upload.dependsOn(buildDeb) project.afterEvaluate { - ospackage.version = "${project.version}-${new Date().format("yyyyMMdd-HHmmss")}" + ospackage.version = project.version + ospackage.release = "${new Date().format("yyyyMMdd")}T${new Date().format("HHmmss")}" } + + final activatorExtension = [ + env : [:], + bin : [:], + requirements: [] + ] + project.extensions.add('activator', activatorExtension) + + final createActivatorTask = task('createActivator') + createActivatorTask << { + final activatorDir = new File(project.buildDir, "activator") + + activatorExtension.bin.each { entry -> + final starter = new File(activatorDir, "bin/${entry.key}") + starter.parentFile.mkdirs() + starter.withPrintWriter { + it.append '#!/bin/sh\n' + 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.extensions.getByName('ospackage').from(new File(activatorDir, "env")) { + into("/opt/activator/${project.name}/env") + fileMode = 0444 + } + } + + tasks.getByName('buildDeb').dependsOn(createActivatorTask) } |