forked from PojavLauncherTeam/PojavLauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
33 lines (31 loc) · 1000 Bytes
/
build.gradle
File metadata and controls
33 lines (31 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.IOException
plugins{
id 'com.android.application' version '8.7.2' apply false
id 'com.android.library' version '8.7.2' apply false
}
String getGitHash(String project) {
def command = Runtime.getRuntime().exec("git rev-list -1 HEAD " + project)
def returnCode = command.waitFor()
if (returnCode != 0) {
throw new IOException("Command 'getGitHash()' exited with " + returnCode)
}
String gitCommitHash = command.inputStream.text.trim()
return gitCommitHash
}
Boolean gitUsed() {
def returnCode = Runtime.getRuntime().exec("git rev-parse --is-inside-work-tree").waitFor()
switch(returnCode){
case 127:
println("git not found");
return false;
break;
case 128:
println("not inside a git repository");
return false;
break;
case 0:
return true;
default:
throw new IOException("Command 'gitUsed()' exited with " + returnCode)
}
}