Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored build script into smaller chunks.

  • Loading branch information...
commit 0b6c4273f96ffac7f7b9830246896369fc0e8687 1 parent 7e0f0a2
@deanriverson deanriverson authored
View
182 groovyfx/build.gradle
@@ -1,33 +1,16 @@
-import java.lang.reflect.Method
-import java.lang.reflect.Modifier
-
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
-// check environment
-javafxHome = System.env['JAVAFX_HOME']
-if(!javafxHome) {
- println """Please set environment variable JAVAFX_HOME
-to the directory that contains /rt/lib/jfxrt.jar
-in version $requiredJavaFxVersion"""
- System.exit 1
-}
+// ---------------- dependencies ------------------
buildscript {
+ javafxHome = System.env['JAVAFX_HOME']
dependencies {
- classpath files("${System.env['JAVAFX_HOME']}/rt/lib/jfxrt.jar")
+ classpath files("${javafxHome}/rt/lib/jfxrt.jar")
}
}
-actualJavaFXVersion = com.sun.javafx.runtime.VersionInfo.runtimeVersion
-if (! actualJavaFXVersion.startsWith(requiredJavaFxVersion)) {
- println "Required JavaFX version is '$requiredJavaFxVersion' but actual version is '$actualJavaFXVersion'"
- System.exit(1)
-}
-// environment is ok
-
-isRelease = !version.endsWith('SNAPSHOT')
repositories {
mavenCentral()
}
@@ -39,162 +22,29 @@ dependencies {
testCompile 'junit:junit:4.10'
}
-// Define a source set for the non-standard src/demo directory
-sourceSets {
- demo {
- compileClasspath += sourceSets.main.output + configurations.compile
- runtimeClasspath += sourceSets.main.output
- groovy {
- srcDir = 'src/demo/groovy'
- }
- resources {
- srcDir = 'src/demo/resources'
- }
- }
-}
-
-task groovydocJar(type: Jar, dependsOn: groovydoc) {
- classifier = 'javadoc'
- from 'build/docs/groovydoc'
-}
-
-task sourcesJar(type: Jar) {
- from sourceSets.main.allSource
- classifier = 'sources'
-}
-
-artifacts {
- archives jar
- archives groovydocJar
- archives sourcesJar
-}
-
-signing {
- sign configurations.archives
-}
-
-uploadArchives {
- repositories.mavenDeployer {
- repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
- authentication(userName: sonatypeUsername, password: sonatypePassword)
- }
-
- snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
- authentication(userName: sonatypeUsername, password: sonatypePassword)
- }
-
- //repository(url: "file:///Users/dean/temp/m2")
- pom.project {
- name 'GroovyFX'
- url 'http://groovyfx.org'
- description 'Groovy bindings for JavaFX 2'
- packaging 'jar'
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
- scm {
- url 'scm:git@github.com:groovyfx-project/groovyfx.git'
- connection 'scm:git@github.com:groovyfx-project/groovyfx.git'
- developerConnection 'scm:git@github.com:groovyfx-project/groovyfx.git'
- }
- developers {
- developer { name 'Jim Clarke' }
- developer { name 'Dean Iverson' }
- developer { name 'Dierk Koenig' }
- developer { name 'Andres Almiray' }
- }
- }
- }
-}
-
-// Add a dynamic task to run each of the demos in src/demo/groovy
-new File('src/demo/groovy').eachFileMatch(~/.*Demo.groovy/) { file ->
- def taskName = file.name - '.groovy'
- task "$taskName"(type: JavaExec) {
- group = "Demo"
- description = "Run the $taskName program"
- main = taskName
- classpath sourceSets.main.runtimeClasspath + sourceSets.demo.runtimeClasspath
- }
-}
-
task wrap(type:Wrapper, description:"create a gradlew") {
- gradleVersion = '1.0-milestone-6'
+ gradleVersion = '1.0-milestone-8'
}
-// ---------------- generating the documentation ------------------
-
apply {
+ from 'buildSrc/scripts/demo.gradle'
+ from 'buildSrc/scripts/mavenCentralDeploy.gradle'
from 'buildSrc/scripts/docsDependencies.gradle'
from 'buildSrc/scripts/docs.gradle'
}
-def titleForDocumentation = archivesBaseName + ' ' + version
-def copyrightString = 'Copyright © 2012 The GroovyFX team. All Rights Reserved.'
-def packageTitle = group
-
-javadoc {
- //options.overview('overview.html')
- options.showAll()
- options.encoding('UTF-8')
- options.setUse(true)
- options.author(true)
- options.version(true)
- options.windowTitle(titleForDocumentation)
- options.docTitle(titleForDocumentation)
- options.footer(copyrightString)
-
- doFirst {
- javadoc.title = titleForDocumentation
- javadoc.options.docTitle = javadoc.title
- }
-}
+// ---------------- check environment ------------------
-groovydoc {
- dependsOn(classes)
- includePrivate = true
- use = true
- windowTitle = packageTitle
- docTitle = packageTitle
- header = packageTitle
- footer = copyrightString
- include 'groovyx/**'
- //overview = new File('overview.html')
+if(!javafxHome) {
+ println """Please set environment variable JAVAFX_HOME
+ to the directory that contains /rt/lib/jfxrt.jar
+ in version $requiredJavaFxVersion""".stripIndent()
+ System.exit 1
}
-task documentation(dependsOn: ['javadoc', 'groovydoc', 'buildGuide', 'pdfGuide'],
- description: 'Create the API documentation and guide.')
-
-// experimental
-
-def findWebProperties(String accessor) {
- javafx.scene.web.WebView."$accessor"
- .findAll{ Method m -> Modifier.isPublic(m.modifiers) }
- .name.findAll { it.startsWith('set') }
- .findAll { ! (it =~ /(i|I)mpl_/) } // I guess these should be removed
- .collect { it[3].toLowerCase() + it[4..-1] }
+actualJavaFXVersion = com.sun.javafx.runtime.VersionInfo.runtimeVersion
+if (! actualJavaFXVersion.startsWith(requiredJavaFxVersion)) {
+ println "Required JavaFX version is '$requiredJavaFxVersion' but actual version is '$actualJavaFXVersion'"
+ System.exit(1)
}
-task webViewPropDoc(description: 'merge JavaFX infos with GroovyFX infos') {
- def allProps = findWebProperties('methods').sort()
- def addedWebProps = ['location']
- def selfProps = (findWebProperties('declaredMethods') + addedWebProps).sort()
- File file = new File('grails-doc/src/ref/webView/Properties.gdoc')
-
- if (!file.parentFile.exists())
- file.parentFile.mkdirs()
-
- file.withWriter('utf-8') { out ->
- //out << "{hidden}\nauto-generated: do not edit!\n{hidden}" // looks like the hidden macro is not in place
- out << "\nh1. Properties of webView "
- out << "\nh2. Self declared properties"
- for (prop in selfProps) { out << "\n* $prop" }
- out << "\nh2. Inherited properties "
- for (prop in allProps-selfProps) { out << "\n* $prop" }
- }
-}
-buildGuide.dependsOn webViewPropDoc
View
27 groovyfx/buildSrc/scripts/demo.gradle
@@ -0,0 +1,27 @@
+// ------------- compiling demo source ---------------
+
+sourceSets {
+ demo {
+ compileClasspath += sourceSets.main.output + configurations.compile
+ runtimeClasspath += sourceSets.main.output
+ groovy {
+ srcDir = 'src/demo/groovy'
+ }
+ resources {
+ srcDir = 'src/demo/resources'
+ }
+ }
+}
+
+// ---------------- dynamic tasks to run demos ------------------
+
+new File('src/demo/groovy').eachFileMatch(~/.*Demo.groovy/) { file ->
+ def taskName = file.name - '.groovy'
+ task "$taskName"(type: JavaExec) {
+ group = "Demo"
+ description = "Run the $taskName program"
+ main = taskName
+ classpath sourceSets.main.runtimeClasspath + sourceSets.demo.runtimeClasspath
+ }
+}
+
View
79 groovyfx/buildSrc/scripts/docs.gradle
@@ -1,3 +1,6 @@
+import java.lang.reflect.Method
+import java.lang.reflect.Modifier
+
// shamelessly copied from GPars
guideBuildDirectory = "${buildDir}/guide"
@@ -21,3 +24,79 @@ task zipGuide(type: Zip, dependsOn: pdfGuide) {
appendix = 'guide'
from guideBuildDirectory
}
+
+// ---------------- generating the documentation ------------------
+
+def titleForDocumentation = archivesBaseName + ' ' + version
+def copyrightString = 'Copyright &#169; 2012 The GroovyFX team. All Rights Reserved.'
+def packageTitle = group
+
+javadoc {
+ //options.overview('overview.html')
+ options.showAll()
+ options.encoding('UTF-8')
+ options.setUse(true)
+ options.author(true)
+ options.version(true)
+ options.windowTitle(titleForDocumentation)
+ options.docTitle(titleForDocumentation)
+ options.footer(copyrightString)
+
+ doFirst {
+ javadoc.title = titleForDocumentation
+ javadoc.options.docTitle = javadoc.title
+ }
+}
+
+groovydoc {
+ dependsOn(classes)
+ includePrivate = true
+ use = true
+ windowTitle = packageTitle
+ docTitle = packageTitle
+ header = packageTitle
+ footer = copyrightString
+ include 'groovyx/**'
+ //overview = new File('overview.html')
+}
+
+task documentation(dependsOn: ['javadoc', 'groovydoc', 'buildGuide', 'pdfGuide'],
+ description: 'Create the API documentation and guide.')
+
+// buildscript config needs to be repeated here or javafx.scene.web.WebView
+// in findWebProperties() below will not be recognized.
+buildscript {
+ dependencies {
+ classpath files("${javafxHome}/rt/lib/jfxrt.jar")
+ }
+}
+
+// experimental
+def findWebProperties(String accessor) {
+ javafx.scene.web.WebView."$accessor"
+ .findAll{ Method m -> Modifier.isPublic(m.modifiers) }
+ .name.findAll { it.startsWith('set') }
+ .findAll { ! (it =~ /(i|I)mpl_/) } // I guess these should be removed
+ .collect { it[3].toLowerCase() + it[4..-1] }
+}
+
+task webViewPropDoc(description: 'merge JavaFX infos with GroovyFX infos') {
+ def allProps = findWebProperties('methods').sort()
+ def addedWebProps = ['location']
+ def selfProps = (findWebProperties('declaredMethods') + addedWebProps).sort()
+ File file = new File('grails-doc/src/ref/webView/Properties.gdoc')
+
+ if (!file.parentFile.exists())
+ file.parentFile.mkdirs()
+
+ file.withWriter('utf-8') { out ->
+ //out << "{hidden}\nauto-generated: do not edit!\n{hidden}" // looks like the hidden macro is not in place
+ out << "\nh1. Properties of webView "
+ out << "\nh2. Self declared properties"
+ for (prop in selfProps) { out << "\n* $prop" }
+ out << "\nh2. Inherited properties "
+ for (prop in allProps-selfProps) { out << "\n* $prop" }
+ }
+}
+buildGuide.dependsOn webViewPropDoc
+
View
59 groovyfx/buildSrc/scripts/mavenCentralDeploy.gradle
@@ -0,0 +1,59 @@
+// ------------- Maven Central deployment ---------------
+
+task groovydocJar(type: Jar, dependsOn: groovydoc) {
+ classifier = 'javadoc'
+ from 'build/docs/groovydoc'
+}
+
+task sourcesJar(type: Jar) {
+ from sourceSets.main.allSource
+ classifier = 'sources'
+}
+
+artifacts {
+ archives jar
+ archives groovydocJar
+ archives sourcesJar
+}
+
+signing {
+ sign configurations.archives
+}
+
+uploadArchives {
+ repositories.mavenDeployer {
+ repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
+ authentication(userName: sonatypeUsername, password: sonatypePassword)
+ }
+
+ snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
+ authentication(userName: sonatypeUsername, password: sonatypePassword)
+ }
+
+ //repository(url: "file:///Users/dean/temp/m2")
+ pom.project {
+ name 'GroovyFX'
+ url 'http://groovyfx.org'
+ description 'Groovy bindings for JavaFX 2'
+ packaging 'jar'
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ scm {
+ url 'scm:git@github.com:groovyfx-project/groovyfx.git'
+ connection 'scm:git@github.com:groovyfx-project/groovyfx.git'
+ developerConnection 'scm:git@github.com:groovyfx-project/groovyfx.git'
+ }
+ developers {
+ developer { name 'Jim Clarke' }
+ developer { name 'Dean Iverson' }
+ developer { name 'Dierk Koenig' }
+ developer { name 'Andres Almiray' }
+ }
+ }
+ }
+}
View
1  groovyfx/gradle.properties
@@ -3,3 +3,4 @@ archivesBaseName = groovyfx
version = 0.2-SNAPSHOT
requiredJavaFxVersion = 2.1.0
groovyVersion = 1.8.6
+
Please sign in to comment.
Something went wrong with that request. Please try again.