/*==========================================================================
 Copyright since 2013, EPAM Systems

 This file is part of Wilma.

 Wilma is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Wilma is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Wilma.  If not, see <http://www.gnu.org/licenses/>.
===========================================================================*/

ext.componentDescription = "Wilma - Message Search Engine"

apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'

buildscript {
    repositories {
        gradlePluginPortal()
    }
    dependencies {
        classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
    }
}

mainClassName="com.epam.wilma.message.search.engine.MessageSearchApplication"

def configFileDefaultPath = "$project.projectDir/message.search.conf.properties";
if (!hasProperty("configFilePath")) {
    project.ext.configFilePath = configFileDefaultPath
}
run{
    args = ["$configFilePath"];
}

dependencies {
    implementation project(':wilma-message-search:wilma-message-search-domain')
    implementation project(':wilma-message-search:wilma-message-search-lucene')
    implementation project(':wilma-message-search:wilma-message-search-webapp')
    implementation project(':wilma-message-search:wilma-message-search-properties')
    implementation group: 'ch.qos.logback', name: 'logback-classic', version: "${logbackVersion}"
    implementation (group: 'org.slf4j', name: 'jcl-over-slf4j', version: "${orgSfl4jVersion}") {
        exclude(module: 'slf4j-api')
    }
    implementation "$javaxAnnotationApi"
    implementation group: 'org.apache.activemq', name: 'activemq-spring', version:'5.11.1'
}

jar {
    manifest.attributes( 'provider': 'gradle')
    manifest.attributes( 'Main-Class': 'com.epam.wilma.message.search.engine.MessageSearchApplication')
    manifest.attributes( 'Implementation-Title': "$componentDescription - V" + archiveVersion.get())
}

shadowJar {
        append('META-INF/spring.handlers')
        append('META-INF/spring.schemas')

        excludes = [
            'META-INF/*.SF',
            'META-INF/*.DSA',
            'META-INF/*.RSA',
            'images/',
            '*.txt',
            '*.gif',
            '*.png',
            '*.dtd',
            'build.properties',
            'XPP3_1.1.4c_MIN_VERSION',
            'activemq.xsd.*',
            'about.html']
}

jar.finalizedBy shadowJar
