buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.1.0'
    }
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'robovm'

sourceSets.main.java.srcDirs = ["src/"]

sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

ext {
    // Configure your application main class
    mainClassName = "org.oscim.ios.RoboVmLauncher"
    roboVMVersion = "2.1.0"
}

launchIPhoneSimulator.dependsOn build
launchIPadSimulator.dependsOn build
launchIOSDevice.dependsOn build
createIPA.dependsOn build

dependencies {
    compile project(':vtm')
    compile project(':vtm-gdx')
    compile project(':vtm-themes')
    compile 'org.slf4j:slf4j-simple:1.7.21'
    compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
    compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
    compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
}

task copyVtmResources(type: Copy) {
    from("../vtm/resources")
    into("${buildDir}")
}

task copyVtmThemesResources(type: Copy) {
    from("../vtm-themes/resources")
    into("${buildDir}")
}


tasks.withType(org.gradle.api.tasks.compile.JavaCompile) {
    compileTask -> compileTask.dependsOn copyVtmResources
}

tasks.withType(org.gradle.api.tasks.compile.JavaCompile) {
    compileTask -> compileTask.dependsOn copyVtmThemesResources
}

task nativesJar(type: Jar) {
    classifier = 'natives'
    from('natives')
}

artifacts {
    archives nativesJar
}

// Automated Gradle project deployment to Sonatype OSSRH
if (isReleaseVersion && project.hasProperty("SONATYPE_USERNAME")) {
    afterEvaluate {
        project.apply from: "${rootProject.projectDir}/deploy.gradle"
    }
}