Skip to content

Commit

Permalink
switch to gradle (fixes #78, via #94)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehborisov authored and eroshenkoam committed May 7, 2017
1 parent 4bc3753 commit b45f1f2
Show file tree
Hide file tree
Showing 34 changed files with 591 additions and 406 deletions.
16 changes: 11 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ pipeline {
agent {
label 'java'
}
tools {
maven 'default'
}

stages {
stage("Build") {
steps {
sh 'mvn -Dmaven.test.failure.ignore=true clean install'
sh './gradlew build'
}
}
stage("Reports") {
steps {
checkstyle pattern: '**/build/reports/checkstyle/main.xml', defaultEncoding: 'UTF8',
canComputeNew: false, healthy: '', unHealthy: ''
findbugs pattern: '**/build/reports/findbugs/main.xml', defaultEncoding: 'UTF8',
canComputeNew: false, healthy: '', unHealthy: '', excludePattern: '', includePattern: ''
pmd pattern: '**/build/reports/pmd/main.xml', defaultEncoding: 'UTF8',
canComputeNew: false, healthy: '', unHealthy: ''
}
}
}
Expand Down
148 changes: 148 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
buildscript {
repositories {
maven {
url('https://repo.jenkins-ci.org/public/')
}
}
dependencies {
classpath 'org.jenkins-ci.tools:gradle-jpi-plugin:0.22.0'
classpath 'org.jvnet.localizer:maven-localizer-plugin:1.23'
classpath 'ru.vyarus:gradle-quality-plugin:2.2.0'
}
}

plugins {
id "de.undercouch.download" version "3.2.0"
id "org.jenkins-ci.jpi" version "0.22.0"
id "java"
}

group = 'ru.yandex.qatools.allure'
version = '2.15-SNAPSHOT'

description = 'Allure Jenkins Plugin'

sourceCompatibility = "$javaLevel"
targetCompatibility = "$javaLevel"

repositories {
mavenCentral()
maven {
url('https://repo.jenkins-ci.org/public/')
}
}

jenkinsPlugin {
coreVersion = "$jenkinsVersion"
displayName = "Allure reporting plugin for Jenkins CI"
url = 'https://qameta.io/allure'
gitHubUrl = 'https://github.com/jenkinsci/allure-plugin'

developers {
developer {
id 'dchr'
name 'Denis Chernilevsky'
email 'dchr@yandex-team.ru'
}
developer {
id 'eroshenkoam'
name 'Artem Eroshenko'
email 'eroshenkoam@qameta.io'
}
developer {
id 'mavlyutov'
name 'Marat Mavlyutov'
email 'mavlyutov@yandex-team.ru'
}
developer {
id 'pupssman'
name 'Ivan Kalinin'
email 'pupssman@yandex-team.ru'
}
developer {
id 'vania-pooh'
name 'Ivan Krutov'
email 'vania-pooh@yandex-team.ru'
}
developer {
id 'baev'
name 'Dmitry Baev'
email 'baev.dm@gmail.com'
}
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}

dependencies {
compile 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.4@jar'
compile 'org.jenkins-ci.plugins:job-dsl:1.51@jar'
compile 'org.jenkins-ci.plugins:structs:1.5@jar'
compile "de.schlichtherle.truezip:truezip-driver-zip:$truezipVersion"
compile "de.schlichtherle.truezip:truezip-file:$truezipVersion"
compile 'org.jenkins-ci.plugins:job-dsl-core:1.51@jar'
compile 'org.jenkins-ci.plugins:matrix-project:1.7.1@jar'
compile 'org.jenkins-ci.plugins:script-security:1.24@jar'
compile 'org.jenkins-ci.main:jenkins-test-harness:2.15@jar'
compile 'org.jenkins-ci.plugins:junit:1.2@jar'
compileOnly 'junit:junit:4.12'

testCompile 'org.assertj:assertj-core:2.6.0'
testCompile 'ru.yandex.qatools.matchers:nio-matchers:1.3'
testCompile 'com.fasterxml.jackson.core:jackson-databind:2.7.0'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-cps:2.21@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-job:2.8@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.4@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.1@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-scm-step:1.15@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-support:2.9@jar'
testCompile 'org.jenkins-ci.plugins.workflow:workflow-api:2.4@jar'
testCompile 'org.jenkins-ci.plugins:durable-task:1.12@jar'
testCompile 'org.jenkins-ci.plugins:scm-api:1.1@jar'
testCompile 'org.jenkins-ci.plugins:mailer:1.3@jar'

testCompile "org.jenkins-ci.ui:ace-editor:1.0.1"
testCompile "org.jenkins-ci.ui:bootstrap:1.3.2:core-assets@jar"
testCompile "org.jenkins-ci.ui:handlebars:1.1.1:core-assets@jar"
testCompile "org.jenkins-ci.ui:jquery-detached:1.2.1"
testCompile "org.jenkins-ci.ui:jquery-detached:1.2.1:core-assets@jar"

testCompile 'com.cloudbees:groovy-cps:1.12'
testCompile 'org.kohsuke:groovy-sandbox:1.11'
testCompile 'org.jboss.marshalling:jboss-marshalling:1.4.9.Final'
testCompile 'org.jboss.marshalling:jboss-marshalling-river:1.4.9.Final'
}

import de.undercouch.gradle.tasks.download.Download

task downloadAllureCli(type: Download) {
src "https://github.com/allure-framework/allure1/releases/download/" +
"allure-core-$allureCommandlineVersion/allure-commandline.zip"
dest "$buildDir/resources/test/allure-commandline.zip"
}

processTestResources.dependsOn downloadAllureCli

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

//apply plugin: 'ru.vyarus.quality'
//
//quality {
// checkstyleVersion = '7.6'
// pmdVersion = '5.5.4'
// findbugsVersion = '3.0.1'
// codenarcVersion = '0.26.0'
// excludeSources = fileTree('build/generated-sources')
//}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
allureCommandlineVersion = 1.4.24.RC3
jenkinsVersion = 2.7.4
javaLevel = 1.7
truezipVersion = 7.7.10
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat Apr 01 22:01:36 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
172 changes: 172 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
echo "$*"
}

die ( ) {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading

0 comments on commit b45f1f2

Please sign in to comment.