Skip to content

Commit 4e47108

Browse files
Merge pull request #19 from EMCECS/ObjectScale-refactor
Modularization for ObjectScale
2 parents 3468eac + 3ef3b1c commit 4e47108

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+753
-182
lines changed

build.gradle

Lines changed: 146 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,18 @@
2424
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525
* POSSIBILITY OF SUCH DAMAGE.
2626
*/
27+
import com.github.jk1.license.render.InventoryHtmlReportRenderer
28+
2729
plugins {
2830
id 'idea'
2931
id 'eclipse'
3032
id 'java'
31-
id 'java-library'
32-
id 'net.saliman.cobertura' version '3.0.0'
33-
id 'distribution'
34-
id 'signing'
35-
id 'maven'
33+
id 'net.saliman.cobertura' version '3.0.0' apply false
34+
id 'com.github.jk1.dependency-license-report' version '1.14' apply false
3635
id 'org.ajoberstar.git-publish' version '3.0.0'
3736
id 'nebula.release' version '15.2.0'
3837
}
3938

40-
group 'com.emc.ecs'
41-
description = 'Smart REST Client - JAX-RS (Jersey) REST client that provides client-side load balancing with a pluggable host list provider'
42-
4339
// name of the github project repository
4440
ext.githubProjectName = 'smart-client-java'
4541
// URL to github project
@@ -52,149 +48,168 @@ ext.githubRemoteUrl = "https://github.com/EMCECS/${githubProjectName}.git"
5248
ext.licenseName = 'The BSD 3-Clause License'
5349
ext.licenseUrl = 'https://opensource.org/licenses/BSD-3-Clause'
5450

