Merge pull request #1766 from MilosKozak/gradlegit
Test for uncommited changes in gradle
This commit is contained in:
commit
eaf5781193
1 changed files with 35 additions and 6 deletions
|
@ -70,6 +70,26 @@ def generateDate = { ->
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def isMaster = { ->
|
||||||
|
return !version.contains('-')
|
||||||
|
}
|
||||||
|
|
||||||
|
def allCommited = { ->
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
try {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine 'git', 'status'
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
String commitObject = stdout.toString().trim()
|
||||||
|
stringBuilder.append(commitObject)
|
||||||
|
} catch (ignored) {
|
||||||
|
return false; // NoGitSystemAvailable
|
||||||
|
}
|
||||||
|
return stringBuilder.toString().contains("nothing to commit")
|
||||||
|
}
|
||||||
|
|
||||||
tasks.matching { it instanceof Test }.all {
|
tasks.matching { it instanceof Test }.all {
|
||||||
testLogging.events = ["failed", "skipped", "started"]
|
testLogging.events = ["failed", "skipped", "started"]
|
||||||
testLogging.exceptionFormat = "full"
|
testLogging.exceptionFormat = "full"
|
||||||
|
@ -281,3 +301,12 @@ task full_clean(type: Delete) {
|
||||||
|
|
||||||
clean.dependsOn full_clean
|
clean.dependsOn full_clean
|
||||||
preBuild.dependsOn copyLibs
|
preBuild.dependsOn copyLibs
|
||||||
|
|
||||||
|
printf('--------------\n')
|
||||||
|
printf('isMaster: %s\n', isMaster().toString())
|
||||||
|
printf('allCommited: %s\n', allCommited().toString())
|
||||||
|
printf('--------------\n')
|
||||||
|
if (isMaster() && !allCommited()) {
|
||||||
|
throw new GradleException('There are uncommitted changes or git system is not available. Clone sources again as described in wiki and do not allow gradle update')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue