1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
group = 'de.erichseifert.vectorgraphics2d'
version = getVersionString()
description = 'A library for adding vector export to Java(R) Graphics2D.'
ext {
inceptionYear = 2010
owner1_id = 'eseifert'
owner1_name = 'Erich Seifert'
owner1_email = 'dev[at]erichseifert.de'
owner2_id = 'mseifert'
owner2_name = 'Michael Seifert'
owner2_email = 'mseifert[at]error-reports.org'
website = 'https://github.com/eseifert/vectorgraphics2d/'
// Determine the location of rt.jar (required for ProGuard)
if (System.getProperty('os.name').startsWith('Mac')) {
runtimeJar = "${System.getProperty("java.home")}/bundle/Classes/classes.jar"
} else {
runtimeJar = "${System.getProperty("java.home")}/lib/rt.jar"
}
}
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
testCompile 'junit:junit:4.x'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.ghost4j:ghost4j:1.0.1'
testCompile 'org.apache.xmlgraphics:batik-transcoder:1.9'
testRuntime 'org.apache.xmlgraphics:batik-codec:1.9' // Required for images with data: URLs
testRuntime 'org.slf4j:slf4j-log4j12:1.7.25' // Required for Cobertura
}
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:debian'
}
}
task shrinkJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
description = 'Uses ProGuard to reduce the code size of this project.'
group = 'Build'
// Configure ProGuard
configuration("${projectDir}/src/etc/proguard.conf")
target(targetCompatibility.toString())
injars(jar.archivePath)
outjars("${libsDir}/shrunk/${jar.archiveName}")
libraryjars(runtimeJar)
libraryjars(configurations.runtime)
}
task sourceJar(type: Jar) {
description = 'Assembles a jar archive containing the source code of the main classes.'
group = 'Build'
from sourceSets.main.allJava
classifier 'sources'
}
task javadocJar(type: Jar) {
description = 'Assembles a jar archive containing the API doc.'
group = 'Build'
from javadoc
classifier 'javadoc'
}
apply plugin: 'maven'
apply plugin: 'signing'
artifacts {
archives shrinkJar.getOutJarFileCollection().getSingleFile(), sourceJar, javadocJar
}
signing {
required { hasProperty('signing.keyId') && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
signArchives.dependsOn(shrinkJar)
/*
* This method must not be named getVersion, because it would
* overwrite the implicit getter of the version property in the
* current Project object.
*/
def getVersionString() {
def out = new ByteArrayOutputStream()
exec {
commandLine('dpkg-parsechangelog', '-S', 'Version')
standardOutput = out
}
return out.toString().trim().split('-')[0]
}
|