Skip to content

Commit

Permalink
Merge pull request #10 from shy950521/bugfix-sdk-547-update-gradle-an…
Browse files Browse the repository at this point in the history
…d-jackson

[SDK-547] upgrade gradle & JacksonJaxbJsonProvider
  • Loading branch information
shy950521 authored Mar 30, 2021
2 parents 0f794f2 + 0476d9d commit 09016cf
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 33 deletions.
235 changes: 223 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, EMC Corporation.
* Copyright (c) 2015-2021, EMC Corporation.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
Expand All @@ -24,29 +24,240 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
plugins {
id 'idea'
id 'eclipse'
id 'java'
id 'net.saliman.cobertura' version '3.0.0'
id 'distribution'
id 'signing'
id 'maven'
id 'org.ajoberstar.git-publish' version '3.0.0'
id 'nebula.release' version '15.2.0'
}

group 'com.emc.ecs'
description = 'Smart REST Client - JAX-RS (Jersey) REST client that provides client-side load balancing with a pluggable host list provider'

// name of the github project repository
ext.githubProjectName = 'smart-client-java'
// URL to github project
ext.githubProjectUrl = "https://github.com/EMCECS/${githubProjectName}"
// git remote scm address
ext.githubScmUrl = "scm:[email protected]:EMCECS/${githubProjectName}.git"
// git remote https address
ext.githubRemoteUrl = "https://github.com/EMCECS/${githubProjectName}.git"
// license info
ext.licenseName = 'The BSD 3-Clause License'
ext.licenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'

buildscript {
ext.commonBuildVersion = '1.6'
ext.commonBuildDir = "https://raw.githubusercontent.com/emcvipr/ecs-common-build/v$commonBuildVersion"
apply from: "$commonBuildDir/ecs-publish.buildscript.gradle", to: buildscript
}
defaultTasks 'distZip'

apply from: "$commonBuildDir/ecs-publish.gradle"
repositories {
mavenCentral()
}

dependencies {
compile 'com.sun.jersey:jersey-client:1.19.4',
'com.sun.jersey.contribs:jersey-apache-client4:1.19.4',
implementation 'com.sun.jersey:jersey-client:1.19.4',
'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.12.1',
'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.12.1',
'org.apache.httpcomponents:httpclient:4.2.6',
'org.slf4j:slf4j-api:1.7.5'
compile('com.sun.jersey:jersey-json:1.19.4') {
implementation ('com.sun.jersey:jersey-json:1.19.4') {
exclude group: 'org.codehaus.jackson'
}
runtime 'org.slf4j:slf4j-log4j12:1.7.5'
testCompile 'junit:junit:4.12',
implementation 'com.sun.jersey.contribs:jersey-apache-client4:1.19.4'

runtimeOnly 'org.slf4j:slf4j-log4j12:1.7.5'
testImplementation 'junit:junit:4.12',
'log4j:log4j:1.2.17'
}

allprojects {
configurations {
tools // specifies tool artifacts for the distribution (placed in the tools/ directory)
}
}

configurations {
jars.extendsFrom(signatures)
}

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

def projectPom = {
project {
name project.name
description project.description
url githubProjectUrl

scm {
url githubProjectUrl
connection githubScmUrl
developerConnection githubScmUrl
}

licenses {
license {
name licenseName
url licenseUrl
distribution 'repo'
}
}

developers {
developer {
id 'EMCECS'
name 'Dell EMC ECS'
}
}
}
}

task writePom {
ext.pomFile = file("$buildDir/pom.xml")
outputs.file pomFile
doLast {
pom(projectPom).writeTo pomFile
}
}

jar {
doFirst {
manifest {
attributes 'Implementation-Version': project.version,
'Class-Path': configurations.runtime.collect { it.getName() }.join(' ')
}
}
into("META-INF/maven/$project.group/$project.name") {
from writePom
}
}

javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}

task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from "${docsDir}/javadoc"
}
tasks.javadocJar.dependsOn javadoc

task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
jars jar
jars javadocJar
jars sourcesJar
}

distributions {
main {
contents {
from configurations.jars.artifacts.files
into('tools') {
from { allprojects.configurations.tools.artifacts.files }
}
from('.') {
include '*.txt'
}
into('3rd-party-licenses') {
from '3rd-party-licenses'
}
into('lib') {
from configurations.runtimeClasspath
}
}
}
}

signing {
required { gradle.taskGraph.hasTask(':uploadJars') }
sign configurations.jars
}

uploadJars {
repositories {
mavenDeployer {
beforeDeployment { deployment -> signing.signPom(deployment) }

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: '', password: '')
}

pom projectPom
}
}
}

ext.aggregatedDocsDir = "$buildDir/aggregatedDocs"
task aggregateDocs {
doLast {
if (project.hasProperty('release.stage') && project.ext['release.stage'] == 'final') {
copy {
from docsDir
into "${aggregatedDocsDir}/latest"
}
}
copy {
from docsDir
into "${aggregatedDocsDir}/${project.version}"
}
}
}
tasks.aggregateDocs.dependsOn javadoc

gitPublish {
repoUri = githubRemoteUrl
branch = 'gh-pages'
contents {
from aggregatedDocsDir
}
preserve { include '**/*' }
}
tasks.gitPublishPush.dependsOn aggregateDocs

tasks.release.dependsOn test, uploadJars, gitPublishPush, distZip

clean {
delete aggregatedDocsDir
}

// allow typing in credentials
// note: this only works when run without the Gradle daemon (--no-daemon)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(':uploadJars')) {
if (!rootProject.hasProperty('signingSecretKeyRingFile'))
rootProject.ext.signingSecretKeyRingFile = new String(System.console().readLine('\nSecret key ring file: '))
if (!rootProject.hasProperty('signingKeyId'))
rootProject.ext.signingKeyId = new String(System.console().readLine('\nSigning key id: '))
if (!rootProject.hasProperty('signingPass'))
rootProject.ext.signingPass = new String(System.console().readPassword('\nSigning key passphrase: '))
if (!rootProject.hasProperty('sonatypeUser'))
rootProject.ext.sonatypeUser = new String(System.console().readLine('\nSonatype username: '))
if (!rootProject.hasProperty('sonatypePass'))
rootProject.ext.sonatypePass = new String(System.console().readPassword('\nSonatype password: '))
ext.'signing.keyId' = rootProject.ext.signingKeyId
ext.'signing.secretKeyRingFile' = rootProject.ext.signingSecretKeyRingFile
ext.'signing.password' = rootProject.ext.signingPass
uploadJars.repositories.mavenDeployer.repository.authentication.userName = rootProject.ext.sonatypeUser
uploadJars.repositories.mavenDeployer.repository.authentication.password = rootProject.ext.sonatypePass
}
if (taskGraph.hasTask(':gitPublishPush') || taskGraph.hasTask(':release')) {
if (!rootProject.hasProperty('gitUsername'))
rootProject.ext.gitUsername = new String(System.console().readLine('\nGit username: '))
if (!rootProject.hasProperty('gitPassword'))
rootProject.ext.gitPassword = new String(System.console().readPassword('\nGit password: '))
System.setProperty('org.ajoberstar.grgit.auth.username', rootProject.ext.gitUsername)
System.setProperty('org.ajoberstar.grgit.auth.password', rootProject.ext.gitPassword)
}
}
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 @@
#Thu Mar 02 11:15:41 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
48 changes: 36 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/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.
#

##############################################################################
##
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 @@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# 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" "$@"
24 changes: 17 additions & 7 deletions 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 Expand Up @@ -49,7 +65,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down

0 comments on commit 09016cf

Please sign in to comment.