/**
 * This build.gradle exists to package Node Explorer as an executable fat jar.
 */
apply plugin: 'us.kirchmeier.capsule'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.artifactory'

description 'Node Explorer'

configurations {
    runtimeArtifacts.extendsFrom runtimeClasspath
}

capsule {
    version capsule_version
}

task buildExplorerJAR(type: FatCapsule, dependsOn: project(':tools:explorer').tasks.jar) {
    applicationClass 'net.corda.explorer.Main'
    archiveBaseName = 'node-explorer'
    archiveVersion = corda_release_version
    archiveClassifier = jdkClassifier
    archiveName = archiveFileName.get()
    applicationSource = files(
        project(':tools:explorer').configurations.runtimeClasspath,
        project(':tools:explorer').tasks.jar,
        project(':tools:explorer').sourceSets.main.java.outputDir.toString() + '/ExplorerCaplet.class'
    )

    capsuleManifest {
        applicationVersion = corda_release_version
        systemProperties['visualvm.display.name'] = 'Node Explorer'
        minJavaVersion = '1.8.0'
        minUpdateVersion['1.8'] = java8_minUpdateVersion
        caplets = ['ExplorerCaplet']

        // JVM configuration:
        // - Switch to the G1 GC which is going to be the default in Java 9 and gives low pause times/string dedup.
        //
        jvmArgs = ['-XX:+UseG1GC']
    }
}

assemble.dependsOn buildExplorerJAR

artifacts {
    runtimeArtifacts buildExplorerJAR
    publish buildExplorerJAR {
        classifier ""
    }
}

jar {
    classifier "ignore"
    enabled = false
}

publish {
    disableDefaultJar = true
    name 'corda-tools-explorer'
}
