From 7236617f71a2090aa1aebac37e2b7b51330cdc73 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Wed, 12 Oct 2016 14:48:17 +0200 Subject: HONEYCOMB-157 Extract groovy scripts from poms And put all of them into a dedicated module Change-Id: Id04c66806a89af68d821a43ef92f0a59220e04e9 Signed-off-by: Maros Marsalek --- common/minimal-distribution-parent/pom.xml | 91 ++++-------------------------- 1 file changed, 10 insertions(+), 81 deletions(-) (limited to 'common/minimal-distribution-parent') diff --git a/common/minimal-distribution-parent/pom.xml b/common/minimal-distribution-parent/pom.xml index eb68991c4..307d31ec6 100644 --- a/common/minimal-distribution-parent/pom.xml +++ b/common/minimal-distribution-parent/pom.xml @@ -31,24 +31,8 @@ pom - -#!/bin/sh - -STATUS=100 - -while [ $STATUS -eq 100 ] -do - %s - STATUS=$? - echo "Honeycomb exited with status: $STATUS" - if [ $STATUS -eq 100 ] - then - echo "Restarting..." - fi -done - -Xms32m -Xmx128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=128m -client -Xms20m -Xmx32m -XX:MetaspaceSize=5m -XX:MaxMetaspaceSize=32m -XX:MaxMetaspaceExpansion=1m -Xss512k -XX:+UseSerialGC -Djava.compiler=NONE -Xverify:none -noverify - -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 1.19.1 @@ -60,12 +44,6 @@ 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. - @@ -185,36 +163,8 @@ done execute - - import java.nio.file.Paths - - log.info "Generating shell exec script" - def scriptTemplate = properties.getOrDefault("start.script.template", "") - def args = properties.getOrDefault("exec.parameters", "") - log.debug "Additional shell exec script properties: ${args}" - def javaArgs = "${args} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar" - def scriptParent = Paths.get(project.build.outputDirectory, "honeycomb-minimal-resources") - scriptParent.toFile().mkdirs() - def scriptContent = "java " + javaArgs - log.info "Generating shell exec script as ${scriptContent}" - def scriptPath = Paths.get(scriptParent.toString(), "honeycomb") - log.info "Writing shell exec script to ${scriptPath}" - scriptPath.toFile().text = String.format(scriptTemplate, scriptContent) - scriptPath.toFile().setExecutable(true) - - scriptPath = Paths.get(scriptParent.toString(), "honeycomb-start") - log.info "Writing shell exec script to ${scriptPath}" - scriptPath.toFile().text = "\$(dirname \$0)/honeycomb &" - scriptPath.toFile().setExecutable(true) - - def debug_args = properties.getOrDefault("debug.parameters", "") - def debugScriptContent = "java" + " ${debug_args} " + javaArgs - log.info "Generating shell debug script as ${debugScriptContent}" - scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug") - log.info "Writing shell debug script to ${scriptPath}" - scriptPath.toFile().text = String.format(scriptTemplate, debugScriptContent) - scriptPath.toFile().setExecutable(true) + io.fd.honeycomb.common.scripts.StartupScriptGenerator.generate(project, properties, log) @@ -227,40 +177,19 @@ done 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) - } + + io.fd.honeycomb.common.scripts.ModulesListGenerator.generate(project, properties, log) + + + io.fd.honeycomb.common + common-scripts + 1.16.12-SNAPSHOT + + -- cgit 1.2.3-korg