From caa0cd9d61006f91a8e7c36b34fd4737ed301aeb Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Fri, 10 Jul 2020 10:03:59 -0400 Subject: [PATCH] Add a "coreDev" gradle target (#667) * Add a "buildFmt" gradle target This does the same thing as the automatic Java build target, except instead of failing if the code formatting isn't correct, it just automatically reformats as necessary and continues on. * Remove unnecessary mustRunAfters * Make it run tests too, and add :taskTree task * Rename task to coreDev and remove run afters * Add task tree dependency * Actually that may not be necessary --- build.gradle | 18 +++++++++++++++--- .../buildscript-classpath.lockfile | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 5b680dfd6..cc74caccc 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ buildscript { dependencies { classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.0.1' - classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.6.1" + classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.6.1' classpath 'org.sonatype.aether:aether-api:1.13.1' classpath 'org.sonatype.aether:aether-impl:1.13.1' } @@ -49,6 +49,7 @@ plugins { id 'com.diffplug.gradle.spotless' version '3.25.0' id 'jacoco' + id 'com.dorongold.task-tree' version '1.5' } wrapper { @@ -443,6 +444,7 @@ task javaIncrementalFormatDryRun { println("${invokeJavaDiffFormatScript("show")}") } } +tasks.build.dependsOn(tasks.javaIncrementalFormatCheck) // Checks if modified lines in Java source files need reformatting. // Note that this task processes modified Java files in the entire repository. @@ -452,8 +454,6 @@ task javaIncrementalFormatApply { } } -tasks.build.dependsOn(tasks.javaIncrementalFormatCheck) - task javadoc(type: Javadoc) { source javadocSource classpath = files(javadocClasspath) @@ -468,4 +468,16 @@ task javadoc(type: Javadoc) { tasks.build.dependsOn(tasks.javadoc) +// Task for doing development on core Nomulus. +// This fixes code formatting automatically as necessary, builds and tests the +// core Nomulus codebase, and runs all presubmits. +task coreDev { + dependsOn 'javaIncrementalFormatApply' + dependsOn 'javadoc' + dependsOn 'checkDependenciesDotGradle' + dependsOn 'checkLicense' + dependsOn ':core:check' + dependsOn 'assemble' +} + javadocDependentTasks.each { tasks.javadoc.dependsOn(it) } diff --git a/gradle/dependency-locks/buildscript-classpath.lockfile b/gradle/dependency-locks/buildscript-classpath.lockfile index 7b1b77341..6fbfd5405 100644 --- a/gradle/dependency-locks/buildscript-classpath.lockfile +++ b/gradle/dependency-locks/buildscript-classpath.lockfile @@ -8,6 +8,7 @@ com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:3.25.0 com.diffplug.spotless:spotless-lib-extra:1.25.0 com.diffplug.spotless:spotless-lib:1.25.0 com.diffplug.spotless:spotless-plugin-gradle:3.25.0 +com.dorongold.task-tree:com.dorongold.task-tree.gradle.plugin:1.5 com.github.jengelman.gradle.plugins:shadow:5.1.0 com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 com.google.cloud.tools:appengine-gradle-plugin:2.0.1 @@ -29,6 +30,7 @@ com.netflix.nebula:gradle-lint-plugin:16.0.2 com.netflix.nebula:nebula-gradle-interop:1.0.11 commons-io:commons-io:2.6 commons-lang:commons-lang:2.6 +gradle.plugin.com.dorongold.plugins:task-tree:1.5 javax.inject:javax.inject:1 junit:junit:4.12 nebula.lint:nebula.lint.gradle.plugin:16.0.2