[#2003] Generate a io.netty.util.Version class which holds the version

This commit is contained in:
Norman Maurer 2013-11-24 13:40:47 +01:00
parent a01f246091
commit 75280ac6e3
3 changed files with 73 additions and 0 deletions

2
.gitignore vendored
View File

@ -11,4 +11,6 @@
/reports
*/reports
.DS_Store
/common/src/main/java/io/netty/util/Version.java

View File

@ -74,6 +74,64 @@
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>write-version</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<exec executable="git" outputproperty="gitOutput" resultproperty="gitExitCode" failonerror="false" failifexecutionfails="false">
<arg value="log" />
<arg value="-1" />
<arg value="--format=format:%h" />
</exec>
<if>
<equals arg2="0" arg1="${gitExitCode}" />
<then>
<property name="buildNumber" value="${gitOutput}" />
</then>
<else>
<property name="buildNumber" value="unknown" />
</else>
</if>
<echo>Build number: ${buildNumber}</echo>
<mkdir dir="${project.build.directory}" />
<echo message="${project.version}" file="${project.build.directory}/version.txt" />
<echo message="// DO NOT MODIFY - WILL BE OVERWRITTEN DURING THE BUILD PROCESS${line.separator}package io.netty.util;${line.separator}/**${line.separator} * Provides the version information of Netty.${line.separator} * @apiviz.landmark${line.separator} */${line.separator}@SuppressWarnings(&quot;all&quot;)${line.separator}public final class Version {${line.separator} /** The version identifier. */${line.separator} public static final String ID = &quot;${project.version}-${buildNumber}&quot;;${line.separator} /** Prints out the version identifier to stdout. */${line.separator} public static void main(String[] args) { System.out.println(ID); }${line.separator} private Version() { }${line.separator}}${line.separator}" file="${basedir}/src/main/java/io/netty/util/Version.java" />
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

13
pom.xml
View File

@ -530,6 +530,19 @@
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>