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

ext{
    mainClassName = "mindustry.ios.IOSLauncher"
}

task copyAssets(){
    doLast{
        delete{
            delete "assets/"
        }
    
        copy{
            from "../core/assets"
            into "assets/"
        }
    }
}

task copyNatives(){
    doLast{
        copy{
            from "../../Arc/natives/natives-freetype-ios/libs", "../../Arc/natives/natives-ios/libs"
            into "libs"
        }

    }
}

task deploy{
    if(System.getProperty("os.name").contains("Mac")) dependsOn copyAssets
    dependsOn createIPA
}

//must pack before deployment, as iOS never has the latest sprites.
copyAssets.dependsOn ":tools:pack"
copyAssets.dependsOn copyNatives
launchIPhoneSimulator.dependsOn build
launchIPadSimulator.dependsOn build
launchIOSDevice.dependsOn build
createIPA.dependsOn build

robovm{
    archs = "thumbv7:arm64"

    if(project.hasProperty("signIdentity")) println "iOS Sign Identity: " + project.property("signIdentity")
    if(project.hasProperty("provisioningProfile")) println "iOS Provisioning Profile: " + project.property("provisioningProfile")

    iosSignIdentity = project.properties["signIdentity"]
    iosProvisioningProfile = project.properties["provisioningProfile"]
    iosSkipSigning = false
}
