Skip to content

Commit

Permalink
Fix build. Upgrade to gradle 5.6. Coveralls report generated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhii Belei committed Aug 24, 2019
1 parent f9648d1 commit e88c3c2
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 51 deletions.
2 changes: 0 additions & 2 deletions .coveralls.yml

This file was deleted.

14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
jdk:
- openjdk8

language: groovy

env:
global:
secure: "CRe4vg/7rY2Tr3o65k7uNFvIPRPiGDnDoH3XtCsNozOnWF3FUCWjCG8MQXEbgywJSlqhoed5Ram2gUUB2mUJzFcopJiur2HFa9yY6dzUFWk2krm1YN3IqeIPUsx4dAqc7KxL5UNWQB/e0/famRglhWR7qOAt8N0ZrAVeEoNZwn+jvBQVj/eM4Xl6qot67JacfzjBiEIrOUivz9Q8klhaA9/oJ1Yic0WiWIbMXFCD5fLRH0qwK+po+expY5Z14z+OJnwfFObOJUllEw6mFMjGOA8KwpfiPEz+LrQNHU4zEzc/ihVgh0c2hz1w7uj3fPiySrEFbR5K+KPEPcWSYMclWcQbxy177ZabNHrF6M+xRWIR/9qQdksDCvCZaTH/OIkz4VCAwb14YrWti70yb7nZnpP/HvIw3vpz1GEVWl05Ss7wUSQIDxwbB7Ukx4RfC2abAC9VwSw83n1XJZ7NVSXfou/+N1XGnNNZED85AbLxLL8GImjDiGzrqjDb2gXplAdz78rZZmOStefDhcKwI8NQYuYNqbMVyghK5cruIqUctO0Tf5ZiEwx2zAR4UkS6EzJ8b4pvinRtdOhD9/EUAtN9LmO0gJDlOi0Iyp2pBPk9i4kmTl85/RISMO/wHmgfnWAaBkMLsSi4lG3GDXAI9I9DQ9mNeYTSKuuB2c6imVcIMWA="

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

install:

script:
./gradlew dailyBuild

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.gradle/wrapper/
37 changes: 27 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ buildscript {
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.9'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
classpath 'net.researchgate:gradle-release:2.6.0'
classpath 'com.gradle:build-scan-plugin:2.4.1'
classpath 'gradle.plugin.com.github.kt3k.coveralls:coveralls-gradle-plugin:2.8.4'
}
}

Expand All @@ -26,9 +28,8 @@ apply plugin: 'maven-publish'
apply plugin: 'net.researchgate.release'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'

sourceCompatibility = 1.6
targetCompatibility = 1.6
apply plugin: 'com.gradle.build-scan'
apply plugin: 'com.github.kt3k.coveralls'

repositories {
addAll(buildscript.repositories)
Expand All @@ -40,18 +41,30 @@ release {

defaultTasks 'dailyBuild'

jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
/*
coveralls {
jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
}
*/

task dailyBuild(type: GradleBuild) {
tasks = ['jar', 'test', 'jacocoTestReport', 'sonarqube']
tasks = ['jar', 'test', 'jacocoTestReport', 'coveralls']
}


sourceSets {

}

dependencies {
compile gradleApi()
// https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.12'
//compile 'org.codehaus.groovy:groovy-all:2.4.12'
compile 'xmlunit:xmlunit:1.3'
compile 'org.jenkins-ci:version-number:1.4'

Expand All @@ -78,10 +91,8 @@ if (! project.hasProperty('jenkinsPort')) {
ext.jenkinsPort = 9999
}

task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
}

// I use sonarcloud only for local build.
// For travis build please refer coveralls.io
sonarqube {
properties {
property "sonar.sourceEncoding", "UTF-8"
Expand All @@ -91,6 +102,12 @@ sonarqube {
}
}

buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'

publishAlways()
}


pluginBundle {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sun Feb 25 21:49:05 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip
28 changes: 22 additions & 6 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,16 +44,16 @@ 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=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

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

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -109,8 +125,8 @@ 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
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -155,7 +171,7 @@ if $cygwin ; then
fi

# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import groovyx.net.http.HttpResponseException
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.XML

import org.slf4j.Logger
import org.slf4j.LoggerFactory

class JenkinsRESTServiceImpl implements JenkinsService {

Logger logger = LoggerFactory.getLogger(JenkinsRESTServiceImpl.class);

def RESTClient client
def url
def username
Expand Down Expand Up @@ -42,8 +48,9 @@ class JenkinsRESTServiceImpl implements JenkinsService {
}

def restServiceGET(path, query) {
logger.info("Initializing rest client for:" + url)
def client = getRestClient()

logger.info("Getting data from:" + path)
def response = client.get(path: path, query: query)
if (response.success) {
return response.getData()
Expand All @@ -55,7 +62,8 @@ class JenkinsRESTServiceImpl implements JenkinsService {
def restServicePOST(path, query, payload) {
def client = getRestClient()
Crumb crumbJson = getCrumb(client)

logger.debug("crumbRequestField :" + crumbJson.crumbRequestField)
logger.debug("crumb" + crumbJson.crumb)
def response = client.post(path: path, headers: crumbJson.toMap(), query: query, requestContentType: XML, body: payload)

if (response) {
Expand Down Expand Up @@ -88,13 +96,10 @@ class JenkinsRESTServiceImpl implements JenkinsService {
throws com.terrafolio.gradle.plugins.jenkins.service.JenkinsServiceException {
def responseXml
try {

responseXml = restServiceGET(overrides.uri, overrides.params)
} catch (HttpResponseException hre) {
if (hre.response.status == 404) {
responseXml = null
} else {
throw new JenkinsServiceException("Jenkins Service Call failed", hre)
}
responseXml = null
} catch (Exception e) {
throw new JenkinsServiceException("Jenkins Service Call failed", e)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terrafolio.gradle.plugins.jenkins.service;
package com.terrafolio.gradle.plugins.service;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terrafolio.gradle.plugins.jenkins.service;
package com.terrafolio.gradle.plugins.service;

import org.gradle.api.GradleScriptException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terrafolio.gradle.plugins.jenkins.tasks;
package com.terrafolio.gradle.plugins.tasks;

import org.gradle.api.GradleScriptException;

Expand Down

0 comments on commit e88c3c2

Please sign in to comment.