Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance to support component changelogs #4

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,69 @@ even if they are unmapped.


## Example
```
<plugin>
<groupId>com.gentics</groupId>
<artifactId>changelog-manager-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Flag that changes the folding behaviour of newlines. When enabled newlines will be folded (Except newlines in empty lines) -->
<foldNewlinesInEntries>true</foldNewlinesInEntries>

<!-- Defines the base directory where the entries, mappings, templates and static folder exists -->
<baseDirectory>${basedir}/src/changelog</baseDirectory>

<!-- Overwrite the entries directory -->
<entriesDirectory>${basedir}/src/changelog-entries</entriesDirectory>

<!-- Defines the output directory for the created changelog files -->
<outputDirectory>${basedir}/target/output</outputDirectory>

<!-- Title of the changelog -->
<changelogTitle>Gentics Content.Node Changelog</changelogTitle>

<!-- This defines which entries types should be handled. Please note that the order of the entries also affects
the sorting of the entries within the final changelog. -->
<changelogTypes>manualchange,feature,enhancement,bugfix</changelogTypes>

<!-- Defines the version for the new mapping that will be created for changelog entries without an existing mapping -->
<changelogVersion>1.2.112</changelogVersion>

<!-- Should the velocity renderer fail when eg. a null assignment is performed? -->
<strictRenderMode>false</strictRenderMode>

<!-- The names of the overview template files -->
<overviewTemplateFileNames>index.vm, merged_changelog.vm, plain_merged_changelog.vm</overviewTemplateFileNames>

<!-- Should all project properties be included? Those properties can than be used within the velocity template -->
<includeProjectProperties>false</includeProjectProperties>

<!-- Custom properties -->
<properties>
<property>
<name>alohaeditor-version</name>
<value>0.9.3</value>
</property>
<property>
<name>alohaeditor-date</name>
<value>2012/12/12</value>
</property>
</properties>
</configuration>
</plugin>
```

## Example with components

```
<plugin>
<groupId>com.gentics</groupId>
<artifactId>changelog-manager-plugin</artifactId>
Expand All @@ -76,6 +138,22 @@ even if they are unmapped.
<!-- Defines the output directory for the created changelog files -->
<outputDirectory>${basedir}/target/output</outputDirectory>

<!-- Components -->
<components>
<component>
<id>cms</id>
<name>Gentics CMS</name>
<changelogVersion>6.0.1</changelogVersion>
<entriesDirectory>${basedir}/src/test/resources/cms/entries</entriesDirectory>
</component>
<component>
<id>mesh</id>
<name>Gentics Mesh</name>
<changelogVersion>2.0.1</changelogVersion>
<entriesDirectory>${basedir}/src/test/resources/mesh/entries</entriesDirectory>
</component>
</components>

<!-- Title of the changelog -->
<changelogTitle>Gentics Content.Node Changelog</changelogTitle>

Expand Down Expand Up @@ -108,3 +186,4 @@ even if they are unmapped.
</properties>
</configuration>
</plugin>
```
89 changes: 54 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<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">
<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>com.gentics</groupId>
<artifactId>changelog-manager-plugin</artifactId>
<version>2.3.9</version>
<version>3.0.2-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Changelog Parser Maven Plugin</name>
<description>Changelog Plugin is project for managing project changes.</description>

<properties>
<rootprop>value</rootprop>
<thebeer>Warsteiner</thebeer>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>

<inceptionYear>2013</inceptionYear>
Expand All @@ -21,6 +21,10 @@
<name>Johannes Schüth</name>
<email>j.schueth@gentics.com</email>
</contributor>
<contributor>
<name>Norbert Pomaroli</name>
<email>n.pomaroli@gentics.com</email>
</contributor>
</contributors>

<licenses>
Expand All @@ -34,38 +38,44 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.3</version>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>3.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0</version>
<artifactId>maven-core</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<version>4.8.2</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.12.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<artifactId>txtmark</artifactId>
<groupId>com.github.rjeschke</groupId>
<version>0.8</version>
<version>0.13</version>
</dependency>
<dependency>
<groupId>net.sf.textile4j</groupId>
Expand All @@ -75,12 +85,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
Expand All @@ -99,7 +104,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<version>3.9.0</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Expand All @@ -116,17 +121,31 @@
<plugin>
<groupId>com.gentics</groupId>
<artifactId>changelog-manager-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<version>3.0.2-SNAPSHOT</version>
<configuration>
<baseDirectory>${basedir}/src/test/resources/testData</baseDirectory>
<baseDirectory>${basedir}/src/test/resources/component_base</baseDirectory>
<outputDirectory>${basedir}/target/output</outputDirectory>
<changelogTitle>Gentics Content.Node Changelog</changelogTitle>
<changelogTitle>Gentics CMP Changelog</changelogTitle>
<changelogTypes>manualchange,feature,enhancement,bugfix</changelogTypes>
<changelogVersion>20.2.112</changelogVersion>
<strictRenderMode>false</strictRenderMode>
<allowEmptyChangelog>true</allowEmptyChangelog>
<includeProjectProperties>false</includeProjectProperties>
<overviewTemplateFileNames>index.vm, merged_changelog.vm, plain_merged_changelog.vm</overviewTemplateFileNames>
<overviewTemplateFileNames>index.vm</overviewTemplateFileNames>
<components>
<component>
<id>cms</id>
<name>Gentics CMS</name>
<version>6.0.1</version>
<entriesDirectory>${basedir}/src/test/resources/cms/entries</entriesDirectory>
</component>
<component>
<id>mesh</id>
<name>Gentics Mesh</name>
<version>2.0.1</version>
<entriesDirectory>${basedir}/src/test/resources/mesh/entries</entriesDirectory>
</component>
</components>
<properties>
<property>
<name>alohaeditor-version</name>
Expand All @@ -143,15 +162,15 @@
</build>

