Skip to content

Commit

Permalink
Remove the maven git plugin, and instead get the git description, bra…
Browse files Browse the repository at this point in the history
…nch and abbreviated commit SHA through environment variables.

In the process we're also removing the `Version.getCommitDescription()` API, because now it's plainly obvious from the commit and branch name, when the build is based on a random check-out and built on some unspecified machine.

The build servers will make sure that their environments are set up, such that their builds have the correct branch name and commit SHAs.
  • Loading branch information
chrisvest committed Dec 11, 2015
1 parent c565fd9 commit f1cd4e0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 74 deletions.
32 changes: 0 additions & 32 deletions community/kernel/pom.xml
Expand Up @@ -43,10 +43,8 @@
<bundle.namespace>org.neo4j</bundle.namespace>
<short-name>kernel</short-name>
<version-package>kernel.impl</version-package>
<git.executable>git</git.executable>
<license-text.header>GPL-3-header.txt</license-text.header>
<licensing.prepend.text>notice-gpl-prefix.txt</licensing.prepend.text>
<git.directory>${project.basedir}/../../.git</git.directory>
</properties>

<packaging>jar</packaging>
Expand Down Expand Up @@ -75,27 +73,6 @@ the relevant Commercial Agreement.
</license>
</licenses>

<profiles>
<profile>
<id>neo4j-root</id>
<activation>
<property><name>neo4j-root</name></property>
</activation>
<properties>
<git.directory>${project.basedir}/../../../.git</git.directory>
</properties>
</profile>
<profile>
<id>git-windows</id>
<activation>
<os><family>Windows</family></os>
</activation>
<properties>
<git.executable>git.cmd</git.executable>
</properties>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -126,15 +103,6 @@ the relevant Commercial Agreement.
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<configuration>
<dotGitDirectory>${git.directory}</dotGitDirectory>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<useNativeGit>true</useNativeGit>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
Expand Down
10 changes: 0 additions & 10 deletions community/kernel/src/main/java/org/neo4j/kernel/Version.java
Expand Up @@ -114,18 +114,9 @@ public final String getRevision()
result.append( build ).append( '/' );
}
result.append( getCommitId() );
if ( getCommitDescription().endsWith( "-dirty" ) )
{
result.append( "-dirty" );
}
return result.toString();
}

protected String getCommitDescription()
{
return "{CommitDescription}";
}

protected String getBuildNumber()
{
return "{BuildNumber}";
Expand Down Expand Up @@ -170,7 +161,6 @@ public static void main( String[] args )
System.out.println( "Version: " + kernelVersion.getVersion() );
System.out.println( "ReleaseVersion: " + kernelVersion.getReleaseVersion() );
System.out.println( "Revision: " + kernelVersion.getRevision() );
System.out.println( "CommitDescription: " + kernelVersion.getCommitDescription() );
System.out.println( "BuildNumber: " + kernelVersion.getBuildNumber() );
System.out.println( "BranchName: " + kernelVersion.getBranchName() );
System.out.println( "CommitId: " + kernelVersion.getCommitId() );
Expand Down
69 changes: 37 additions & 32 deletions pom.xml
Expand Up @@ -34,6 +34,8 @@
<hsqldb.version>2.3.2</hsqldb.version>
<test.runner.jvm.settings>-Xmx1G -XX:MaxPermSize=128M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=target/test-data</test.runner.jvm.settings>
<doclint-groups>reference</doclint-groups>
<git.commit.id.branch>unknown-branch-${project.version}</git.commit.id.branch>
<git.commit.id>unknown-commit</git.commit.id>
</properties>

<modules>
Expand Down Expand Up @@ -84,7 +86,6 @@
</loadresource>
<mkdir dir="target/generated-sources/version/org/neo4j/${version-dir}/" />
<property name="build.number" value="${env.BUILD_NUMBER}" />
<property name="git.describe" value="${git.commit.id.describe}" />
<property name="git.branch" value="${git.commit.id.branch}" />
<property name="git.commit" value="${git.commit.id}" />
<echo file="target/generated-sources/version/org/neo4j/${version-dir}/ComponentVersion.java">package org.neo4j.${the-package};
Expand All @@ -101,7 +102,6 @@ public class ComponentVersion extends Version
protected @Override String getBuildNumber() { return "${build.number}"; }
protected @Override String getCommitId() { return "${git.commit}"; }
protected @Override String getBranchName() { return "${git.branch}"; }
protected @Override String getCommitDescription() { return "${git.describe}"; }
}
</echo>
</sequential>
Expand Down Expand Up @@ -184,28 +184,6 @@ public class ComponentVersion extends Version
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.2.0.0</version>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.13</version>
<executions>
<execution>
<id>generate-git-hash</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<skipPoms>false</skipPoms>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<gitDescribe>
<dirty>-dirty</dirty>
<abbrev>7</abbrev>
<forceLongFormat>true</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
<plugin>
<groupId>org.neo4j.build.plugins</groupId>
<artifactId>licensing-maven-plugin</artifactId>
Expand Down Expand Up @@ -282,6 +260,41 @@ public class ComponentVersion extends Version
</build>

<profiles>
<!--
Git information extraction profiles.
Activate by adding the required Git information to the environment, e.g. on *nix:

export GIT_BRANCH
export GIT_COMMIT
GIT_BRANCH=$(git rev-parse - -abbrev-ref HEAD)
GIT_COMMIT=$(git rev-parse - -short HEAD)
-->
<profile>
<id>attach-git-info-branch</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env.GIT_BRANCH</name>
</property>
</activation>
<properties>
<git.commit.id.describe>${env.GIT_BRANCH}</git.commit.id.describe>
</properties>
</profile>
<profile>
<id>attach-git-info-commit</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env.GIT_COMMIT</name>
</property>
</activation>
<properties>
<git.commit.id.describe>${env.GIT_COMMIT}</git.commit.id.describe>
</properties>
</profile>

<!-- Build configuration profiles -->
<profile>
<id>neo-full-build</id>
<activation>
Expand Down Expand Up @@ -536,14 +549,6 @@ public class ComponentVersion extends Version
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.ow2.jotm</groupId>
<artifactId>jotm-core</artifactId>
<version>2.2.3</version>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-j2ee</artifactId>
Expand Down

0 comments on commit f1cd4e0

Please sign in to comment.