From 6c3f614edb18bdb8cc6e7b87627f240d97a258c3 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Thu, 13 Oct 2016 13:56:47 +0200 Subject: HONEYCOMB-207 : Configurable modules list for distributions Export list of modules for built distribution on compile time according to distribution.modules property to ***module-config.txt Load aggregated set of modules on start from all descriptors in /modules folder Change-Id: Icdeb23536aee3a243a221d3f2ec5f340d387764e Signed-off-by: Jan Srnicek --- common/minimal-distribution-parent/pom.xml | 52 +++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/minimal-distribution-parent/pom.xml b/common/minimal-distribution-parent/pom.xml index b003231c3..eb68991c4 100644 --- a/common/minimal-distribution-parent/pom.xml +++ b/common/minimal-distribution-parent/pom.xml @@ -60,6 +60,12 @@ done http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom --> /dev/./urandom + // This distribution does not define any own modules. +// In order to do so either distribution.modules property must be defined in distribution pom.xml, +// containing list of desired modules to start, or this file can be directly edited with same effect. +// +// Note : Modules should be referenced by full class name, for ex.: io.fd.test.SampleModule, and separated with comma. + @@ -127,7 +133,7 @@ done true - config/ cert/ + config/ cert/ modules/ @@ -167,11 +173,13 @@ done + org.codehaus.gmaven groovy-maven-plugin + start-scripts-generation package execute @@ -210,6 +218,48 @@ done + + distribution-module-assembly + + prepare-package + + execute + + + import java.nio.file.Paths + import java.nio.file.Files + + // module configuration file extraction + // builds project name from group,artifact and version to prevent overwriting + // while building multiple distribution project + def artifact = project.getArtifact() + def projectName = "${artifact.getGroupId()}_${artifact.getArtifactId()}_${artifact.getVersion()}".replace(".","-") + log.info "Generating list of modules started by distribution ${projectName}" + + def activeModules = properties.getProperty("distribution.modules", "") + .tokenize(",") + .collect { module -> module.trim() } + + log.info "Project ${projectName} : Found modules ${activeModules}" + //creates folder modules + + def outputPath = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources", "modules") + //creates module folder + outputPath.toFile().mkdirs() + + def outputFile = Paths.get(outputPath.toString(), "${projectName}_module-config.txt").toFile() + outputFile.createNewFile(); + log.info("Writing module configuration for distribution ${projectName} to ${outputPath}") + + if (activeModules.isEmpty()) { + outputFile.text = properties.getProperty("no.modules.defined.message") + } else { + outputFile.text = activeModules.join(System.lineSeparator) + } + + + -- cgit 1.2.3-korg