<distributionManagement>
<repository>
<id>lan.releases</id>
<name>Gentics Repository Stage</name>
<url>http://artifactory.office/repository/lan.releases</url>
</repository>
<snapshotRepository>
<id>lan.snapshots</id>
<name>Gentics Snapshots Repository</name>
<url>http://artifactory.office/repository/lan.snapshots</url>
</snapshotRepository>
<repository>
<id>lan.releases</id>
<name>Gentics Repository Stage</name>
<url>https://repo.apa-it.at/artifactory/gtx-maven-releases</url>
</repository>
<snapshotRepository>
<id>lan.snapshots</id>
<name>Gentics Snapshots Repository</name>
<url>https://repo.apa-it.at/artifactory/gtx-maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public final class ChangelogConfiguration {

public static final String DEFAULT_BASE_DIRECTORY_PATH = "src/main/changelog";
Expand All @@ -13,9 +15,11 @@ public final class ChangelogConfiguration {
public static final String DEFAULT_TEMPLATE_DIRECTORY_NAME = "templates";
public static final String DEFAULT_OUTPUT_DIRECTORY_NAME = "changelog_output";
public static final String DEFAULT_MAPPING_DIRECTORY_NAME = "mappings";
public static final String DEFAULT_ENTRIES_DIRECTORY_NAME = "entries";

public static final String DEFAULT_CHANGELOG_INDEX_TEMPLATE_FILENAME = "index.vm";
public static final String DEFAULT_CHANGELOG_TEMPLATE_FILENAME = "changelog.vm";
public static final String DEFAULT_OUTPUT_FILE_EXTENSION = ".html";

public static enum ParserType {
TEXTILE, MARKDOWN
Expand All @@ -29,12 +33,17 @@ public static enum ParserType {
private static File templateDirectory;
private static File staticContentDirectory;
private static File changelogMappingDirectory;
private static File entriesDirectory;

private static List<String> changelogTypes = new ArrayList<String>();
private static List<String> overviewTemplateFileNames = new ArrayList<String>();
private static List<String> perMajorVersionOverviewTemplateFileNames = new ArrayList<String>();
private static String changelogTemplateFileName;

private static String outputFileExtension = DEFAULT_OUTPUT_FILE_EXTENSION;

private static List<Component> components;

public static final String TYPE_ENHANCEMENT = "enhancement";
public static final String TYPE_BUGFIX = "bugfix";
public static final String TYPE_SECURITY = "security";
Expand Down Expand Up @@ -82,6 +91,7 @@ public static void updateDirectories() {
staticContentDirectory = new File(baseDirectory, DEFAULT_STATIC_CONTENT_DIRECTORY_NAME);
changelogMappingDirectory = new File(baseDirectory, DEFAULT_MAPPING_DIRECTORY_NAME);
outputDirectory = new File(baseDirectory, DEFAULT_OUTPUT_DIRECTORY_NAME);
entriesDirectory = new File(baseDirectory, DEFAULT_ENTRIES_DIRECTORY_NAME);
}

/**
Expand Down Expand Up @@ -227,6 +237,29 @@ public static File getOutputDirectory() throws ChangelogManagerException {

}

/**
* Set the entries directory
* @param directory entries directory
*/
public static void setEntriesDirectory(File directory) {
entriesDirectory = directory;
}

/**
* Get the entries directory. This will also check for existence and whether it is a directory (and throw a {@link ChangelogManagerException} if not)
* @return entries directory
* @throws ChangelogManagerException if the directory does not exist or is no directory
*/
public static File getEntriesDirectory() throws ChangelogManagerException {
if (!entriesDirectory.exists()) {
throw new ChangelogManagerException(String.format("Entries directory %s does not exist", entriesDirectory.toString()));
}
if (!entriesDirectory.isDirectory()) {
throw new ChangelogManagerException(String.format("Entries directory %s is no directory", entriesDirectory.toString()));
}
return entriesDirectory;
}

/**
* Returns the list of template files
*
Expand Down Expand Up @@ -312,4 +345,26 @@ public static void setFoldNewlinesEnabled(boolean flag) {
public static boolean isFoldNewlinesEnabled() {
return isFoldNewlinesEnabled;
}

public static void setComponents(List<Component> components) {
ChangelogConfiguration.components = components;
}

public static List<Component> getComponents() {
return components;
}

public static boolean hasComponents() {
return components != null;
}

public static String getOutputFileExtension() {
return outputFileExtension;
}

public static void setOutputFileExtension(String outputFileExtension) {
if (!StringUtils.isEmpty(outputFileExtension)) {
ChangelogConfiguration.outputFileExtension = StringUtils.prependIfMissing(outputFileExtension, ".");
}
}
}
Loading