Skip to content

CXMM-5894: Updating project gradle #1

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

Open
wants to merge 1 commit 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
154 changes: 27 additions & 127 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@ buildscript {

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'

group = 'io.honeybadger'
version = '1.0.9'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.7'

sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = rootProject.name
mainClassName = "io.honeybadger.reporter.HoneybadgerCLI"

task wrapper(type: Wrapper) {
gradleVersion = '2.4'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

run {
standardInput = System.in
}
Expand Down Expand Up @@ -57,59 +51,59 @@ sourceSets {
java.srcDir file('src/integration/java')
resources.srcDir file('src/main/resources')
compileClasspath = sourceSets.main.output +
sourceSets.test.output +
configurations.testRuntime +
configurations.providedCompile
sourceSets.test.output +
configurations.testRuntimeClasspath +
configurations.providedCompile
runtimeClasspath = output + compileClasspath
}
}

dependencies {
// We compile against the servlet API, but we don't bring it into the dependency graph
// because the implementation is typically provided by the application server
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
providedCompile 'javax.servlet:javax.servlet-api:4.0.1'

providedCompile 'com.typesafe.play:play_2.10:2.4.2'
providedCompile 'com.typesafe.play:play_2.10:2.4.11'

// logging facade that allows users of the library to use their own logging implementations
// This is the one unshadowed dependency
compile 'org.slf4j:slf4j-api:1.7.12'
implementation 'org.slf4j:slf4j-api:2.0.5'

// ==========================================================================
// NOTE: If you are adding a dependency, be sure to shadow it in the settings
// below the dependencies section.
// ==========================================================================

// JSON processing
compile 'com.google.code.gson:gson:2.3.1'
implementation 'com.google.code.gson:gson:2.10.1'

// HTTP requesting library - used to talk to the Honeybadger API
compile('org.apache.httpcomponents:fluent-hc:4.5') {
implementation('org.apache.httpcomponents:fluent-hc:4.5.14') {
// we exclude commons logging because we replace it with a shadowed
// jcl-over-slf4j in order to redirect all logging messages over
// the slf4j interface
exclude group: 'commons-logging'
}

// Used so we don't have to pull in commons-logging as a dependency
compile 'org.slf4j:jcl-over-slf4j:1.7.12'
implementation 'org.slf4j:jcl-over-slf4j:2.0.5'

// Used to get the Honeybadger library version from the JAR manifest
compile 'com.jcabi:jcabi-manifests:1.1'
implementation 'com.jcabi:jcabi-manifests:1.2.1'

// Used for rendering HTML error page templates
compile 'com.github.spullara.mustache.java:compiler:0.8.18'
implementation 'com.github.spullara.mustache.java:compiler:0.9.10'

// Utilities for testing below

testCompile ('com.google.guava:guava:18.0') {
testImplementation('com.google.guava:guava:31.1-jre') {
exclude group: 'org.slf4j'
}

testCompile 'junit:junit:4.12'
testCompile 'ch.qos.logback:logback-classic:1.1.3'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'com.github.fge:json-schema-validator:2.2.6'
testImplementation 'junit:junit:4.13.2'
testImplementation 'ch.qos.logback:logback-classic:1.4.6'
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation 'com.github.fge:json-schema-validator:2.2.6'
}

// We don't generate an unshadowed jar
Expand Down Expand Up @@ -141,26 +135,7 @@ shadowJar {
relocate 'org.apache', 'io.honeybadger.org.apache'
relocate 'com.jcabi', 'io.honeybadger.com.jcabi'
relocate 'com.github', 'io.honeybadger.com.github'
exclude 'org/slf4j/**'
}

def installer = install.repositories.mavenInstaller

// Remove everything but slf4j
[installer]*.pom*.whenConfigured {pom ->
pom.dependencies.retainAll {
(it.artifactId == 'slf4j-api' && it.groupId == 'org.slf4j') ||
it.scope != "compile"
}
}

publishing {
publications {
shadow(MavenPublication) {
from components.shadow
artifactId = "${rootProject.name}"
}
}
exclude 'org/slf4j/**'
}

task sourcesJar(type: Jar) {
Expand All @@ -176,13 +151,15 @@ task javadocJar(type: Jar) {
task integration(type: Test) {
group = 'Verification'
description = 'Runs the integration tests.'
testClassesDir = sourceSets.integration.output.classesDir
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
}

// Dumps system properties to STDOUT
task showSystemProperties << {
System.properties.each { k, v -> println "${k}:${v}" }
task showSystemProperties {
doLast {
System.properties.each { k, v -> println "${k}:${v}" }
}
}

tasks.withType(Test) {
Expand All @@ -192,7 +169,7 @@ tasks.withType(Test) {
if (!System.getProperty(apiKeyProp) && !System.getenv("HONEYBADGER_API_KEY")) {
println 'No API key'
def msg = "${apiKeyProp} system property must be specified"
throw new org.gradle.api.InvalidUserDataException(msg)
throw new InvalidUserDataException(msg)
}

// Assume a default environment of test if it isn't specified
Expand Down Expand Up @@ -228,83 +205,6 @@ signing {
sign configurations.archives
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java

artifact sourcesJar {
classifier "sources"
}

// This messy thing is here to add proper exclusions to
// generated POMs
project.configurations[JavaPlugin.RUNTIME_CONFIGURATION_NAME].allDependencies.findAll {
it instanceof ModuleDependency && !it.excludeRules.isEmpty()
}.each { ModuleDependency dep ->
pom.withXml {
def xmlDep = asNode().dependencies.dependency.find {
it.groupId[0].text() == dep.group && it.artifactId[0].text() == dep.name
}
def xmlExclusions = xmlDep.exclusions[0]
if (!xmlExclusions) xmlExclusions = xmlDep.appendNode('exclusions')

dep.excludeRules.each { ExcludeRule rule ->
def xmlExclusion = xmlExclusions.appendNode('exclusion')
xmlExclusion.appendNode('groupId', rule.group)
xmlExclusion.appendNode('artifactId', rule.module)
}
}
}
}
}
}

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

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

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name 'Honeybadger Java Client'
packaging 'jar'
description 'Library that sends exceptions to the online error management service Honeybadger.'
url 'https://github.com/honeybadger-io/honeybadger-java'

scm {
connection 'scm:git:[email protected]:honeybadger-io/honeybadger-jvm-client-v2.git'
developerConnection 'scm:git:[email protected]:honeybadger-io/honeybadger-java.git'
url '[email protected]:honeybadger-io/honeybadger-java.git'
}

licenses {
license {
name 'MIT License'
url 'https://raw.githubusercontent.com/honeybadger-io/honeybadger-java/master/LICENSE'
}
}

developers {
developer {
id 'elijah'
name 'Elijah Zupancic'
email '[email protected]'
organizationUrl 'https://github.com/dekobon'
}
}
}
}
}
}

idea {
module {
scopes.PROVIDED.plus += [configurations.providedCompile]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip