summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-10-12 14:48:17 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-10-17 09:11:21 +0000
commit7236617f71a2090aa1aebac37e2b7b51330cdc73 (patch)
tree97011e0210a589adfb48c00b761d8ec59d631f8b
parent957461dcfd741fc3290e4317c2297c5618b593b5 (diff)
HONEYCOMB-157 Extract groovy scripts from poms
And put all of them into a dedicated module Change-Id: Id04c66806a89af68d821a43ef92f0a59220e04e9 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
-rw-r--r--common/common-scripts/pom.xml87
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ModulesListGenerator.groovy69
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy61
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy119
-rw-r--r--common/common-scripts/src/main/resources/modules/modulesListDefaultContent7
-rw-r--r--common/common-scripts/src/main/resources/readme/readmeDefaultContent3
-rw-r--r--common/common-scripts/src/main/resources/scripts/README26
-rw-r--r--common/common-scripts/src/main/resources/scripts/forkScript2
-rw-r--r--common/common-scripts/src/main/resources/scripts/killScript2
-rw-r--r--common/common-scripts/src/main/resources/scripts/startScript13
-rw-r--r--common/honeycomb-parent/pom.xml40
-rw-r--r--common/minimal-distribution-parent/pom.xml91
-rw-r--r--common/pom.xml1
-rw-r--r--infra/translate-spi/asciidoc/Readme.adoc5
14 files changed, 416 insertions, 110 deletions
diff --git a/common/common-scripts/pom.xml b/common/common-scripts/pom.xml
new file mode 100644
index 0000000..1e4dd84
--- /dev/null
+++ b/common/common-scripts/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>io.fd.honeycomb.common</groupId>
+ <artifactId>common-scripts</artifactId>
+ <name>${project.artifactId}</name>
+ <version>1.16.12-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <!-- groovy -->
+ <maven.groovy.version>2.0</maven.groovy.version>
+ <groovy.version>2.4.7</groovy.version>
+ <groovy.eclipse.compiler.version>2.9.2-01</groovy.eclipse.compiler.version>
+ <groovy.eclipse.batch.version>2.4.3-01</groovy.eclipse.batch.version>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ <skipDeploy>true</skipDeploy>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>${groovy.eclipse.compiler.version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher -->
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>${groovy.eclipse.compiler.version}</version>
+ </dependency>
+ <!-- for 2.8.0-01 and later you must have an explicit dependency on groovy-eclipse-batch -->
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>${groovy.eclipse.batch.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ </dependencies>
+
+</project> \ 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 0000000..c7a74d2
--- /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 0000000..5010395
--- /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 0000000..65245b2
--- /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 0000000..32c2bf8
--- /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 0000000..b508372
--- /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 0000000..80b1519
--- /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 0000000..443ff0d
--- /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 0000000..a32aaa6
--- /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 0000000..94aec85
--- /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 6660360..5843d41 100644
--- a/common/honeycomb-parent/pom.xml
+++ b/common/honeycomb-parent/pom.xml
@@ -77,12 +77,13 @@
<!-- adoc -->
<asciidoctor.maven.plugin.version>1.5.3</asciidoctor.maven.plugin.version>
<asciidoctorj.diagram.version>1.3.1</asciidoctorj.diagram.version>
+
+ <!-- groovy -->
<maven.groovy.version>2.0</maven.groovy.version>
- <readme.default>
-= ${project.artifactId}
+ <groovy.version>2.4.7</groovy.version>
+ <groovy.eclipse.compiler.version>2.9.2-01</groovy.eclipse.compiler.version>
+ <groovy.eclipse.batch.version>2.4.3-01</groovy.eclipse.batch.version>
-Overview of ${project.artifactId}
- </readme.default>
<docs.base.url>https://nexus.fd.io/content/sites/site</docs.base.url>
<docs.hc.folder>io/fd/honeycomb</docs.hc.folder>
</properties>
@@ -458,18 +459,7 @@ Overview of ${project.artifactId}
<configuration>
<!-- Generate module adoc documentation -->
<source>
- 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)
</source>
</configuration>
</execution>
@@ -483,20 +473,18 @@ Overview of ${project.artifactId}
<configuration>
<!-- Site generates wrong link to Readme.html, trying to point to Readme.html at root -->
<source>
- 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)
</source>
</configuration>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.honeycomb.common</groupId>
+ <artifactId>common-scripts</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</pluginManagement>
diff --git a/common/minimal-distribution-parent/pom.xml b/common/minimal-distribution-parent/pom.xml
index eb68991..307d31e 100644
--- a/common/minimal-distribution-parent/pom.xml
+++ b/common/minimal-distribution-parent/pom.xml
@@ -31,24 +31,8 @@
<packaging>pom</packaging>
<properties>
- <start.script.template>
-#!/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
- </start.script.template>
<exec.parameters>-Xms32m -Xmx128m -XX:MetaspaceSize=32m -XX:MaxMetaspaceSize=128m</exec.parameters>
<exec.parameters.minimal>-client -Xms20m -Xmx32m -XX:MetaspaceSize=5m -XX:MaxMetaspaceSize=32m -XX:MaxMetaspaceExpansion=1m -Xss512k -XX:+UseSerialGC -Djava.compiler=NONE -Xverify:none -noverify</exec.parameters.minimal>
- <debug.parameters>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.parameters>
<!-- Jersey versions to run RESTCONF-->
<jersey.version>1.19.1</jersey.version>
@@ -60,12 +44,6 @@ done
http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom
-->
<random.seed.file>/dev/./urandom</random.seed.file>
- <no.modules.defined.message>// 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.
- </no.modules.defined.message>
</properties>
<dependencyManagement>
@@ -185,36 +163,8 @@ done
<goal>execute</goal>
</goals>
<configuration>
- <!-- TODO HONEYCOMB-157 Make scripts more robust -->
<source>
- 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 &amp;"
- 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)
</source>
</configuration>
</execution>
@@ -227,40 +177,19 @@ done
<goal>execute</goal>
</goals>
<configuration>
- <source>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)
- }
+ <source>
+ io.fd.honeycomb.common.scripts.ModulesListGenerator.generate(project, properties, log)
</source>
</configuration>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.honeycomb.common</groupId>
+ <artifactId>common-scripts</artifactId>
+ <version>1.16.12-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</plugin>
<!-- Build archives -->
diff --git a/common/pom.xml b/common/pom.xml
index 3258881..651b12c 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -30,6 +30,7 @@
<description>Aggregator for common maven parents providing base configuration for Honeycomb modules</description>
<modules>
+ <module>common-scripts</module>
<module>checkstyle</module>
<module>honeycomb-parent</module>
<module>api-parent</module>
diff --git a/infra/translate-spi/asciidoc/Readme.adoc b/infra/translate-spi/asciidoc/Readme.adoc
index 755538c..6b4dc79 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