Skip to content

Commit bd2bf0a

Browse files
authored
Merge pull request #255 from AppDevNext/UseKotlinDSL-Changelog
Changelog by Kotlin DSL
2 parents d046930 + de6ae1b commit bd2bf0a

10 files changed

Lines changed: 68 additions & 524 deletions

File tree

.github/workflows/Android-CI.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
java_version: [ 17 ]
1717
steps:
1818
- uses: actions/checkout@v5
19+
with:
20+
submodules: true
21+
fetch-depth: 0
22+
fetch-tags: true
1923
- name: set up JDK
2024
uses: actions/setup-java@v5
2125
with:

.github/workflows/Android-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ jobs:
1010
name: Publish release
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v5
13+
- uses: actions/checkout@v5
1514
with:
15+
submodules: true
1616
fetch-depth: 0
17+
fetch-tags: true
1718
- name: Find Tag
1819
id: tagger
1920
uses: jimschubert/query-tag-action@v2

.github/workflows/update-gradle-wrapper.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010

1111
steps:
1212
- uses: actions/checkout@v5
13+
with:
14+
submodules: true
15+
fetch-depth: 0
16+
fetch-tags: true
1317
- name: Install JDK
1418
uses: actions/setup-java@v5
1519
with:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#Android generated
22
bin
33
gen
4+
build
45

56
#Eclipse
67
.project
78
.classpath
89
.settings
10+
.kotlin
911

1012
#IntelliJ IDEA
1113
.idea/*
@@ -30,4 +32,5 @@ proguard.cfg
3032

3133
#Gradle
3234
.gradle
33-
build
35+
36+
gitlog.json

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "buildSrc"]
2+
path = buildSrc
3+
url = [email protected]:hannesa2/KotlinBuildSource.git

ChangeLogLib/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ afterEvaluate {
5151
}
5252
}
5353
}
54-
}
54+
}

README.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,57 @@ Without take care to VersionCode is necessary when you auto generate the Version
3232
language-specific versions of `res/xml/`, e.g. `res/xml-de/changelog.xml`.
3333

3434
## Usage git changelog
35-
To generate a git changelog, grouped by tag you can run
35+
To generate a git changelog, grouped by tag you can run `getTagGroupedGitlog` e.g
36+
37+
```kts
38+
afterEvaluate {
39+
tasks.named("generateReleaseResources") {
40+
doLast {
41+
getTagGroupedGitlog(
42+
verbose = true,
43+
filter = "RELEASE", // optional, only include tags with "RELEASE" in their name
44+
filename = "app/src/main/res/raw/gitlog.json"
45+
)
46+
}
47+
}
48+
}
49+
```
3650

37-
`./generateTagGroupedGitlog.sh > app/src/main/res/raw/gitlog.json`
51+
or by shell script
52+
53+
```#!/bin/bash
54+
./generateTagGroupedGitlog.sh > app/src/main/res/raw/gitlog.json
55+
```
3856

3957
This will show it similar to the XML
4058

4159
## Common usage
4260

4361
1. Display the change log dialog by putting the following code in your activity's `onCreate()` method:
4462

45-
```java
46-
ChangeLog changelog = new ChangeLog(this);
63+
```kt
64+
val changelog = ChangeLog(this)
4765
if (changelog.isFirstRun()) {
48-
changelog.getLogDialog().show();
66+
changelog.getLogDialog().show()
4967
}
5068
```
5169

5270
## Include the library
5371

5472
The easiest way to add ChangeLog to your project is via Gradle. Just add the following lines to your `build.gradle`:
5573

56-
```groovy
74+
```kts
5775
dependencies {
58-
implementation 'com.github.AppDevNext:ChangeLog:$latestVersion'
76+
implementation("com.github.AppDevNext:ChangeLog:$latestVersion")
5977
}
6078
```
6179

6280
To tell Gradle where to find the library, make sure `build.gradle` also contains this:
6381

64-
```groovy
82+
```kts
6583
allprojects {
6684
repositories {
67-
...
68-
maven { url 'https://jitpack.io' }
85+
maven { url = uri("https://jitpack.io") }
6986
}
7087
}
7188
```
@@ -83,7 +100,7 @@ In order to change the labels of the dialog add the following items to your `str
83100

84101
## License
85102

86-
Copyright (C) 2012-2023 AppDevNext and contributors
103+
Copyright (C) 2012-2025 AppDevNext and contributors
87104

88105
Licensed under the Apache License, Version 2.0 (the "License");
89106
you may not use this file except in compliance with the License.

app/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import info.git.versionHelper.getTagGroupedGitlog
2+
13
plugins {
24
id("com.android.application")
35
id("kotlin-android")
@@ -36,3 +38,21 @@ dependencies {
3638
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.2.20")
3739
}
3840

41+
afterEvaluate {
42+
tasks.named("generateReleaseResources") {
43+
doLast {
44+
getTagGroupedGitlog(
45+
filename = "app/src/main/res/raw/gitlog.json"
46+
)
47+
}
48+
}
49+
50+
tasks.named("generateDebugResources") {
51+
doLast {
52+
getTagGroupedGitlog(
53+
verbose = true,
54+
filename = project.projectDir.absolutePath + "/src/main/res/raw/gitlog.json"
55+
)
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)