// Copyright 2017 Google Inc.
//
// 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 buildscript]
buildscript {    // Configuration for building
  repositories {
    mavenCentral()
    jcenter()    // Bintray's repository - a fast Maven Central mirror & more
  }
  dependencies {
    // App Engine Gradle plugin
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.5.0'

    // Endpoints Frameworks Gradle plugin
    classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:2.1.0'
  }
}
// [END buildscript]

repositories {   // repositories for Jar's you access in your code
  mavenCentral()
  jcenter()
}

apply plugin: 'java'                              // standard Java tasks
apply plugin: 'war'                               // standard Web Archive plugin

// [START apply_plugins]
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
// [END apply_plugins]

dependencies {
  providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
  compile 'jstl:jstl:1.2'
  compile group: 'javax.inject', name: 'javax.inject', version: '1'

  // [START endpoints-tools]
  compile group: 'com.google.endpoints', name: 'endpoints-framework-tools', version: '2.2.2'
  // [END endpoints-tools]
}

appengine {  // App Engine tasks configuration
  deploy {   // deploy configuration
    version = findProperty("appengine.deploy.version")

    def promoteProp = findProperty("appengine.deploy.promote")
    if (promoteProp != null) {
      promote = new Boolean(promoteProp)
    }
  }
}

// [START endpoints-server]
endpointsServer {
  // Endpoints Framework Plugin server-side configuration
  hostname = 'YOUR-PROJECT-ID.appspot.com'
}
// [END endpoints-server]

group   = 'com.example.helloendpoints' // Generated output GroupId
version = '1'                          // Version in generated output

sourceCompatibility = 1.8     // App Engine Standard uses Java 8
targetCompatibility = 1.8     // App Engine Standard uses Java 8
