Skip to content

Instantly share code, notes, and snippets.

@ucchyocean
Created June 9, 2014 09:25
Show Gist options
  • Save ucchyocean/bc0de00f7eaf139be588 to your computer and use it in GitHub Desktop.
Save ucchyocean/bc0de00f7eaf139be588 to your computer and use it in GitHub Desktop.
ControlsFX gradle build script
import org.apache.tools.ant.filters.*
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'osgi'
apply plugin: 'maven'
apply from: 'mavenPublish.gradle'
Properties commons = new Properties()
commons.load(new FileInputStream("$rootDir/../controlsfx-build.properties"))
group = commons.controlsfx_group
version = commons.controlsfx_version
ext {
specification_version = commons.controlsfx_specification_version
specification_title = commons.controlsfx_specification_title
implementation_version = commons.controlsfx_version
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations {
jdk
}
sourceSets {
main {
compileClasspath += configurations.jdk
}
}
dependencies {
try {
jdk files(jfxrtJar)
} catch (MissingPropertyException pne) {
// javafx plugin will provide in this case
}
}
task generatei18nResources(type: Copy) {
from "src/main/resources"
into "$buildDir/resources/main"
//include "controlsfx.properties"
//rename{ String fileName -> fileName.replace("fx.prop", "fx_en.prop") }
}
processResources.dependsOn(generatei18nResources)
processResources.doLast {
ant.delete() {
fileset(dir: "$buildDir/resources/main") {
include(name: "controlsfx*.properties")
}
}
ant.native2ascii(
src: "src/main/resources",
dest: "$buildDir/resources/main",
includes: "controlsfx*.properties",
encoding: "UTF-8")
filter(EscapeUnicode)
new File("$buildDir/resources/main/controlsfx.properties").renameTo(new File("$buildDir/resources/main/controlsfx_en.properties"))
}
compileJava {
options.encoding = "UTF-8"
}
javadoc {
exclude 'impl/*'
failOnError = true
classpath = project.sourceSets.main.runtimeClasspath + configurations.jdk
options.windowTitle("ControlsFX Project ${version}")
options.links("http://docs.oracle.com/javase/8/docs/api/");
options.links("http://docs.oracle.com/javase/8/javafx/api/");
options.addBooleanOption("Xdoclint:none").setValue(true);
options.overview("src/main/docs/overview.html");
// All doc-files are located in src/main/docs because Gradle's javadoc doesn't copy
// over the doc-files if they are embedded with the sources. I find this arrangement
// somewhat cleaner anyway (never was a fan of mixing javadoc files with the sources)
doLast {
copy {
from "src/main/docs"
into "$buildDir/docs/javadoc"
}
}
}
jar {
//exclude '**/16/*'
exclude '**/32/*'
exclude '**/64/*'
exclude '**/128/*'
exclude '**/oxygen/svg/*'
manifest { // the manifest of the default jar is of type OsgiManifest
attributes (\
'Specification-Title': specification_title,\
'Specification-Version': specification_version,\
'Implementation-Title': 'ControlsFX',\
'Implementation-Version': implementation_version,\
'Bundle-Name': 'ControlsFX'
)
instruction 'Bundle-Description', 'High quality UI controls and other tools to complement the core JavaFX distribution'
instruction 'Export-Package',
'!impl.org.controlsfx.*',
'org.controlsfx.*'
}
}
task sourceJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.resources
classifier = 'sources'
}
task javadocJar(type: Jar) {
dependsOn javadoc
from javadoc.destinationDir
classifier = 'javadoc'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
artifacts {
archives sourceJar
archives javadocJar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment