Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

220 lines (173 sloc) 5.9 KB
plugins {
id("biz.aQute.bnd.builder") version "4.1.0"
id("com.diffplug.gradle.spotless") version "3.19.0" apply false
id("io.codearte.nexus-staging") version "0.20.0"
}
apply from: "configuration.gradle"
configure(allprojects) {
version = cfgVersion
}
nexusStaging {
packageGroup = cfgGroup
username = cfgRepositoryUser
password = cfgRepositoryPass
stagingProfileId = cfgStagingProfileId
}
configure(javaProjects) {
apply plugin: "java-library"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "signing"
apply plugin: "biz.aQute.bnd.builder"
apply plugin: "com.diffplug.gradle.spotless"
uploadArchives.enabled = false
group = cfgGroup
if (!project.properties.containsKey('cfgJavaVersion')) {
project.ext {
cfgJavaVersion = '1.8'
}
}
sourceCompatibility = cfgJavaVersion
targetCompatibility = cfgJavaVersion
repositories {
mavenCentral()
mavenLocal()
}
sourceSets {
itest {
compileClasspath += sourceSets.main.runtimeClasspath
}
}
dependencies {
testCompile group: "junit", name: "junit", version: "4.12"
itestCompile group: "junit", name: "junit", version: "4.12"
}
jar {
manifest {
version = project.version.replace("-", ".")
}
}
spotless {
java {
googleJavaFormat()
}
}
tasks.withType(JavaCompile) {
doFirst {
if (sourceCompatibility == '1.7' && System.env.JDK7_HOME != null) {
options.fork = true
options.bootstrapClasspath = files("$System.env.JDK7_HOME/jre/lib/rt.jar")
}
}
}
task jarAll(type: Copy) {
dependsOn(configurations.default.getAllArtifacts().getBuildDependencies())
//only the jar file created:
from configurations.default.getAllArtifacts().getFiles()
if (cfgCopyDependencies) {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
} else {
into "build/libs-all"
}
//includes all the dependencies:
from configurations.default
} else {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
} else {
into "build/libs-all"
}
}
}
build.dependsOn { jarAll }
eclipse.pathVariables([GRADLE_USER_HOME: file(gradle.gradleUserHomeDir)])
tasks.eclipse.dependsOn(cleanEclipse)
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
javadoc {
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
}
}
configure(repositoryProjects) {
uploadArchives.enabled = true
if (cfgSignPom) {
signing {
if (project.hasProperty("signing.keyId")) {
sign configurations.archives
}
}
}
uploadArchives {
repositories {
mavenDeployer {
if (cfgSignPom) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: cfgRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
snapshotRepository(url: cfgSnapshotRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgSnapshotRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgSnapshotRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
pom.project {
//additional pom information can be found in subproject build.gradle files
packaging "jar"
url "http://www.beanit.com/"
scm {
url "none"
connection "none"
}
developers {
developer {
id "beanit"
name "Beanit GmbH"
}
}
}
}
}
}
}
task javadocAll(type: Javadoc) {
source docProjects.collect {
project -> project.sourceSets.main.allJava
}
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
destinationDir = new File(buildDir, "docs/javadoc-all")
classpath = files(distributionProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
classpath += files(distributionProjects.collect { project ->
project.sourceSets.main.output
})
}
tasks.withType(Tar) {
dependsOn(distributionProjects.build)
dependsOn(javadocAll)
compression = Compression.GZIP
destinationDir = file("build/distributions/")
}
task(tar, type: Tar) {
archiveName = project.name + "-" + project.version + ".tgz"
}
You can’t perform that action at this time.