summaryrefslogtreecommitdiffstats
path: root/common/common-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'common/common-scripts')
-rw-r--r--common/common-scripts/pom.xml60
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/AsciiDocImgForwarder.groovy44
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy61
-rw-r--r--common/common-scripts/src/main/resources/readme/readmeDefaultContent3
4 files changed, 8 insertions, 160 deletions
diff --git a/common/common-scripts/pom.xml b/common/common-scripts/pom.xml
index cc78e816c..3de8e3c9d 100644
--- a/common/common-scripts/pom.xml
+++ b/common/common-scripts/pom.xml
@@ -18,6 +18,13 @@
<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">
+ <parent>
+ <groupId>io.fd.honeycomb.scripts</groupId>
+ <artifactId>scripts-parent</artifactId>
+ <version>1.18.01-SNAPSHOT</version>
+ <relativePath>../scripts-parent</relativePath>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>io.fd.honeycomb.common</groupId>
<artifactId>common-scripts</artifactId>
@@ -26,68 +33,17 @@
<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>
<commons-io.version>2.5</commons-io.version>
- <yang-binding.version>0.10.1-Carbon</yang-binding.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>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>yang-binding</artifactId>
- <version>${yang-binding.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@@ -97,7 +53,7 @@
<dependency>
<groupId>io.fd.honeycomb.yang</groupId>
<artifactId>yang-whitelist-impl</artifactId>
- <version>1.18.01-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
</dependencies>
diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/AsciiDocImgForwarder.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/AsciiDocImgForwarder.groovy
deleted file mode 100644
index 5bdf0cd32..000000000
--- a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/AsciiDocImgForwarder.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 java.nio.file.Files
-import java.nio.file.Paths
-
-class AsciiDocImgForwarder {
-
- static final def ADOC_FOLDER = "asciidoc"
- static final def SITE_FOLDER = "site"
- static final def PNG_EXTENSION = "png";
-
- /**
- * Copies generated images to site folder
- * */
- public static void copyGeneratedImages(project, properties, log){
-
- def sourcePath = Paths.get(project.basedir.toString(), ADOC_FOLDER)
- def destinationPathString = Paths.get(project.build.directory.toString(), SITE_FOLDER).toString()
-
- log.info "Copying generated asciidoc images from ${sourcePath} to ${destinationPathString}"
- Files.walk(sourcePath)
- .filter({ path -> path.toString().endsWith(PNG_EXTENSION) })
- .forEach({ sourceFilePath ->
- def targetFilePath = Paths.get(destinationPathString, sourceFilePath.getFileName().toString())
- log.info "Copying ${sourceFilePath} to ${targetFilePath}"
- Files.copy(sourceFilePath, targetFilePath) })
- }
-}
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
deleted file mode 100644
index 5010395ea..000000000
--- a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/ReadmeGenerator.groovy
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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/resources/readme/readmeDefaultContent b/common/common-scripts/src/main/resources/readme/readmeDefaultContent
deleted file mode 100644
index b50837275..000000000
--- a/common/common-scripts/src/main/resources/readme/readmeDefaultContent
+++ /dev/null
@@ -1,3 +0,0 @@
-= ${artifactId}
-
-Overview of ${artifactId} \ No newline at end of file