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/common-scripts/pom.xml | 87 +++++++++++++++ .../common/scripts/ModulesListGenerator.groovy | 69 ++++++++++++ .../common/scripts/ReadmeGenerator.groovy | 61 +++++++++++ .../common/scripts/StartupScriptGenerator.groovy | 119 +++++++++++++++++++++ .../resources/modules/modulesListDefaultContent | 7 ++ .../src/main/resources/readme/readmeDefaultContent | 3 + .../src/main/resources/scripts/README | 26 +++++ .../src/main/resources/scripts/forkScript | 2 + .../src/main/resources/scripts/killScript | 2 + .../src/main/resources/scripts/startScript | 13 +++ common/honeycomb-parent/pom.xml | 40 +++---- common/minimal-distribution-parent/pom.xml | 91 ++-------------- common/pom.xml | 1 + infra/translate-spi/asciidoc/Readme.adoc | 5 +- 14 files changed, 416 insertions(+), 110 deletions(-) create mode 100644 common/common-scripts/pom.xml create mode 100644 common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy create mode 100644 common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy create mode 100644 common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy create mode 100644 common/common-scripts/src/main/resources/modules/modulesListDefaultContent create mode 100644 common/common-scripts/src/main/resources/readme/readmeDefaultContent create mode 100644 common/common-scripts/src/main/resources/scripts/README create mode 100644 common/common-scripts/src/main/resources/scripts/forkScript create mode 100644 common/common-scripts/src/main/resources/scripts/killScript create mode 100644 common/common-scripts/src/main/resources/scripts/startScript diff --git a/common/common-scripts/pom.xml b/common/common-scripts/pom.xml new file mode 100644 index 000000000..1e4dd8443 --- /dev/null +++ b/common/common-scripts/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + io.fd.honeycomb.common + common-scripts + ${project.artifactId} + 1.16.12-SNAPSHOT + jar + + + + 2.0 + 2.4.7 + 2.9.2-01 + 2.4.3-01 + + + + + + + org.apache.maven.plugins + maven-site-plugin + + true + true + + + + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy.eclipse.compiler.version} + true + + + maven-compiler-plugin + + + groovy-eclipse-compiler + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy.eclipse.compiler.version} + + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy.eclipse.batch.version} + + + + + + + + + org.codehaus.groovy + groovy-all + ${groovy.version} + + + + \ No newline at end of file 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 new file mode 100644 index 000000000..c7a74d20e --- /dev/null +++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.common.scripts + +import groovy.text.SimpleTemplateEngine + +import java.nio.file.Paths + +/** + * Generate modules-list file a honeycomb distribution. + */ +class ModulesListGenerator { + + static final def DEFAULT_MODULES_LIST = ModulesListGenerator.getResource("/modules/modulesListDefaultContent").text + + static final def MODULES_LIST_CONTENT_PROPERTY = "distribution.modules" + static final def MODULES_FOLDER = "modules" + static final def MODULE_LIST_FILE_SUFFIX = "-module-config" + static final def SEPARATOR = "," + + public static void generate(project, properties, log) { + // module configuration file extraction + // 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(".","-") + + log.info "Generating list of modules started by distribution ${projectName}" + + def activeModules = properties.getProperty(MODULES_LIST_CONTENT_PROPERTY, DEFAULT_MODULES_LIST) + .tokenize(SEPARATOR) + .collect { module -> module.trim() } + + log.info "Project ${projectName} : Found modules ${activeModules}" + //creates folder modules + + def outputPath = Paths.get(project.build.outputDirectory, StartupScriptGenerator.MINIMAL_RESOURCES_FOLDER, MODULES_FOLDER) + //creates module folder + outputPath.toFile().mkdirs() + + def outputFile = Paths.get(outputPath.toString(), "${projectName}${MODULE_LIST_FILE_SUFFIX}").toFile() + outputFile.createNewFile(); + log.info("Writing module configuration for distribution ${projectName} to ${outputPath}") + + if (activeModules.isEmpty()) { + outputFile.text = new SimpleTemplateEngine().createTemplate(DEFAULT_MODULES_LIST).make( + ["groupId" : project.groupId, + "artifactId": project.artifactId, + "version" : project.version]).toString() + } else { + activeModules.add(0, "// Generated from ${project.groupId}/${project.artifactId}/${project.version}") + outputFile.text = activeModules.join(System.lineSeparator) + } + } +} diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy new file mode 100644 index 000000000..5010395ea --- /dev/null +++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.common.scripts + +import groovy.text.SimpleTemplateEngine + +import java.nio.file.Files +import java.nio.file.Paths + +/** + * Check/generate and repair Readme.adoc for a honeycomb module. + */ +class ReadmeGenerator { + + static final def DEFAULT_README = ModulesListGenerator.getResource("/readme/readmeDefaultContent").text + + static final def ADOC_FOLDER = "asciidoc" + static final def README = "Readme" + static final def README_FILE = "${README}.adoc" + static final def README_HTML = "${README}.html" + static final def SITE_FOLDER = "site" + static final def INDEX_HTML = "index.html" + + public static void checkReadme(project, properties, log) { + log.info "Checking ${ADOC_FOLDER}/${README_FILE}" + def asciidoc = Paths.get(project.getBasedir().toString(), ADOC_FOLDER) + def readme = Paths.get(asciidoc.toString(), README_FILE) + if (!Files.exists(readme)) { + log.info "Generating ${readme}" + Files.createDirectories(asciidoc) + Files.createFile(readme) + readme.toFile().text = new SimpleTemplateEngine().createTemplate(DEFAULT_README) + .make(["artifactId": project.artifactId]) + .toString() + } + } + + public static void fixSite(project, properties, log) { + def index = Paths.get(project.build.directory.toString(), SITE_FOLDER, INDEX_HTML) + if (Files.exists(index)) { + log.info "Fixing links in generated site" + def html = index.toFile().text + log.info "Fixing ${ADOC_FOLDER} ${README_HTML} link" + index.toFile().text = html.replaceAll("[./]*${README}\\.html", README_HTML) + } + } +} diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy new file mode 100644 index 000000000..65245b2e0 --- /dev/null +++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.common.scripts + +import groovy.text.SimpleTemplateEngine + +import java.nio.file.Path +import java.nio.file.Paths + +/** + * Generate startup shell scripts for a honeycomb distribution. + */ +class StartupScriptGenerator { + + static final def DEFAULT_START_SCRIPT_TEMPLATE = StartupScriptGenerator.getResource("/scripts/startScript").text + static final def FORK_SCRIPT_TEMPLATE = StartupScriptGenerator.getResource("/scripts/forkScript").text + static final def KILL_SCRIPT_TEMPLATE = StartupScriptGenerator.getResource("/scripts/killScript").text + static final def README_TEMPLATE = StartupScriptGenerator.getResource("/scripts/README").text + + static final def JVM_PARAMS_KEY = "exec.parameters" + static final def DEFAULT_ADDITIONAL_JVM_PROPERTIES = "" + static final def JVM_DEBUG_PARAMS_KEY = "debug.parameters" + static final def START_SCRIPT_TEMPLATE_KEY = "start.script.template" + static final def MINIMAL_RESOURCES_FOLDER = "honeycomb-minimal-resources" + + static final def STARTUP_SCRIPT_NAME = "honeycomb" + static final def KILL_SCRIPT_NAME = "honeycomb-kill" + static final def FORK_STARTUP_SCRIPT_NAME = "honeycomb-start" + static final def DEFAULT_DEBUG_JVM_PARAMS = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" + + public static void generate(project, properties, log) { + log.info "Generating honeycomb shell scripts for ${project.artifactId}" + + // JVM params, defined in pom or no special params + def additionalJvmParameters = properties.getOrDefault(JVM_PARAMS_KEY, DEFAULT_ADDITIONAL_JVM_PROPERTIES) + log.debug "Additional JVM properties: ${additionalJvmParameters}" + // Startup script template, can be overridden by property in pom + def scriptTemplate = properties.getOrDefault(START_SCRIPT_TEMPLATE_KEY, DEFAULT_START_SCRIPT_TEMPLATE) + log.debug "Template used for startup script: ${scriptTemplate}" + // JVM debug params, defined in pom or no special params + def debugJvmParameters = properties.getOrDefault(JVM_DEBUG_PARAMS_KEY, DEFAULT_DEBUG_JVM_PARAMS) + log.debug "Debug JVM properties: ${additionalJvmParameters}" + + def jvmParameters = "${additionalJvmParameters} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar" + def scriptParent = Paths.get(project.build.outputDirectory, MINIMAL_RESOURCES_FOLDER) + scriptParent.toFile().mkdirs() + + def startScriptPath = generateStartupScript(jvmParameters, log, scriptParent, scriptTemplate) + def forkScriptPath = generateForkingStartupScript(scriptParent, log) + def debugScriptPath = generateDebugStartupScript(debugJvmParameters, jvmParameters, log, scriptParent, scriptTemplate) + def killScriptPath = generateKillScript(log, scriptParent) + generateReadme(scriptParent, log, startScriptPath, forkScriptPath, debugScriptPath, killScriptPath, project) + } + + private static def generateReadme(scriptParent, log, + startScriptPath, forkScriptPath, debugScriptPath, killScriptPath, project) { + def readmePath = Paths.get(scriptParent.toString(), "README") + + def readmeContent = new SimpleTemplateEngine().createTemplate(README_TEMPLATE).make( + ["groupId" : project.groupId, + "artifactId" : project.artifactId, + "version" : project.version, + "startScript": startScriptPath.fileName, + "forkScript" : forkScriptPath.fileName, + "debugScript": debugScriptPath.fileName, + "killScript" : killScriptPath.fileName]).toString() + log.info "Writing README to ${readmePath}" + flushScript(readmePath, readmeContent) + } + + private static def generateDebugStartupScript(debugJvmParameters, javaArgs, log, Path scriptParent, + scriptTemplate) { + def exec = "java ${debugJvmParameters} ${javaArgs}" + log.info "Debug script content to be used: ${exec}" + def scriptPath = Paths.get(scriptParent.toString(), "honeycomb-debug") + log.info "Writing shell debug script to ${scriptPath}" + flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(scriptTemplate).make(["exec": exec]).toString()) + } + + private static def generateForkingStartupScript(scriptParent, log) { + def scriptPath = Paths.get(scriptParent.toString(), FORK_STARTUP_SCRIPT_NAME) + log.info "Writing forking startup script to ${scriptPath}" + flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(FORK_SCRIPT_TEMPLATE).make().toString()) + } + + private static def flushScript(filePath, content) { + filePath.toFile().text = content + filePath.toFile().setExecutable(true) + filePath + } + + private static def generateStartupScript(javaArgs, log, scriptParent, scriptTemplate) { + def exec = "java ${javaArgs}" + log.info "Startup script content to be used: ${exec}" + def scriptPath = Paths.get(scriptParent.toString(), STARTUP_SCRIPT_NAME) + log.info "Writing startup script to ${scriptPath}" + flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(scriptTemplate).make(["exec": exec]).toString()) + } + + private static def generateKillScript(log, scriptParent) { + def scriptPath = Paths.get(scriptParent.toString(), KILL_SCRIPT_NAME) + log.info "Writing kill script to ${scriptPath}" + flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(KILL_SCRIPT_TEMPLATE).make().toString()) + } +} diff --git a/common/common-scripts/src/main/resources/modules/modulesListDefaultContent b/common/common-scripts/src/main/resources/modules/modulesListDefaultContent new file mode 100644 index 000000000..32c2bf878 --- /dev/null +++ b/common/common-scripts/src/main/resources/modules/modulesListDefaultContent @@ -0,0 +1,7 @@ +// Generated from ${groupId}/${artifactId}/${version} +// +// 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, e.g: io.fd.test.SampleModule, and separated with comma. \ No newline at end of file diff --git a/common/common-scripts/src/main/resources/readme/readmeDefaultContent b/common/common-scripts/src/main/resources/readme/readmeDefaultContent new file mode 100644 index 000000000..b50837275 --- /dev/null +++ b/common/common-scripts/src/main/resources/readme/readmeDefaultContent @@ -0,0 +1,3 @@ += ${artifactId} + +Overview of ${artifactId} \ No newline at end of file diff --git a/common/common-scripts/src/main/resources/scripts/README b/common/common-scripts/src/main/resources/scripts/README new file mode 100644 index 000000000..80b1519f1 --- /dev/null +++ b/common/common-scripts/src/main/resources/scripts/README @@ -0,0 +1,26 @@ += This is a Honeycomb distribution + +Built from: ${groupId}/${artifactId} +Version: ${version} + +https://wiki.fd.io/view/Honeycomb + +== Structure + +Structure of the distribution: + +=== Config +Folder config contains any configuration that's exposed by Honeycomb and its plugins + +=== Cert +Keystore/Truststore for Restconf's HTTPS endpoint + +=== Modules +Folder modules contains text files with list of modules to be installed into Honeycomb. +Those modules bring up Honeycomb's infrastructure as well as modules. + +=== Shell scripts +${startScript} - Start Honeycomb +${debugScript} - Start Honeycomb with JVM remote debug capabilities +${forkScript} - Start Honeycomb in background +${killScript} - Kill all running Honeycomb instances diff --git a/common/common-scripts/src/main/resources/scripts/forkScript b/common/common-scripts/src/main/resources/scripts/forkScript new file mode 100644 index 000000000..443ff0dfe --- /dev/null +++ b/common/common-scripts/src/main/resources/scripts/forkScript @@ -0,0 +1,2 @@ +#!/bin/sh - +\$(dirname \$0)/honeycomb & \ No newline at end of file diff --git a/common/common-scripts/src/main/resources/scripts/killScript b/common/common-scripts/src/main/resources/scripts/killScript new file mode 100644 index 000000000..a32aaa6b6 --- /dev/null +++ b/common/common-scripts/src/main/resources/scripts/killScript @@ -0,0 +1,2 @@ +#!/bin/sh - +kill `ps aux | grep 'java.*honeycomb' | awk '{print \$2}' \ No newline at end of file diff --git a/common/common-scripts/src/main/resources/scripts/startScript b/common/common-scripts/src/main/resources/scripts/startScript new file mode 100644 index 000000000..94aec859e --- /dev/null +++ b/common/common-scripts/src/main/resources/scripts/startScript @@ -0,0 +1,13 @@ +#!/bin/sh - +STATUS=100 + +while [ \$STATUS -eq 100 ] +do + ${exec} + STATUS=\$? + echo "Honeycomb exited with status: \$STATUS" + if [ \$STATUS -eq 100 ] + then + echo "Restarting..." + fi +done \ No newline at end of file diff --git a/common/honeycomb-parent/pom.xml b/common/honeycomb-parent/pom.xml index 6660360fd..5843d4144 100644 --- a/common/honeycomb-parent/pom.xml +++ b/common/honeycomb-parent/pom.xml @@ -77,12 +77,13 @@ 1.5.3 1.3.1 + + 2.0 - -= ${project.artifactId} + 2.4.7 + 2.9.2-01 + 2.4.3-01 -Overview of ${project.artifactId} - https://nexus.fd.io/content/sites/site io/fd/honeycomb @@ -458,18 +459,7 @@ Overview of ${project.artifactId} - import java.nio.file.Files - import java.nio.file.Paths - - log.info "Checking asciidoc/Readme.adoc" - def asciidoc = Paths.get(project.getBasedir().toString(), "asciidoc") - def readme = Paths.get(asciidoc.toString(), "Readme.adoc") - if (!Files.exists(readme)) { - log.info "Generating ${readme}" - Files.createDirectories(asciidoc) - Files.createFile(readme) - readme.toFile().text = properties.getOrDefault("readme.default", "") - } + io.fd.honeycomb.common.scripts.ReadmeGenerator.checkReadme(project, properties, log) @@ -483,20 +473,18 @@ Overview of ${project.artifactId} - import java.nio.file.Files - import java.nio.file.Paths - - def index = Paths.get(project.build.directory.toString(), "site", "index.html") - if (Files.exists(index)) { - log.info "Fixing links in generated site" - def html = index.toFile().text - log.info "Fixing asciidoc Readme link" - index.toFile().text = html.replaceAll("[./]*Readme\\.html", "Readme.html") - } + io.fd.honeycomb.common.scripts.ReadmeGenerator.fixSite(project, properties, log) + + + io.fd.honeycomb.common + common-scripts + 1.16.12-SNAPSHOT + + 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 + + diff --git a/common/pom.xml b/common/pom.xml index 32588812c..651b12cd3 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -30,6 +30,7 @@ Aggregator for common maven parents providing base configuration for Honeycomb modules + common-scripts checkstyle honeycomb-parent api-parent diff --git a/infra/translate-spi/asciidoc/Readme.adoc b/infra/translate-spi/asciidoc/Readme.adoc index 755538c07..6b4dc799c 100644 --- a/infra/translate-spi/asciidoc/Readme.adoc +++ b/infra/translate-spi/asciidoc/Readme.adoc @@ -1,4 +1,3 @@ -= Honeycomb translation layer SPI += translate-spi -Provides root, child and list customizer interfaces for extending readers/writers. -Customizers can be used to implement actual data reads and writes. \ No newline at end of file +Overview of translate-spi \ No newline at end of file -- cgit 1.2.3-korg