plugins {
    id 'java'
}

group 'net.example'
version '1.0-SNAPSHOT'

dependencies {
    implementation files('microemulator-2.0.4/microemulator.jar')
}

jar {
    manifest {
        attributes(
                'MIDlet-Vendor': MIDletVendor,
                'MIDlet-Version': MIDletVersion,
                'MicroEdition-Configuration': MicroEditionConfiguration,
                'MIDlet-Name': MIDletName,
                'MIDlet-Description': MIDletDescription,
                'MicroEdition-Profile': 'MicroEdition-Profile',
                'MIDlet-1': MIDletName + ',' + icon + ',' + mainClass
        )
    }
}

task runEmulator(dependsOn:jar) {
    doLast {
        javaexec {
            main = "-jar"
            args = [
                    "./microemulator-2.0.4/microemulator.jar",
                     jar.getArchiveFile().get().asFile.getAbsolutePath()
            ]
        }
    }
}

java {
    sourceCompatibility = "1.2"
    targetCompatibility = "1.1"
}