Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bundle module to bundle our client. #67

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ plugins {
id 'maven'
id 'org.ajoberstar.git-publish' version '3.0.0'
id 'nebula.release' version '15.2.0'
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
}

group 'com.emc.ecs'
Expand Down
125 changes: 125 additions & 0 deletions bundle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
plugins {
id 'java'
id 'signing'
id 'maven-publish'
id 'com.github.johnrengelman.shadow'
}

group = rootProject.group
description = rootProject.description

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
// Let user use this dependencies
shadow 'org.slf4j:slf4j-api:1.7.32'
shadow 'commons-logging:commons-logging:1.2'
implementation(rootProject) {
// used for Jackson
exclude group: 'jakarta.xml.bind'
exclude group: 'jakarta.activation'
// used for jersey-json
exclude group: 'javax.xml.bind'
exclude group: 'com.sun.xml.bind'
exclude group: 'javax.activation'
// log
exclude group: 'org.slf4j'
exclude group: 'commons-logging'
}
}

shadowJar {
archiveClassifier = null
def r = { String p -> relocate(p, 'com.emc.object.shadow.' + p) }
r 'com.fasterxml'
r 'com.sun.jersey'
r 'com.sun.ws.rs'
r 'com.sun.istack'
r 'javax.ws.rs'
r 'org.apache.commons.codec'
r 'org.apache.http'
r 'org.codehaus.jettison'
r 'org.dom4j'
r 'SevenZip'

mergeServiceFiles()
}

jar {
enabled = false
}

publishing {
publications {
mavenJava(MavenPublication) { p ->
project.shadow.component(p)
artifact tasks.getByPath(":javadocJar")
artifact tasks.getByPath(":sourcesJar")
pom {
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'
}
}
}
}
}
repositories {
maven {
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = rootProject.property("sonatypeUser")
password = rootProject.property("sonatypePass")
}
}
}
}

signing {
sign publishing.publications.mavenJava
}

/**
* The unit test task is to verify bundled jar.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

task shadowTestJar(type: ShadowJar) {
archiveClassifier = "tests"
from rootProject.sourceSets.test.output
configurations = []
relocators = shadowJar.relocators
}

test {
// add original unit tests
testClassesDirs = rootProject.test.testClassesDirs
// shadow test files
classpath = tasks.shadowTestJar.outputs.files +
// original runtime class path without shadowed dependencies
(rootProject.configurations.testRuntimeClasspath - shadowJar.includedDependencies) +
// shadow jar
shadowJar.outputs.files
}
2 changes: 1 addition & 1 deletion geo-pin-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'com.github.johnrengelman.shadow'
}

group 'com.emc.ecs'
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rootProject.name = 'object-client'
include 'geo-pin-cli'
include 'bundle'
project(":bundle").name = 'object-client-bundle'