Files
nomulus/gradle/build.gradle
T
jianglai 9735978b87 Consolidate app engine deployment gradle tasks
Removed duplicate build files for each service, and also added two tasks that runs deployment/staging for all services.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224359198
2018-12-06 13:34:16 -05:00

165 lines
4.0 KiB
Groovy

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
plugins {
id 'nebula.lint' version '10.3.1'
// Config helper for annotation processors such as AutoValue and Dagger.
// Ensures that source code is generated at an appropriate location.
id 'net.ltgt.apt' version '0.19' apply false
id 'com.bmuschko.docker-java-application' version '4.0.4' apply false
}
// Only do linting if the build is successful.
gradleLint.autoLintAfterFailure = false
// Paths to main and test sources.
ext.javaDir = "${rootDir}/../java"
ext.javatestsDir = "${rootDir}/../javatests"
// Tasks to deploy/stage all App Engine services
task deploy {
group = 'deployment'
description = 'Deploys all services to App Engine.'
}
task stage {
group = 'deployment'
description = 'Generates application directories for all services.'
}
subprojects {
// Skip no-op project
if (project.name == 'services') return
repositories {
jcenter()
mavenCentral()
}
// Set up all of the deployment projects.
if (project.name in ['default', 'backend', 'tools', 'pubapi']) {
apply plugin: 'war'
// Set this directory before applying the appengine plugin so that the
// plugin will recognize this as an app-engine standard app (and also
// obtains the appengine-web.xml from the correct location)
project.convention.plugins['war'].webAppDirName =
"../../../java/google/registry/env/crash/${project.name}"
apply plugin: 'com.google.cloud.tools.appengine'
// Get the web.xml file for the service.
war {
webInf {
from "../../../java/google/registry/env/common/${project.name}/WEB-INF"
}
}
appengine {
deploy {
// TODO: change this to a variable.
project = 'domain-registry-crash'
}
}
dependencies {
compile project(':core')
}
rootProject.deploy.dependsOn appengineDeploy
rootProject.stage.dependsOn appengineStage
// Return early, do not apply the settings below.
return
}
apply plugin: 'java'
apply plugin: 'nebula.lint'
apply plugin: 'net.ltgt.apt'
version = '1.0'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
gradleLint.rules = [
// Checks if Gradle wrapper is up-to-date
'archaic-wrapper',
// Checks for indirect dependencies with dynamic version spec. Best
// practice calls for declaring them with specific versions.
'undeclared-dependency',
'unused-dependency'
// TODO(weiminyu): enable more dependency checks
]
if (project.name == 'third_party') return
// Path to code generated with annotation processors. Note that this path is
// chosen by the 'net.ltgt.apt' plugin, and may change if IDE-specific plugins
// are applied, e.g., 'idea' or 'eclipse'
def aptGeneratedDir = "${project.buildDir}/generated/source/apt/main"
def aptGeneratedTestDir = "${project.buildDir}/generated/source/apt/test"
def commonlyExcludedResources = ['**/*.java', '**/BUILD']
sourceSets {
main {
java {
srcDirs = [
project(':').javaDir,
aptGeneratedDir
]
}
resources {
srcDirs = [
project(':').javaDir
]
exclude commonlyExcludedResources
}
}
test {
java {
srcDirs = [
project(':').javatestsDir,
aptGeneratedTestDir
]
}
resources {
srcDirs = [
project(':').javatestsDir,
]
exclude commonlyExcludedResources
}
}
}
if (project.name == 'core') return
ext.relativePath = "google/registry/${project.name}"
sourceSets.each {
it.java {
include "${project.relativePath}/"
}
it.resources {
include "${project.relativePath}/"
}
}
project(':core').sourceSets.each {
it.java {
exclude "${project.relativePath}/"
}
it.resources {
exclude "${project.relativePath}/"
}
}
}