Merge branch 'stable-3.0'
* stable-3.0:
Enable build and format validation
Set version to 3.0.0
Fix scm connection and url
pom.xml: Externalise Gerrit version variable
Change-Id: Ie9036bfe870c4011f14cca21ae86b8c6c0c3e33e
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..a090baf
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,31 @@
+pipeline {
+ agent { label 'bazel-debian' }
+ stages {
+ stage('GJF') {
+ steps {
+ sh 'mvn process-sources'
+ script {
+ def formatOut = sh (script: 'git status --porcelain', returnStdout: true)
+ if (formatOut.trim()) {
+ def files = formatOut.split('\n').collect { it.split(' ').last() }
+ files.each { gerritComment path:it, message: 'Needs reformatting with GJF' }
+ gerritReview labels: [Formatting: -1]
+ } else {
+ gerritReview labels: [Formatting: 1]
+ }
+ }
+ }
+ }
+ stage('build') {
+ steps {
+ gerritReview labels: [Verified: 0], message: "Build started: ${env.BUILD_URL}"
+ sh 'mvn test'
+ }
+ }
+ }
+ post {
+ success { gerritReview labels: [Verified: 1] }
+ unstable { gerritReview labels: [Verified: 0], message: "Build is unstable: ${env.BUILD_URL}" }
+ failure { gerritReview labels: [Verified: -1], message: "Build failed: ${env.BUILD_URL}" }
+ }
+}
diff --git a/pom.xml b/pom.xml
index 41657ea..98cf971 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>com.gerritforge</groupId>
<artifactId>global-refdb</artifactId>
- <version>0.1.1</version>
+ <version>3.0.0</version>
<packaging>jar</packaging>
<name>global-refdb</name>
@@ -20,8 +20,8 @@
</licenses>
<scm>
- <url>https://review.gerrithub.io/gerritforge/global-refdb.git</url>
- <connection>https://review.gerrithub.io/gerritforge/global-refdb.git</connection>
+ <url>https://review.gerrithub.io/GerritForge/global-refdb.git</url>
+ <connection>https://review.gerrithub.io/GerritForge/global-refdb.git</connection>
</scm>
<developers>
@@ -38,19 +38,20 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <gerrit.version>3.0.2</gerrit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-api</artifactId>
- <version>3.0.2</version>
+ <version>${gerrit.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-acceptance-framework</artifactId>
- <version>3.0.2</version>
+ <version>${gerrit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -123,6 +124,30 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>googleformatter-maven-plugin</artifactId>
+ <version>1.7.3</version>
+ <executions>
+ <execution>
+ <id>reformat-sources</id>
+ <configuration>
+ <includeStale>false</includeStale>
+ <style>GOOGLE</style>
+ <formatMain>true</formatMain>
+ <formatTest>true</formatTest>
+ <filterModified>false</filterModified>
+ <skip>false</skip>
+ <fixImports>true</fixImports>
+ <maxLineLength>100</maxLineLength>
+ </configuration>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>