Skip to content

Commit e1b1027

Browse files
authored
Determine versionName and versionCode dynamically (#59)
1 parent dd3bde2 commit e1b1027

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

backtrace-library/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
plugins {
2+
id 'com.gladed.androidgitversion' version '0.4.14'
3+
}
14
apply plugin: 'com.android.library'
25

36
android {
@@ -7,8 +10,8 @@ android {
710
defaultConfig {
811
minSdkVersion 21
912
targetSdkVersion 30
10-
versionCode 373
11-
versionName "3.7.3"
13+
versionName androidGitVersion.name()
14+
versionCode androidGitVersion.code()
1215
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
1316

1417
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

backtrace-library/publish.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
apply plugin: 'maven-publish'
2020
apply plugin: 'signing'
2121

22-
version = VERSION_NAME
22+
version = android.defaultConfig.buildConfigFields["VERSION_NAME"].value
2323
group = GROUP
2424

2525
def isReleaseBuild() {
26-
return VERSION_NAME.contains("SNAPSHOT") == false
26+
return version.contains("SNAPSHOT") == false
2727
}
2828

2929
def getReleaseRepositoryUrl() {
@@ -86,7 +86,7 @@ afterEvaluate { project ->
8686
release(MavenPublication) {
8787
groupId GROUP
8888
artifactId POM_ARTIFACT_ID
89-
version VERSION_NAME
89+
version version
9090
from components.release
9191
}
9292
}
@@ -157,7 +157,7 @@ afterEvaluate { project ->
157157

158158
publishing.publications.all { publication ->
159159
publication.groupId = GROUP
160-
publication.version = VERSION_NAME
160+
publication.version = version
161161

162162
publication.artifact androidSourcesJar
163163
publication.artifact androidJavadocsJar
@@ -176,4 +176,4 @@ afterEvaluate { project ->
176176
sign publication
177177
}
178178
}
179-
}
179+
}

gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ org.gradle.jvmargs=-Xmx1024m
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
1414

15-
VERSION_NAME=3.7.2
16-
VERSION_CODE=372
1715
GROUP=com.github.backtrace-labs.backtrace-android
1816

1917
POM_DESCRIPTION=Backtrace's integration with Android applications written in Java allows customers to capture and report handled and unhandled java exceptions.

0 commit comments

Comments
 (0)