Exit Full View

Itchy / build.gradle

version = '0.4'

repositories {
    mavenCentral()
    mavenLocal()
}


apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'application'

mainClassName = "uk.co.nickthecoder.itchy.Launcher"

sourceCompatibility = 1.7
targetCompatibility = 1.7

dependencies {
    compile 'uk.co.nickthecoder:jame:1.1'
    compile 'uk.co.nickthecoder:jame-native-linux_x86_64:1.1'
    //compile 'uk.co.nickthecoder:jame-native-win32:1.1'
    compile 'junit:junit:4.12'
    compile 'org.python:jython-standalone:2.5.2'
    compile 'org.codehaus.groovy:groovy-all:2.4.5'
    compile 'uk.co.nickthecoder:prioritydoc:0.1'
}


javadoc {
    source = sourceSets.main.allJava
    classpath = configurations.compile
    
    options.doclet = "uk.co.nickthecoder.prioritydoc.PriorityDoc"
    options.addStringOption( "mainpackage", "uk.co.nickthecoder.itchy" )
    options.addStringOption( "overwriteresources" )
    options.addStringOption( "usecookies" )
    options.addStringOption( "title", "Itchy" )
    options.addStringOption( "link", "http://docs.oracle.com/javase/7/docs/api/")
    options.addStringOption( "diagrams", "src/docs/collisionStrategyDiagram.xml;src/docs/classDiagram.xml" )
    
    options.docletpath = configurations.compile.files.asType(List)
    verbose = false
}

// A horrible chunk of code which extracts the contents of the "native" jar files
// which are listed as project dependencies.
task extractNatives() {
    project.configurations.compile.each { file ->
        if ( file.name.startsWith( 'jame-native-' ) ) {
            def arch = file.name.substring(12).split('-')[0]
            project.file( "${project.buildDir}/natives/${arch}" ).mkdirs()
            
            def jar = new java.util.jar.JarFile( file )
            jar.entries().each { je->
                if ( ['.so','.dll'].any { je.name.endsWith( it ) } ) {
                    project.file("${project.buildDir}/natives/${arch}/${je.name}").bytes = jar.getInputStream(je).bytes
                }
            }
        }
    }
}

run {
    systemProperty 'java.library.path', file( 'build/natives/linux_x86_64' )
}