Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge remote-tracking branch 'origin/master' into JENKINS-36472
Conflicts: src/main/java/de/tracetronic/jenkins/plugins/ecutest/ETPlugin.java
- Loading branch information
Showing
81 changed files
with
2,237 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,91 @@ | ||
#!groovy | ||
|
||
/* Required Jenkins plugins: | ||
- https://wiki.jenkins-ci.org/display/JENKINS/Timestamper | ||
- https://wiki.jenkins-ci.org/display/JENKINS/Static+Code+Analysis+Plug-ins | ||
- https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/PMD+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/DRY+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/Task+Scanner+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin | ||
- https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin | ||
*/ | ||
|
||
// Only keep the 10 most recent builds | ||
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '10']]]) | ||
|
||
// Pipeline steps | ||
timestamps { | ||
node { | ||
checkout scm | ||
|
||
def mvnHome = tool 'M3' | ||
env.JAVA_HOME = tool 'JDK7' | ||
stage('Checkout') { | ||
checkout scm | ||
} | ||
|
||
if (isUnix()) { | ||
stage 'Build' | ||
sh "${mvnHome}/bin/mvn -B -e -V -U clean package -DskipTests" | ||
stage('Build') { | ||
mvn 'clean package -B -V -U -e -DskipTests' | ||
} | ||
|
||
stage 'Static Code Analysis' | ||
sh "${mvnHome}/bin/mvn -B -e checkstyle:check pmd:check pmd:cpd-check findbugs:check" | ||
stage('Static Code Analysis') { | ||
mvn 'checkstyle:check pmd:check pmd:cpd-check findbugs:check -B -e' | ||
step([$class: 'CheckStylePublisher', pattern: 'target/checkstyle-result.xml']) | ||
step([$class: 'FindBugsPublisher', pattern: 'target/findbugsXml.xml']) | ||
step([$class: 'PmdPublisher', pattern: 'target/pmd.xml']) | ||
step([$class: 'DryPublisher', pattern: 'target/cpd.xml']) | ||
step([$class: 'TasksPublisher', high: 'FIXME', low: '', normal: 'TODO', pattern: 'src/**/*.java']) | ||
} | ||
|
||
stage 'Documentation' | ||
sh "${mvnHome}/bin/mvn -B -e javadoc:javadoc" | ||
stage('Documentation') { | ||
mvn 'javadoc:javadoc -B -e' | ||
step([$class: 'JavadocArchiver', javadocDir: 'target/site/apidocs', keepAll: false]) | ||
} | ||
|
||
stage 'Unit Tests' | ||
sh "${mvnHome}/bin/mvn -B -e test-compile jacoco:prepare-agent surefire:test" | ||
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml']) | ||
stage('Unit Tests') { | ||
mvn 'test-compile jacoco:prepare-agent surefire:test -B -e' | ||
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/TEST-*.xml']) | ||
} | ||
|
||
stage 'Code Coverage' | ||
stage('Code Coverage') { | ||
step([$class: 'JacocoPublisher', execPattern: 'target/jacoco.exec', exclusionPattern: '**/Messages.class']) | ||
} | ||
|
||
stage 'Archive Artifacts' | ||
step([$class: 'ArtifactArchiver', artifacts: 'target/ecutest.hpi', fingerprint: true]) | ||
} else { | ||
stage 'Build' | ||
bat "${mvnHome}\\bin\\mvn -B -e -V -U clean package -DskipTests" | ||
|
||
stage 'Static Code Analysis' | ||
bat "${mvnHome}\\bin\\mvn -B -e checkstyle:check pmd:check pmd:cpd-check findbugs:check" | ||
step([$class: 'CheckStylePublisher', pattern: 'target/checkstyle-result.xml']) | ||
step([$class: 'FindBugsPublisher', pattern: 'target/findbugsXml.xml']) | ||
step([$class: 'PmdPublisher', pattern: 'target/pmd.xml']) | ||
step([$class: 'DryPublisher', pattern: 'target/cpd.xml']) | ||
step([$class: 'TasksPublisher', high: 'FIXME', low: '', normal: 'TODO', pattern: 'src/**/*.java']) | ||
stage('Archive Artifacts') { | ||
step([$class: 'ArtifactArchiver', artifacts: 'target/*.hpi,target/*.jpi', fingerprint: true]) | ||
} | ||
} | ||
} | ||
|
||
stage 'Documentation' | ||
bat "${mvnHome}\\bin\\mvn -B -e javadoc:javadoc" | ||
step([$class: 'JavadocArchiver', javadocDir: 'target/site/apidocs', keepAll: false]) | ||
// Run Maven from tool "mvn" | ||
void mvn(def args) { | ||
// Get JDK tool installation | ||
def jdkHome = tool name: 'JDK7', type: 'hudson.model.JDK' | ||
|
||
stage 'Unit Tests' | ||
bat "${mvnHome}\\bin\\mvn -B -e test-compile jacoco:prepare-agent surefire:test" | ||
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/*.xml']) | ||
// Get Maven tool installation | ||
def mvnHome = tool name: 'M3', type: 'hudson.tasks.Maven$MavenInstallation' | ||
|
||
stage 'Code Coverage' | ||
step([$class: 'JacocoPublisher', execPattern: 'target/jacoco.exec', exclusionPattern: '**/Messages.class']) | ||
// Set JAVA_HOME, MAVEN_HOME and special PATH variables | ||
List javaEnv = [ | ||
"PATH+JDK=${jdkHome}/bin", | ||
"PATH+MVN=${mvnHome}/bin", | ||
"JAVA_HOME=${jdkHome}", | ||
"MAVEN_HOME=${mvnHome}", | ||
// Additional variables needed by tests on machines | ||
// that don't have global git user.name and user.email configured. | ||
'GIT_COMMITTER_EMAIL=me@hatescake.com', | ||
'GIT_COMMITTER_NAME=Hates', | ||
'GIT_AUTHOR_NAME=Cake', | ||
'GIT_AUTHOR_EMAIL=hates@cake.com', | ||
'LOGNAME=hatescake' | ||
] | ||
|
||
stage 'Archive Artifacts' | ||
step([$class: 'ArtifactArchiver', artifacts: 'target/ecutest.hpi', fingerprint: true]) | ||
// Call Maven within Java environment | ||
withEnv(javaEnv) { | ||
timeout(time: 60, unit: 'MINUTES') { | ||
if (isUnix()) { | ||
sh "${mvnHome}/bin/mvn ${args}" | ||
} else { | ||
bat "${mvnHome}\\bin\\mvn ${args}" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/de/tracetronic/jenkins/plugins/ecutest/report/AbstractReportDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* Copyright (c) 2015-2016 TraceTronic GmbH | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, this | ||
* list of conditions and the following disclaimer in the documentation and/or | ||
* other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of TraceTronic GmbH nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
package de.tracetronic.jenkins.plugins.ecutest.report; | ||
|
||
import hudson.model.AbstractProject; | ||
import hudson.tasks.BuildStepDescriptor; | ||
import hudson.tasks.Publisher; | ||
import hudson.tools.ToolInstallation; | ||
import de.tracetronic.jenkins.plugins.ecutest.tool.installation.ETInstallation; | ||
|
||
/** | ||
* Common base descriptor class for all report related publisher descriptors implemented in this plugin. | ||
* | ||
* @author Christian Pönisch <christian.poenisch@tracetronic.de> | ||
*/ | ||
public abstract class AbstractReportDescriptor extends BuildStepDescriptor<Publisher> { | ||
|
||
/** | ||
* Gets the tool installations. | ||
* | ||
* @return the installations | ||
*/ | ||
public ETInstallation[] getToolInstallations() { | ||
return getToolDescriptor().getInstallations(); | ||
} | ||
|
||
/** | ||
* Gets the tool descriptor holding the installations. | ||
* | ||
* @return the tool descriptor | ||
*/ | ||
public ETInstallation.DescriptorImpl getToolDescriptor() { | ||
return ToolInstallation.all().get(ETInstallation.DescriptorImpl.class); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
@Override | ||
public boolean isApplicable(final Class<? extends AbstractProject> jobType) { | ||
return true; | ||
} | ||
} |
Oops, something went wrong.