Split check in gradle to better warn about GIT / admin right issues
This commit is contained in:
parent
a640095b86
commit
780fd1aeaa
|
@ -82,6 +82,23 @@ def isMaster = { ->
|
|||
return !version.contains('-')
|
||||
}
|
||||
|
||||
def gitAvailable = { ->
|
||||
StringBuilder stringBuilder = new StringBuilder()
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', '--version'
|
||||
standardOutput = stdout
|
||||
}
|
||||
String commitObject = stdout.toString().trim()
|
||||
stringBuilder.append(commitObject)
|
||||
} catch (ignored) {
|
||||
return false // NoGitSystemAvailable
|
||||
}
|
||||
return !stringBuilder.toString().isEmpty()
|
||||
|
||||
}
|
||||
|
||||
def allCommited = { ->
|
||||
StringBuilder stringBuilder = new StringBuilder()
|
||||
try {
|
||||
|
@ -393,9 +410,13 @@ preBuild.dependsOn copyLibs
|
|||
|
||||
printf('--------------\n')
|
||||
printf('isMaster: %s\n', isMaster().toString())
|
||||
printf('gitAvailable: %s\n', gitAvailable().toString())
|
||||
printf('allCommited: %s\n', allCommited().toString())
|
||||
printf('--------------\n')
|
||||
if (isMaster() && !gitAvailable()) {
|
||||
throw new GradleException('GIT system is not available. On Windows try to run Android Studio as an Administrator. Check if GIT is installed and Studio have permissions to use it')
|
||||
}
|
||||
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')
|
||||
throw new GradleException('There are uncommitted changes. Clone sources again as described in wiki and do not allow gradle update')
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue