Skip to content

Commit

Permalink
update to jgitver 0.2.1, handle dirty state, closes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
McFoggy committed Nov 11, 2016
1 parent 0b30c14 commit 06b6902
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 12 deletions.
1 change: 1 addition & 0 deletions .mvn/jgitver.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-->
<configuration>
<useDirty>true</useDirty>
<exclusions>
<exclusion>.repository</exclusion>
<exclusion>target/local-repo</exclusion>
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ or using docker

- `docker run -v $(pwd):/root/sources -w /root/sources maven:3.3.9-jdk-8 mvn -Prun-its clean verify`

build and filter some IT tests

- `mvn -Prun-its clean install "-Dinvoker.test=issues/issue-36*"`

### Release

Expand Down
40 changes: 28 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- dependencies versions as properties -->
<jgitver.version>0.2.1</jgitver.version>
<maven-core.version>3.3.9</maven-core.version>
<plexus-utils.version>3.0.8</plexus-utils.version>
<maven-plugin-annotations.version>3.2</maven-plugin-annotations.version>
<maven-plugin-api.version>2.0</maven-plugin-api.version>
<plexus-component-annotations.version>1.5.5</plexus-component-annotations.version>
<commons-lang3.version>3.4</commons-lang3.version>
<guava.version>19.0</guava.version>
<junit.version>4.8.2</junit.version>

<!-- plugins versions as properties -->
<plexus-component-metadata.version>1.6</plexus-component-metadata.version>
<nexus-staging-maven-plugin.version>1.6.3</nexus-staging-maven-plugin.version>
<maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
</properties>

<developers>
Expand Down Expand Up @@ -100,51 +116,51 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
<version>${maven-plugin-api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>${maven-plugin-annotations.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.8</version>
<version>${plexus-utils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.9</version>
<version>${maven-core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<version>1.5.5</version>
<version>${plexus-component-annotations.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.brouillard.oss</groupId>
<artifactId>jgitver</artifactId>
<version>0.2.0</version>
<version>${jgitver.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<version>${guava.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -154,7 +170,7 @@
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.6</version>
<version>${plexus-component-metadata.version}</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -442,7 +458,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -461,7 +477,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
25 changes: 25 additions & 0 deletions src/it/issues/issue-36.1/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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.
-->
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</extension>
</extensions>
20 changes: 20 additions & 0 deletions src/it/issues/issue-36.1/.mvn/jgitver.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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.
-->
<configuration>
<useDirty>true</useDirty>
</configuration>
32 changes: 32 additions & 0 deletions src/it/issues/issue-36.1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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>fr.brouillard.oss.it</groupId>
<artifactId>issue-36</artifactId>
<version>0</version>
<packaging>pom</packaging>

<description>Verify dirty state is part of project name</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
50 changes: 50 additions & 0 deletions src/it/issues/issue-36.1/prebuild.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
*
* 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.
*/

def log = new PrintWriter( new File(basedir, "prebuild.log").newWriter("UTF-8"), true )
log.println( "Prebuild started at: " + new Date() + " in: " + basedir )

[
"git --version",
"rm -rf .git",
"git init",
"git config user.name nobody",
"git config user.email nobody@nowhere.com",
"echo A > content",
"git add .",
"git commit --message=initial_commit",
"git tag -a 1.0.0 --message=release_1.0.0",
"echo B > content",
"git status",
"git log --graph --oneline"
].each{ command ->

def proc = command.execute(null, basedir)
def sout = new StringBuilder(), serr = new StringBuilder()
proc.waitForProcessOutput(sout, serr)

log.println( "cmd: " + command )
log.println( "out:" ) ; log.println( sout.toString().trim() )
log.println( "err:" ) ; log.println( serr.toString().trim() )
log.println( "ret: " + proc.exitValue() )

assert proc.exitValue() == 0

}

log.println( "Prebuild completed at: " + new Date() )
log.close()
return true
54 changes: 54 additions & 0 deletions src/it/issues/issue-36.1/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
*
* 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.
*/

def log = new PrintWriter( new File(basedir, "verify.log").newWriter("UTF-8"), true )
log.println( "Verify started at: " + new Date() + " in: " + basedir )

[
"rm -rf .git"
].each{ command ->

def proc = command.execute(null, basedir)
def sout = new StringBuilder(), serr = new StringBuilder()
proc.waitForProcessOutput(sout, serr)

log.println( "cmd: " + command )
log.println( "out:" ) ; log.println( sout.toString().trim() )
log.println( "err:" ) ; log.println( serr.toString().trim() )
log.println( "ret: " + proc.exitValue() )

assert proc.exitValue() == 0

}

def buildLog = new File(basedir, "build.log").readLines()

// Check the version was used by the plugin execution
def versionChanges = buildLog.findAll { it =~ /fr.brouillard.oss.it::issue-36::0 -> 1.0.0-dirty/ }
log.println( "versionChanges: " + versionChanges )
assert 0 < versionChanges.size()

// And check that the produced artifact was installed with the good version
File installedPomFile = new File(localRepositoryPath, "fr/brouillard/oss/it/issue-36/1.0.0-dirty/issue-36-1.0.0-dirty.pom")
log.println( "installedPomFile: " + installedPomFile.isFile() + " " + installedPomFile )
assert installedPomFile.isFile()
def installedPomFileVersion = installedPomFile.readLines().findAll { it =~ /<version>1.0.0-dirty<\/version>/ }
log.println( "installedPomFileVersion: " + installedPomFileVersion )
assert 1 == installedPomFileVersion.size()

log.println( "Verify completed at: " + new Date() )
log.close()
return true
25 changes: 25 additions & 0 deletions src/it/issues/issue-36.2/.mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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.
-->
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</extension>
</extensions>
20 changes: 20 additions & 0 deletions src/it/issues/issue-36.2/.mvn/jgitver.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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.
-->
<configuration>
<useDirty>true</useDirty>
</configuration>
32 changes: 32 additions & 0 deletions src/it/issues/issue-36.2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr)
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>fr.brouillard.oss.it</groupId>
<artifactId>issue-36</artifactId>
<version>0</version>
<packaging>pom</packaging>

<description>Verify dirty state is part of project name</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Loading

0 comments on commit 06b6902

Please sign in to comment.