mirror of
https://github.com/google/nomulus.git
synced 2025-07-30 22:46:26 +02:00
Refactor Gradle project setup
Make root build.gradle easier to read: - Moved appengine war-assembly into separate script - Moved java static analysis configs to separate script, for easier sharing with buildSrc folder. Update Gradle config in the buildSrc folder: - Applied static analysis, and cleaned up a few style and dependency lint errors. - Added dependency locks - Set up Google java format enforcement (Spotless) since this is new code. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=246858172
This commit is contained in:
parent
d4698ae386
commit
d1b7824cc2
18 changed files with 732 additions and 140 deletions
42
gradle/java_common.gradle
Normal file
42
gradle/java_common.gradle
Normal file
|
@ -0,0 +1,42 @@
|
|||
apply plugin: 'java'
|
||||
apply plugin: 'nebula.lint'
|
||||
apply plugin: 'net.ltgt.apt'
|
||||
apply plugin: 'net.ltgt.errorprone'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
// Checkstyle should run as part of the testing task
|
||||
tasks.test.dependsOn tasks.checkstyleMain
|
||||
tasks.test.dependsOn tasks.checkstyleTest
|
||||
|
||||
dependencies {
|
||||
// compatibility with Java 8
|
||||
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
|
||||
errorprone("com.google.errorprone:error_prone_core:2.3.3")
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.compilerArgs << "-Werror"
|
||||
options.errorprone.disableWarningsInGeneratedCode = true
|
||||
options.errorprone.errorproneArgumentProviders.add([
|
||||
asArguments: {
|
||||
return ['-XepExcludedPaths:.*/build/generated/.*']
|
||||
}] as CommandLineArgumentProvider)
|
||||
}
|
||||
|
||||
version = '1.0'
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
compileJava { options.encoding = "UTF-8" }
|
||||
compileTestJava { options.encoding = "UTF-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
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue