diff options
Diffstat (limited to 'org.fox.epube/build.gradle')
| -rw-r--r-- | org.fox.epube/build.gradle | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/org.fox.epube/build.gradle b/org.fox.epube/build.gradle index bd0e328..d21761f 100644 --- a/org.fox.epube/build.gradle +++ b/org.fox.epube/build.gradle @@ -12,7 +12,7 @@ android { //noinspection ExpiredTargetSdkVersion targetSdkVersion 31 compileSdk 35 - versionCode 14 + versionCode getGitVersionCode() versionName getVersion() buildConfigField "String", "EPUBE_BASE_URL", "\"https://epube-dev.fakecake.org\"" } @@ -58,10 +58,18 @@ android { } +def getGitVersionCode() { + return new Date(getGitTimestamp()).format('yyyyMMdd').toInteger() +} + +def getGitTimestampFormatted() { + return new Date(getGitTimestamp()).format('YY.MM') +} + def getGitTimestamp() { // gitlab CI iso-8601 timestamp if (System.getenv("CI_COMMIT_TIMESTAMP")) { - return Date.parse("yyyy-MM-dd'T'HH:mm:ssXXX", System.getenv("CI_COMMIT_TIMESTAMP")).format('YY.MM') + return Date.parse("yyyy-MM-dd'T'HH:mm:ssXXX", System.getenv("CI_COMMIT_TIMESTAMP")).getTime(); } // try to get version from git repo in current dir @@ -72,7 +80,7 @@ def getGitTimestamp() { standardOutput = stdout } - return new Date(stdout.toString().trim().toLong() * 1000).format('YY.MM') + return stdout.toString().trim().toLong() * 1000; } catch (ignored) { return 0; @@ -100,7 +108,7 @@ def getGitCommitHash() { } def getVersion() { - return getGitTimestamp() + '-' + getGitCommitHash(); + return getGitTimestampFormatted() + '-' + getGitCommitHash(); } dependencies { @@ -110,10 +118,6 @@ dependencies { implementation 'androidx.appcompat:appcompat-resources:1.7.0' implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.webkit:webkit:1.13.0' - implementation 'com.evernote:android-state:1.4.1' - compileOnly 'com.evernote:android-state:1.4.1' - annotationProcessor 'com.evernote:android-state:1.4.1' - implementation 'com.github.livefront:bridge:v1.1.1' } java { toolchain { |