55-
defaultTasks 'distZip'
51+
subprojects {
52+
apply plugin: 'java-library'
53+
apply plugin: 'net.saliman.cobertura'
54+
apply plugin: 'com.github.jk1.dependency-license-report'
55+
apply plugin: 'distribution'
56+
apply plugin: 'signing'
57+
apply plugin: 'maven'
5658

57-
repositories {
58-
mavenCentral()
59-
}
59+
group 'com.emc.ecs'
6060

61-
dependencies {
62-
implementation 'com.sun.jersey:jersey-client:1.19.4'
63-
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.12.4'
64-
implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.12.4'
65-
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
66-
implementation 'org.slf4j:slf4j-api:1.7.32'
67-
implementation('com.sun.jersey:jersey-json:1.19.4') {
68-
exclude group: 'org.codehaus.jackson'
61+
defaultTasks 'distZip'
62+
63+
repositories {
64+
mavenCentral()
65+
mavenLocal()
6966
}
70-
implementation 'com.sun.jersey.contribs:jersey-apache-client4:1.19.4'
71-
testImplementation 'junit:junit:4.13.2'
72-
testImplementation 'org.slf4j:slf4j-log4j12:1.7.32'
73-
testRuntimeOnly 'org.slf4j:jcl-over-slf4j:1.7.32'
74-
}
7567

76-
allprojects {
7768
configurations {
78-
tools // specifies tool artifacts for the distribution (placed in the tools/ directory)
69+
jars.extendsFrom(signatures)
7970
}
80-
}
81-
82-
configurations {
83-
jars.extendsFrom(signatures)
84-
}
8571

86-
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
72+
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
8773

88-
compileJava {
89-
sourceCompatibility = 1.8
90-
targetCompatibility = 1.8
91-
}
92-
93-
def projectPom = {
94-
project {
95-
name project.name
96-
description project.description
97-
url githubProjectUrl
74+
compileJava {
75+
sourceCompatibility = 1.8
76+
targetCompatibility = 1.8
77+
}
9878

99-
scm {
79+
def projectPom = {
80+
project {
81+
name project.name
82+
description project.description
10083
url githubProjectUrl
101-
connection githubScmUrl
102-
developerConnection githubScmUrl
103-
}
10484

105-
licenses {
106-
license {
107-
name licenseName
108-
url licenseUrl
109-
distribution 'repo'
85+
scm {
86+
url githubProjectUrl
87+
connection githubScmUrl
88+
developerConnection githubScmUrl
89+
}
90+
91+
licenses {
92+
license {
93+
name licenseName
94+
url licenseUrl
95+
distribution 'repo'
96+
}
11097
}
111-
}
11298

113-
developers {
114-
developer {
115-
id 'EMCECS'
116-
name 'Dell EMC ECS'
99+
developers {
100+
developer {
101+
id 'EMCECS'
102+
name 'Dell EMC ECS'
103+
}
117104
}
118105
}
119106
}
120-
}
121107

122-
task writePom {
123-
ext.pomFile = file("$buildDir/pom.xml")
124-
outputs.file pomFile
125-
doLast {
126-
pom(projectPom).writeTo pomFile
108+
task writePom {
109+
ext.pomFile = file("$buildDir/pom.xml")
110+
outputs.file pomFile
111+
doLast {
112+
pom(projectPom).writeTo pomFile
113+
}
127114
}
128-
}
129115

130-
jar {
131-
doFirst {
132-
manifest {
133-
attributes 'Implementation-Version': project.version,
134-
'Class-Path': configurations.runtime.collect { it.getName() }.join(' ')
116+
jar {
117+
doFirst {
118+
manifest {
119+
attributes 'Implementation-Version': project.version,
120+
'Class-Path': configurations.runtime.collect { it.getName() }.join(' ')
121+
}
122+
}
123+
into("META-INF/maven/$project.group/$project.name") {
124+
from writePom
135125
}
136126
}
137-
into("META-INF/maven/$project.group/$project.name") {
138-
from writePom
127+
128+
javadoc {
129+
options.addStringOption('Xdoclint:none', '-quiet')
139130
}
140-
}
141131

142-
javadoc {
143-
options.addStringOption('Xdoclint:none', '-quiet')
144-
}
132+
task javadocJar(type: Jar) {
133+
archiveClassifier = 'javadoc'
134+
from "${docsDir}/javadoc"
135+
}
136+
tasks.javadocJar.dependsOn javadoc
145137

146-
task javadocJar(type: Jar) {
147-
archiveClassifier = 'javadoc'
148-
from "${docsDir}/javadoc"
149-
}
150-
tasks.javadocJar.dependsOn javadoc
138+
task sourcesJar(type: Jar) {
139+
archiveClassifier = 'sources'
140+
from sourceSets.main.allSource
141+
}
151142

152-
task sourcesJar(type: Jar) {
153-
archiveClassifier = 'sources'
154-
from sourceSets.main.allSource
155-
}
143+
artifacts {
144+
jars jar
145+
jars javadocJar
146+
jars sourcesJar
147+
}
156148

157-
artifacts {
158-
jars jar
159-
jars javadocJar
160-
jars sourcesJar
161-
}
149+
// remove zips and tars from "install" task
150+
configurations.archives.artifacts.removeAll {it.file =~ /(zip|tar)$/}
162151

163-
distributions {
164-
main {
165-
contents {
166-
from configurations.jars.artifacts.files
167-
into('tools') {
168-
from { allprojects.configurations.tools.artifacts.files }
169-
}
170-
from('.') {
171-
include '*.txt'
172-
}
173-
into('3rd-party-licenses') {
174-
from '3rd-party-licenses'
175-
}
176-
into('lib') {
177-
from configurations.runtimeClasspath
152+
licenseReport {
153+
renderers = [new InventoryHtmlReportRenderer()]
154+
}
155+
156+
distributions {
157+
main {
158+
contents {
159+
from configurations.jars.artifacts.files
160+
from('.') {
161+
include '*.txt'
162+
}
163+
into('3rd-party-licenses') {
164+
from generateLicenseReport
165+
}
166+
into('lib') {
167+
from configurations.runtimeClasspath
168+
}
178169
}
179170
}
180171
}
181-
}
182172

183-
signing {
184-
required { gradle.taskGraph.hasTask(':uploadJars') }
185-
sign configurations.jars
186-
}
173+
signing {
174+
required { gradle.taskGraph.hasTask(uploadJars) }
175+
sign configurations.jars
176+
}
187177

188-
uploadJars {
189-
repositories {
190-
mavenDeployer {
191-
beforeDeployment { deployment -> signing.signPom(deployment) }
178+
uploadJars {
179+
repositories {
180+
mavenDeployer {
181+
beforeDeployment { deployment -> signing.signPom(deployment) }
182+
183+
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
184+
authentication(userName: '', password: '')
185+
}
192186

193-
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
194-
authentication(userName: '', password: '')
187+
pom projectPom
195188
}
189+
}
190+
}
196191

197-
pom projectPom
192+
// allow typing in credentials
193+
// note: this only works when run without the Gradle daemon (--no-daemon).
194+
// if that's not possible, it's best to read passwords into env. variables and set these properties on the gradle
195+
// command line ( -PsigningPass="${SIGNING_PASS}" -PsonatypePass="${SONATYPE_PASS}" )
196+
gradle.taskGraph.whenReady { taskGraph ->
197+
if (taskGraph.hasTask(uploadJars)) {
198+
if (!rootProject.hasProperty('signingSecretKeyRingFile'))
199+
rootProject.ext.signingSecretKeyRingFile = new String(System.console().readLine('\nSecret key ring file: '))
200+
if (!rootProject.hasProperty('signingKeyId'))
201+
rootProject.ext.signingKeyId = new String(System.console().readLine('\nSigning key id: '))
202+
if (!rootProject.hasProperty('signingPass'))
203+
rootProject.ext.signingPass = new String(System.console().readPassword('\nSigning key passphrase: '))
204+
if (!rootProject.hasProperty('sonatypeUser'))
205+
rootProject.ext.sonatypeUser = new String(System.console().readLine('\nSonatype username: '))
206+
if (!rootProject.hasProperty('sonatypePass'))
207+
rootProject.ext.sonatypePass = new String(System.console().readPassword('\nSonatype password: '))
208+
ext.'signing.keyId' = rootProject.ext.signingKeyId
209+
ext.'signing.secretKeyRingFile' = rootProject.ext.signingSecretKeyRingFile
210+
ext.'signing.password' = rootProject.ext.signingPass
211+
uploadJars.repositories.mavenDeployer.repository.authentication.userName = rootProject.ext.sonatypeUser
212+
uploadJars.repositories.mavenDeployer.repository.authentication.password = rootProject.ext.sonatypePass
198213
}
199214
}
200215
}
@@ -203,18 +218,22 @@ ext.aggregatedDocsDir = "$buildDir/aggregatedDocs"
203218
task aggregateDocs {
204219
doLast {
205220
if (project.hasProperty('release.stage') && project.ext['release.stage'] == 'final') {
206-
copy {
207-
from docsDir
208-
into "${aggregatedDocsDir}/latest"
221+
subprojects.each { sp ->
222+
copy {
223+
from sp.docsDir
224+
into "${aggregatedDocsDir}/${sp.name}/latest"
225+
}
209226
}
210227
}
211-
copy {
212-
from docsDir
213-
into "${aggregatedDocsDir}/${project.version}"
228+
subprojects.each {sp ->
229+
copy {
230+
from sp.docsDir
231+
into "${aggregatedDocsDir}/${sp.name}/${sp.version}"
232+
}
214233
}
215234
}
216235
}
217-
tasks.aggregateDocs.dependsOn javadoc
236+
tasks.aggregateDocs.dependsOn subprojects.javadoc
218237

219238
gitPublish {
220239
repoUri = githubRemoteUrl
@@ -226,32 +245,17 @@ gitPublish {
226245
}
227246
tasks.gitPublishPush.dependsOn aggregateDocs
228247

229-
tasks.release.dependsOn test, uploadJars, gitPublishPush, distZip
248+
tasks.release.dependsOn subprojects.test, subprojects.uploadJars, gitPublishPush, subprojects.distZip
230249

231250
clean {
232251
delete aggregatedDocsDir
233252
}
234253

235254
// allow typing in credentials
236-
// note: this only works when run without the Gradle daemon (--no-daemon)
255+
// note: this only works when run without the Gradle daemon (--no-daemon).
256+
// if that's not possible, it's best to read passwords into env. variables and set these properties on the gradle
257+
// command line ( -PgitPassword="${GIT_PASSWORD}" )
237258
gradle.taskGraph.whenReady { taskGraph ->
238-
if (taskGraph.hasTask(':uploadJars')) {
239-
if (!rootProject.hasProperty('signingSecretKeyRingFile'))
240-
rootProject.ext.signingSecretKeyRingFile = new String(System.console().readLine('\nSecret key ring file: '))
241-
if (!rootProject.hasProperty('signingKeyId'))
242-
rootProject.ext.signingKeyId = new String(System.console().readLine('\nSigning key id: '))
243-
if (!rootProject.hasProperty('signingPass'))
244-
rootProject.ext.signingPass = new String(System.console().readPassword('\nSigning key passphrase: '))
245-
if (!rootProject.hasProperty('sonatypeUser'))
246-
rootProject.ext.sonatypeUser = new String(System.console().readLine('\nSonatype username: '))
247-
if (!rootProject.hasProperty('sonatypePass'))
248-
rootProject.ext.sonatypePass = new String(System.console().readPassword('\nSonatype password: '))
249-
ext.'signing.keyId' = rootProject.ext.signingKeyId
250-
ext.'signing.secretKeyRingFile' = rootProject.ext.signingSecretKeyRingFile
251-
ext.'signing.password' = rootProject.ext.signingPass
252-
uploadJars.repositories.mavenDeployer.repository.authentication.userName = rootProject.ext.sonatypeUser
253-
uploadJars.repositories.mavenDeployer.repository.authentication.password = rootProject.ext.sonatypePass
254-
}
255259
if (taskGraph.hasTask(':gitPublishPush') || taskGraph.hasTask(':release')) {
256260
if (!rootProject.hasProperty('gitUsername'))
257261
rootProject.ext.gitUsername = new String(System.console().readLine('\nGit username: '))

settings.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
rootProject.name = 'smart-client'
2+
include 'smart-client-core'
3+
include 'smart-client-jersey'
4+
include 'smart-client-ecs'
5+

smart-client-core/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description = 'Smart Client core components - This library has minimal dependencies and provides the core generic logic necesary for client-side intelligent load balancing'
2+
3+
dependencies {
4+
implementation 'org.slf4j:slf4j-api:1.7.32'
5+
6+
testImplementation 'junit:junit:4.13.2'
7+
testImplementation 'log4j:log4j:1.2.17'
8+
}
9+
10+
test {
11+
useJUnit()
12+
}

0 commit comments

Comments
 (0)