Permalink
Fetching contributors…
Cannot retrieve contributors at this time
270 lines (225 sloc) 7.54 KB
buildscript {
ext.bouncycastleVersion = '1.54'
ext.jacksonVersion = '2.8.5'
ext.javapoetVersion = '1.7.0'
ext.jnr_unixsocketVersion = '0.15'
ext.okhttpVersion = '3.8.1'
ext.rxjavaVersion = '2.2.2'
ext.slf4jVersion = '1.7.25'
ext.javaWebSocketVersion = '1.3.8'
ext.picocliVersion = '3.0.0'
// test dependencies
ext.equalsverifierVersion = '2.1.7'
ext.junitVersion = '4.11'
ext.junitBenchmarkVersion = '0.7.2'
ext.logbackVersion = '1.2.3'
ext.mockitoVersion = '1.10.19'
repositories {
mavenCentral()
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
id "org.ajoberstar.grgit" version "3.0.0-rc.2"
// TODO: sort out the tagging
// id "net.researchgate.release" version "2.7.0"
}
apply plugin: 'java'
apply plugin: 'idea'
// should only be applied to the root project, see
// https://github.com/Codearte/gradle-nexus-staging-plugin#multi-project-build
apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'jacoco'
description 'web3j base project'
allprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
repositories {
mavenCentral()
}
// We don't want any compiler warnings
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
compileTestJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
javadoc {
options.encoding = 'UTF-8'
}
jacoco {
toolVersion = '0.7.7.201606060606' // See http://www.eclemma.org/jacoco/.
}
jacocoTestReport {
reports {
xml.enabled true
}
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
checkstyle {
toolVersion = "7.7"
configFile = file("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
}
}
subprojects {
apply plugin: 'java'
dependencies {
testCompile "junit:junit:$junitVersion",
"org.mockito:mockito-core:$mockitoVersion"
}
}
configure(subprojects.findAll { it.name != 'integration-tests' }) {
// Required for Maven Nexus repository
apply plugin: 'maven'
apply plugin: 'signing'
// Required for JFrog Artifactory repository
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
artifacts {
archives sourcesJar, javadocJar, testJar
}
ext {
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : System.getenv('OSSRH_USERNAME')
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : System.getenv('OSSRH_PASSWORD')
ossrhRepoUrl = project.hasProperty('ossrhRepoUrl') ? project.property('ossrhRepoUrl') : System.getenv('OSSRH_REPO_URL')
bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
bintrayKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
isSnapshotVersion = project.version.endsWith("-SNAPSHOT")
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier 'sources'
}
artifact testJar {
classifier 'tests'
}
}
}
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
onlyIf {
ossrhUsername != '' && ossrhPassword != '' && ossrhRepoUrl != ''
}
repository(url: ossrhRepoUrl) {
authentication(
userName: ossrhUsername,
password: ossrhPassword
)
}
pom.project {
name 'web3j'
packaging 'jar'
description project.description
url 'https://web3j.io'
scm {
connection 'scm:git:https://github.com/web3j/web3j.git'
url 'https://github.com/web3j/web3j.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'conor10'
name 'Conor Svensson'
email 'conor10@gmail.com'
}
}
}
}
}
}
signing {
required { gradle.taskGraph.hasTask('uploadArchives') } // only execute as part of this task
sign configurations.archives
}
bintray {
user = bintrayUser
key = bintrayKey
publications = ['mavenJava']
publish = true
pkg {
repo = 'maven'
name = 'org.web3j'
desc = project.description
userOrg = 'web3j'
licenses = ['Apache-2.0']
issueTrackerUrl = 'https://github.com/web3j/web3j/issues'
vcsUrl = 'https://github.com/web3j/web3j.git'
websiteUrl = 'https://web3j.io'
publicDownloadNumbers = true
}
}
task release {
//TODO run clean & closeAndPromoteRepository once
dependsOn 'build'
dependsOn 'uploadArchives'
if (!isSnapshotVersion && bintrayUser != '' && bintrayKey != '') {
dependsOn 'bintrayUpload'
tasks.findByName('bintrayUpload').mustRunAfter 'build'
}
tasks.findByName('uploadArchives').mustRunAfter 'build'
}
}
//release {
// tagTemplate = 'v${version}'
// failOnCommitNeeded = true
//}
task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
xml.enabled = true
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
'org/web3j/abi/datatypes/generated/**',
'org/web3j/tuples/generated/**',
'org/web3j/ens/contracts/generated/**'
])
})
}
}