/*
 * Copyright 2024 Google LLC
 *
 * Licensed 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.
 */

// [START gae_standard21_gradle]
apply plugin: 'java'
apply plugin: 'war'

buildscript {
    repositories {
        // gretty plugin is in Maven Central
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.8.1'
        classpath 'org.gretty:gretty:4.1.5'
    }
}
apply plugin: 'org.gretty'
apply plugin: 'com.google.cloud.tools.appengine'

repositories {
    mavenCentral()
}

appengine {
    deploy {   // deploy configuration
        stopPreviousVersion = true  // default - stop the current version
        promote = true              // default - & make this the current version
        projectId = 'GCLOUD_CONFIG'
        version = 'GCLOUD_CONFIG'
    }
}

sourceSets {
    // In Gradle 8, the default location is app/src/java, which does not match
    // Maven's directory structure.
    main.java.srcDirs = ['src/main/java']
    main.resources.srcDirs = ['src/main/resources', 'src/main/webapp']
    test.java.srcDirs = ['src/test/java']
}

dependencies {
    implementation 'com.google.appengine:appengine-api-1.0-sdk:2.0.30'
    implementation 'jakarta.servlet:jakarta.servlet-api:6.1.0'

    // Test Dependencies
    testImplementation 'com.google.appengine:appengine-testing:2.0.30'
    testImplementation 'com.google.appengine:appengine-api-stubs:2.0.30'
    testImplementation 'com.google.appengine:appengine-tools-sdk:2.0.30'

    testImplementation 'com.google.truth:truth:1.1.5'
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.mockito:mockito-core:4.11.0'
}
// [END gae_standard21_gradle]
