-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
136 lines (111 loc) · 3.86 KB
/
Copy pathbuild.gradle
File metadata and controls
136 lines (111 loc) · 3.86 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.1.0"
classpath "com.google.gms:google-services:3.0.0"
classpath "org.ajoberstar:grgit:1.5.0"
classpath "com.google.firebase:firebase-plugins:1.1.4"
}
}
plugins {
id "org.sonarqube" version "2.6"
}
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
import org.ajoberstar.grgit.Grgit
ext {
def git = Grgit.open(currentDir: projectDir)
toolVersions = [
versionCode : git.tag.list().size(),
versionName : git.describe(),
minSdkVersion : 19,
targetSdkVersion : 26,
compileSdkVersion: 26,
buildToolsVersion: "27.0.3"
]
versions = [
dexcount : "0.6.4",
googleSupport : "27.0.2",
multidex : "1.0.2",
installreferrer : "1.0",
googleServices : "11.8.0",
zxing : "3.0.1",
autoValue : "1.5.1",
autoValueParcel : "0.2.5",
autoValueFirebase : "1.1.0",
materialAboutLibrary: "2.2.3-support26.1.0",
timber : "4.7.0",
leakcanary : "1.5",
junit : "4.12",
mockito : "2.9.0"
]
git.close()
}
task printVersion() {
doLast {
println("Version Code: $toolVersions.versionCode")
println("Version Name: $toolVersions.versionName")
}
}
task printStatsFromThisVersion() {
doLast {
def statsFromThisVersion = createStatsFromThisVersion()
println("Apk stats: $statsFromThisVersion")
statsFromThisVersion = statsFromThisVersion.replace(",", "\t")
println("Version\t\t\tSize\tMethods\tFields")
println("$statsFromThisVersion")
}
}
task generateStatsFromThisVersion() {
doLast {
def statsFromThisVersion = createStatsFromThisVersion()
def file = new File("$projectDir/../stats/apkStats.csv")
file.createNewFile()
file.text += statsFromThisVersion
}
}
@SuppressWarnings("GrMethodMayBeStatic")
private createStatsFromThisVersion() {
def apkSize = "stat -f%z mobile/build/outputs/apk/release/mobile-release.apk".execute().text.trim()
def methodCount = "sed -n 2p mobile/build/outputs/dexcount/release.csv".execute().text.trim()
return "$toolVersions.versionName ($toolVersions.versionCode),$apkSize,$methodCount\n"
}
task generateLastCommitsText() {
// Also useful in command line:
// git log --pretty=format:"%ar - %B"
doLast {
def maxCommits = 50
def filename = "$projectDir/../fastlane/metadata/android/en-US/changelogs/$versionCode" + ".txt"
def git = Grgit.open(currentDir: projectDir)
def commits = ""
println("Last $maxCommits commits for version $versionCode:")
for (commit in git.log(maxCommits: maxCommits)) {
def line = " • $commit.fullMessage"
print(line)
commits += line
}
new File(filename).text = "$commits"
git.close()
}
}
sonarqube {
properties {
property "sonar.projectName", project.name
property "sonar.projectKey", project.name
property "sonar.projectVersion", rootProject.versionName
property "sonar.sourceEncoding", "UTF-8"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.android.lint.report", "mobile/build/outputs/lint-results-debug.xml"
property "sonar.import_unknown_files", true
property "sonar.exclusions", "**/*.png,**/*.jpg,**/*.pdf,**/*.ttf,**/*.otf,"
}
}