/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

plugins {
  id 'standard-subproject-configuration'
  id 'war'
  id 'geode-publish-war'
  id 'warnings'
}

jar.enabled = false

configurations {
  war {}
}
dependencies {
  api(platform(project(':boms:geode-all-bom')))

  //Note - marking these deps as providedCompile means that we will exclude them and all of their
  //transitive dependencies from geode-web.war. Since geode-web.war is ony run within
  //a container that has geode-core on the classpath, is prevents duplicating jars. geode-core
  //in particular should not be duplicated in the war.
  providedCompile(project(':geode-logging'))
  providedCompile(project(':geode-serialization'))
  providedCompile(project(':geode-gfsh')) {
    exclude module: 'spring-web'
    exclude module: 'spring-core'
  }

  providedCompile(platform(project(':boms:geode-all-bom')))
  providedCompile('javax.servlet:javax.servlet-api')
  providedCompile('org.apache.logging.log4j:log4j-api')

  implementation('org.springframework:spring-webmvc')
  implementation('org.apache.commons:commons-lang3')

  runtimeOnly('org.springframework:spring-aspects') {
    exclude module: 'aspectjweaver'
  }
  runtimeOnly('org.springframework:spring-oxm')
  runtimeOnly('commons-fileupload:commons-fileupload')

  testImplementation(project(':geode-junit'))
  testImplementation('org.springframework:spring-test')

  integrationTestImplementation(project(':geode-dunit'))

  integrationTestRuntimeOnly(files(war.destinationDirectory))

  distributedTestImplementation(project(':geode-common'))
  distributedTestImplementation(project(':geode-dunit'))
  distributedTestImplementation('pl.pragmatists:JUnitParams')

  distributedTestRuntimeOnly(files(war.destinationDirectory))

  upgradeTestImplementation(project(':geode-dunit')) {
  }
}

distributedTest.dependsOn(war)
integrationTest.dependsOn(war)

war {
  enabled = true
  duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

artifacts {
  war tasks.war
}
