@@ -28,35 +28,50 @@ This library provides an easy way to update app with provided apk in release.
2828 )
2929 ```
3030
31- 3 . And you need repository info eg in ` build.config `
32-
33- ``` groovy
31+ 3 . And you need repository info eg in ` build.gradle.kts `
32+
33+ In kts you can use submodule buildSrc
34+
35+ ``` kotlin
36+ import info.git.versionHelper.getGitCommitCount
37+ import info.git.versionHelper.getGitOriginRemote
38+
39+ android {
3440 defaultConfig {
35- ...
36- versionCode getGitCommitCount()
37-
38- buildConfigField "String", 'GIT_REPOSITORY', "\"" + getGitRepository() + "\""
39- }
40-
41- static def getGitCommitCount() {
42- def process = "git rev-list HEAD --count".execute()
43- return process.text.toInteger()
41+ versionCode = getGitCommitCount()
42+ buildConfigField(" String" , " GIT_REPOSITORY" , " \" " + getGitOriginRemote() + " \" " )
4443 }
45-
46- static def getGitOriginRemote() {
47- def process = "git remote -v".execute()
48- def values = process.text.toString().trim().split("\\r\\n|\\n|\\r")
49-
50- def found = values.find { it.startsWith("origin") && it.endsWith("(push)") }
51- return found.replace("origin", "").replace("(push)", "").replace(".git", "").trim()
52- }
53-
54- static def getGitRepository() {
55- def token = getGitOriginRemote().split("/")
56- return token[4]
44+ }
45+ ```
46+ eg groovy in ` build.gradle `
47+ ``` groovy
48+ android {
49+ defaultConfig {
50+ ...
51+ versionCode getGitCommitCount()
52+
53+ buildConfigField "String", 'GIT_REPOSITORY', "\"" + getGitRepository() + "\""
5754 }
58- ```
55+ }
56+
57+ static def getGitCommitCount() {
58+ def process = "git rev-list HEAD --count".execute()
59+ return process.text.toInteger()
60+ }
61+
62+ static def getGitOriginRemote() {
63+ def process = "git remote -v".execute()
64+ def values = process.text.toString().trim().split("\\r\\n|\\n|\\r")
65+
66+ def found = values.find { it.startsWith("origin") && it.endsWith("(push)") }
67+ return found.replace("origin", "").replace("(push)", "").replace(".git", "").trim()
68+ }
5969
70+ static def getGitRepository() {
71+ def token = getGitOriginRemote().split("/")
72+ return token[4]
73+ }
74+ ```
6075## Include the library
6176
6277The easiest way to add ` githubAppUpdate ` to your project is via Gradle. Just add the following lines to your ` build.gradle ` :
@@ -83,7 +98,7 @@ You can specify now an optional personal access token for github. Then it works
8398
8499## License
85100
86- Copyright (C) 2025 hannesa2
101+ Copyright (C) 2026 hannesa2
87102
88103 Licensed under the Apache License, Version 2.0 (the "License");
89104 you may not use this file except in compliance with the License.
0 commit comments