-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
110 lines (101 loc) · 3.09 KB
/
build.gradle
File metadata and controls
110 lines (101 loc) · 3.09 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import groovy.swing.SwingBuilder
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "org.sonarqube" version "2.8"
}
sonarqube {
properties {
property "sonar.projectKey", "ivchicano_TetrisG8"
property "sonar.organization", "ivchicano"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.login", "e562535d4d07ae2c2a059075fb525a52a3cad3b3"
property "sonar.branch.name", System.getenv('BRANCH')
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
String branch
task gitBranch{
description "This task return the current branch name"
branch = ""
def branch_proc = 'git rev-parse --abbrev-ref HEAD'.execute()
branch_proc.in.eachLine { line -> branch = line }
branch_proc.err.eachLine { line -> println line }
branch_proc.waitFor()
}
task gitPull{
description "git pull on current branch or if we pass -PbranchName='name-of-the-branch' we will do pull of this branch"
dependsOn "gitBranch"
doLast{
exec{
if (project.hasProperty('branchName')){
branch=branchName
}
commandLine "git", "pull", "origin", branch.toString()
}
}
}
task gitAdd {
description "This task add all modified elements"
doLast {
exec{
commandLine "git", "add", "*"
}
}
}
task gitCommit{
description "This task do commit all the modified elements with a message that you enter on the dialog"
doLast {
System.setProperty('java.awt.headless', 'false')
new SwingBuilder().edt {
dialog(modal: true, title: 'Enter commit message', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
vbox {
label(text: "Please enter your commit message:")
def input1 = textField()
button(defaultButton: true, text: 'OK', actionPerformed: {
commitMessage = input1.text;
dispose();
exec{
commandLine "git", "commit", "-m", commitMessage
}
})
}
}
}
}
}
task gitPush {
description "git push on current branch"
dependsOn "gitBranch"
doLast{
exec{
commandLine "git", "push", "origin", branch.toString()
}
}
}
task gitCompletePush {
description "This task do all the processes to do push (add, commit and push)"
dependsOn "gitAdd"
dependsOn "gitCommit"
dependsOn "gitPush"
tasks.findByName("gitCommit").mustRunAfter "gitAdd"
tasks.findByName("gitPush").mustRunAfter "gitCommit"
}