/*==========================================================================
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 - Service Stub and Transparent Proxy"

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.engine.WilmaApplication'

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

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 {
    manifest.attributes( 'provider': 'gradle')
    manifest.attributes( 'Main-Class': mainClassName)
    manifest.attributes( 'Implementation-Title': "$componentDescription - V" + archiveVersion.get())
    manifest.attributes( 'Launcher-Agent-Class': "com.epam.wilma.stubconfig.initializer.support.helper.Agent")
    finalizedBy shadowJar
}

dependencies {
    implementation project(':wilma-application:wilma-common')
    implementation project(':wilma-application:wilma-core')
    implementation project(':wilma-application:wilma-domain')
    implementation project(':wilma-application:wilma-proxy-integration')
    implementation project(':wilma-application:wilma-webapp')
    implementation project(':wilma-application:wilma-route-engine')
    implementation project(':wilma-application:wilma-message-maintainer')
    implementation project(':wilma-application:wilma-message-sequence')
    implementation project(':wilma-application:wilma-safeguard')
    implementation project(':wilma-application:wilma-stub-configuration-parser')
    implementation project(':wilma-application:wilma-stub-configuration-domain')
    implementation project(':wilma-application:wilma-property-validation')
    implementation project(':wilma-application:wilma-properties')
    implementation "$googleGuavaApi"
    implementation group: 'org.eclipse.jetty', name: 'jetty-webapp', version:"${jettyVersion}"
    implementation group: 'ognl', name: 'ognl', version:'3.3.4'
    implementation "$javaxAnnotationApi"
}
