google-nomulus/gradle/build.gradle
mmuller ec11eae699 Add App Engine Deploy to Gradle build
Add a first pass add Nomulus GAE deployment to our gradle build scripts.  This
attempt could stand some improvement.  In particular:

- It currently only deploys to crash, per discussion we will make the
  environment a parameter.
- This uses a different import mechanism from the other plugins (via a
  "buildscript" section) and it looks like the lint plugin is very similar.
  I'll experiment with getting it to work that way.
- There is a lot of redundancy in the deployment scripts for each module, and
  given that we have the full power of a general programming language it
  should be possible for us to reuse the common parts.

But that said, this is a pretty good first step and I wanted to put it out
there.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223366370
2018-12-03 19:18:44 -05:00

115 lines
2.8 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"
subprojects {
repositories {
jcenter()
mavenCentral()
}
// Exclude all of the module deployment projects.
if (project.name in ['default', 'backend', 'tools', 'pubapi']) 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}/"
}
}
}