-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
47 lines (43 loc) · 1.4 KB
/
build.gradle
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
buildscript {
ext {
kotlin_version = '1.7.21'
}
}
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
id 'io.gitlab.arturbosch.detekt' version '1.19.0' apply false
id 'com.google.firebase.appdistribution' version '3.0.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
static void generateReleaseNotes(String dir) {
// discover all tags by date
def tags = "git tag --list --sort=-committerdate".execute().text.trim().tokenize('\n')
// collect commit messages between last two tags
def messages = ""
if (tags.size() > 1) {
messages = ("git log --no-merges --pretty=%s " + tags.get(0) + "..." + tags.get(1))
.execute().text.trim().tokenize('\n')
}
// format release notes and write to file
def releaseNotesDir = new File(dir)
releaseNotesDir.mkdirs()
def releaseNotesFile = new File(releaseNotesDir, 'release_notes.txt')
releaseNotesFile.newWriter().withWriter { writer ->
int i = 0
messages.collect {
if(it != null) {
def line = ++i + "\\ " + it + "\n"
writer << line
}
}
}
// print release notes file content
new Scanner(releaseNotesFile).with {
while (hasNextLine()) {
println(nextLine())
}
}
}