plugins {
    id 'war'
}

sourceSets {
    main {
        java {
            srcDir 'src/src'
            srcDir 'build/messages-src'
        }
    }
}

dependencies {
    implementation project(':core')
    implementation project(':apps:jetty')
}

// Create the java files from the po files. The jar task will compile them.
// This requires gettext 0.19 or higher.
// We don't support the "slow way"
task bundle {
    doLast {
        if (!(new File("$buildDir/classes/java/main/i2p/susi/webmail/messages_de.class")).exists())
            println "apps/susimail/bundle-messages.sh".execute().text
    }
}
war.dependsOn bundle

war {
    from 'src'
    exclude 'WEB-INF/web.xml'
    exclude 'LICENSE'
    exclude 'src'
    exclude 'susimail.properties'
    webInf {
        into 'classes'
        from 'src/susimail.properties'
        duplicatesStrategy 'include'
    }
    webXml = file('src/WEB-INF/web.xml')
}

artifacts {
    archives war
}
