diff --git a/build.gradle b/build.gradle index 21db6f43..9c3135d4 100644 --- a/build.gradle +++ b/build.gradle @@ -17,13 +17,19 @@ plugins { id 'idea' id 'org.sonarqube' version '2.7.1' id 'org.asciidoctor.convert' version '1.6.1' - id 'org.ajoberstar.grgit' version '3.1.1' + id 'org.ajoberstar.grgit' version '3.1.1' apply false id 'io.spring.nohttp' version '0.0.3.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' apply false } apply plugin: 'io.spring.nohttp' +def gitPresent = new File('.git').exists() + +if(gitPresent) { + apply plugin: 'org.ajoberstar.grgit' +} + description = 'Spring Kafka' ext { @@ -35,8 +41,11 @@ ext { linkScmDevConnection = 'git@github.com:spring-projects/spring-kafka.git' docResourcesVersion = '0.1.0.RELEASE' - modifiedFiles = + + if (gitPresent) { + modifiedFiles = files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } + } assertjVersion = '3.15.0' googleJsr305Version = '3.0.2' @@ -170,8 +179,10 @@ subprojects { subproject -> task updateCopyrights { - onlyIf { !System.getenv('TRAVIS') && !System.getenv('bamboo_buildKey') } - inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) }) + onlyIf { gitPresent && !System.getenv('TRAVIS') && !System.getenv('bamboo_buildKey') } + if (gitPresent) { + inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) }) + } outputs.dir('build') doLast {