buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven {
            url "https://ihealthbuild.agilexhealth.com/artifactory/plugins-release-local"
        }
        maven {
            url "https://ihealthbuild.agilexhealth.com/artifactory/plugins-snapshot-local"
        }
    }

    dependencies {
        classpath group: "com.agilex.build",
                name: "buildPlugin",
                version: "1.0-SNAPSHOT"
    }
}
apply plugin: 'build'

apply plugin: 'maven-publish'
publishing {
    repositories {
        maven {
            name 'Release'
            url 'https://ihealthbuild.agilexhealth.com/artifactory/agilex'
            credentials {
                username "${artifactoryUser}"
                password "${artifactoryPass}"
            }
        }
        maven {
            name 'Final'
            url 'https://ihealthbuild.agilexhealth.com/artifactory/agilex'
            credentials {
                username "${artifactoryUser}"
                password "${artifactoryPass}"
            }
        }
        maven {
            name 'Snapshot'
            url 'https://ihealthbuild.agilexhealth.com/artifactory/agilex'
            credentials {
                username "${artifactoryUser}"
                password "${artifactoryPass}"
            }
        }
    }

    publications {
        maven(MavenPublication) {
            version "${project.buildArgs.buildVersion}"

            from components.web
        }
    }
}

apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'

if (System.properties['isWeblogic']) {
    apply from: '../weblogic.gradle'
}

ant.importBuild '../ant-builds/tomcat/targets.xml'
ant.importBuild '../liquibase/schedulingmanager-db-build.xml'

repositories {
    mavenCentral()
    mavenRepo url: "http://ihealthbuild.agilexhealth.com/artifactory/agilex/"
    mavenRepo url: "http://maven.springframework.org/snapshot/"
}

archivesBaseName = 'SchedulingManagerService'
group = 'com.agilex.vamf.scheduling'

war {
	replicationType = System.properties['replicationType']

	if (replicationType == null) {
		replicationType = 'memory'
	}

	from(webAppDir) {
		include '**/weblogic.xml'
		filter(org.apache.tools.ant.filters.ReplaceTokens,tokens: ['wls_replication_type': replicationType])
	}
}

dependencies {
    compile project(":SchedulingManagerLib")
    compile project(":SchedulingManagerMDWSLib")

    compile(group: 'agilex.metrics-servicelib', name:'MetricsServiceLib', version: '1.0.0-SNAPSHOT'){
        exclude module: 'HealthAdapterLib'
        exclude module: 'AuthServicesLib'
    }

    compile(group: 'com.agilex.messaging', name: 'VamfServiceBus', version: '0.9')
    compile(group: 'com.agilex.messaging', name: 'BeanStalkProvider', version: '0.9')
    compile 'javax.mail:mail:1.4.6'
    compile "org.hibernate:hibernate-core:3.5.6-Final"
    compile "org.hibernate:hibernate-annotations:3.5.6-Final"
    compile "org.hibernate:hibernate-entitymanager:3.5.6-Final"

    compile "org.apache.cocoon:cocoon-spring-configurator:2.1.0"
    compile "org.apache.cocoon:cocoon-configuration-api:1.0.2"

    compile "org.springframework.security:spring-security-core:3.1.0.RELEASE"
    compile "org.springframework.security:spring-security-config:3.1.0.RELEASE"
    compile "org.springframework.security:spring-security-web:3.1.0.RELEASE"
    compile "org.springframework.security:spring-security-taglibs:3.1.0.RELEASE"
    compile "org.springframework.security.oauth:spring-security-oauth2:1.0.0.RELEASE"
    compile "org.aspectj:aspectjrt:1.6.0"
    compile "org.aspectj:aspectjweaver:1.6.10"

    compile 'com.sun.jersey:jersey-server:1.12'
    compile 'com.sun.jersey:jersey-core:1.12'
    compile 'com.sun.jersey:jersey-client:1.12'
    compile 'com.sun.jersey:jersey-servlet:1.12'
    compile 'com.sun.jersey:jersey-json:1.12'
    compile "com.sun.jersey.contribs:jersey-spring:1.12"
    compile "com.lowagie:itext:2.1.7"

    compile "javax.servlet:servlet-api:2.5"
	compile "javax.servlet:jstl:1.2"
//    compile 'agilex.vamf.note:note-jarvis-gateway:0.1.0-SNAPSHOT'
//    compile 'agilex.vamf.immunization:immunization-jarvis-gateway:0.1.0-SNAPSHOT'
    compile 'javax.ws.rs:jsr311-api:1.1.1'

    compile "org.springframework:spring-orm:3.1.1.RELEASE"

    runtime 'com.oracle:ojdbc6:11.2'
    runtime 'mysql:mysql-connector-java:5.1.17'
    runtime 'org.liquibase:liquibase-core:2.0.5'

    compile "backport-util-concurrent:backport-util-concurrent:3.1"

    runtime "rome:rome:0.9"

    testCompile "info.cukes:cucumber-java:1.0.11"
    testCompile "info.cukes:cucumber-junit:1.0.11"
    testCompile "net.sourceforge.htmlunit:htmlunit:2.12"
	testCompile "org.springframework:spring-test:3.1.1.RELEASE"
	testCompile('org.springframework:spring-test-mvc:1.0.0.BUILD-SNAPSHOT') {
		exclude module: 'org.hamcrest:hamcrest-core'
	}
    if (System.properties['isWeblogic']) {
        providedRuntime "xerces:xerces:2.4.0"
        providedRuntime "xerces:xercesImpl:2.9.1"
        providedRuntime "stax:stax-api:1.0.1"
        providedRuntime "javax.xml.stream:stax-api:1.0-2"
        providedRuntime "javax.xml.bind:jaxb-api:2.2.2"
    } else {
        runtime "xerces:xerces:2.4.0"
        runtime "xerces:xercesImpl:2.9.1"
    }


}

ant.properties['deployment.war.name']='SchedulingManagerService'
ant.properties['deployment.war.file.path']=war.archivePath
ant.properties['app.url']='http://localhost:8080/SchedulingManagerService/'
//There is no static content as app root, so just make sure we get a access denied.  This should show the app is up and running
ant.properties['statuscode']='403'
