From 62dd4d32fd270d3a6b7bb47c972bbcd5dc7b9f43 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 30 Jun 2017 10:08:14 +0200 Subject: HONEYCOMB-358 - Generate guice to yang modules index Generates two descriptor files yang-modules-binding/yang-modules - List of Yang modules by project(classpath + deps) yang-mapping/FULL_PROJECT_NAME-yang-modules-index - Index from Guice modules to Yang modules that are used by respective Guice module These files are included in jar files and distribution resources Change-Id: Iafc178219245df9129fb426a5876215c6fd1837e Signed-off-by: Jan Srnicek --- .../fd/honeycomb/common/scripts/ModulesListGenerator.groovy | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy') diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy index c7a74d20e..525a77e66 100644 --- a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy +++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy @@ -18,6 +18,7 @@ package io.fd.honeycomb.common.scripts import groovy.text.SimpleTemplateEngine +import java.nio.file.Path import java.nio.file.Paths /** @@ -37,7 +38,7 @@ class ModulesListGenerator { // builds project name from group,artifact and version to prevent overwriting // while building multiple distribution project def artifact = project.artifact - def projectName = "${artifact.getGroupId()}_${artifact.getArtifactId()}_${artifact.getVersion()}".replace(".","-") + def projectName = pathFriendlyProjectName(artifact) log.info "Generating list of modules started by distribution ${projectName}" @@ -48,7 +49,7 @@ class ModulesListGenerator { log.info "Project ${projectName} : Found modules ${activeModules}" //creates folder modules - def outputPath = Paths.get(project.build.outputDirectory, StartupScriptGenerator.MINIMAL_RESOURCES_FOLDER, MODULES_FOLDER) + def outputPath = modulesConfigFolder(project) //creates module folder outputPath.toFile().mkdirs() @@ -66,4 +67,12 @@ class ModulesListGenerator { outputFile.text = activeModules.join(System.lineSeparator) } } + + public static Path modulesConfigFolder(project) { + return Paths.get(project.build.outputDirectory, StartupScriptGenerator.MINIMAL_RESOURCES_FOLDER, MODULES_FOLDER) + } + + public static String pathFriendlyProjectName(artifact) { + return "${artifact.getGroupId()}_${artifact.getArtifactId()}_${artifact.getVersion()}".replace(".", "-") + } } -- cgit 1.2.3-korg