// this example rebuilds the integration test project "08-build-with-proguard" from the javafx-maven-plugin


buildscript {
    apply from: '../../version.gradle'
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        // provides javafx-gradle-plugin
        classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: "${gradle.javafxGradlePluginVersion}"
        // provides proguard.gradle.ProGuardTask (including all requirements)
        classpath 'net.sf.proguard:proguard-gradle:5.2.1'
    }
}

apply plugin: 'java'

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies{
    compile 'com.miglayout:miglayout-javafx:4.2'
    compile 'commons-lang:commons-lang:2.6'
    compile 'org.slf4j:slf4j-api:1.6.1'
    compile 'org.slf4j:jcl-over-slf4j:1.6.1'
    compile 'org.slf4j:slf4j-log4j12:1.6.1'
    compile 'log4j:log4j:1.2.16'
}

apply plugin: 'javafx-gradle-plugin'

jfx {
    verbose = true
    mainClass = 'com.zenjava.test.javafx_and_proguard.MainApp'
    appName = 'javafx-proguard-gradle'
    manifestAttributes = [
        someElement: "hello world"
    ]
    jfxMainAppJarName = 'javafx-proguard-gradle-jfx.jar'
    vendor = "your fancy company"
    bundleArguments = [
        runtime: null
    ]
    alternativePathToJarFile 'build/libs/javafx-proguard-gradle.out.jar'
}

// for more details, see: http://proguard.sourceforge.net/manual/gradle.html
task myProguardTask(type: proguard.gradle.ProGuardTask) {
    configuration 'proguard.conf'
    
    // make all runtime-dependencies available while obfruscating
    configurations.runtime.resolve().each {
        libraryjars file(it.getAbsolutePath())
    }

    injars 'build/libs/javafx-proguard-gradle.jar'
    outjars 'build/libs/javafx-proguard-gradle.out.jar'
}

// set task-dependencies
jfxJar.dependsOn myProguardTask
