Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
6
600SeriesAndroidUploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cgm
uploader
600SeriesAndroidUploader
Commits
798b1895
Commit
798b1895
authored
7 years ago
by
Lennart Goedhart
Browse files
Options
Downloads
Patches
Plain Diff
Set app versionName based on GitHub tags.
parent
9750e319
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/build.gradle
+8
-11
8 additions, 11 deletions
app/build.gradle
with
8 additions
and
11 deletions
app/build.gradle
+
8
−
11
View file @
798b1895
...
@@ -26,7 +26,7 @@ repositories {
...
@@ -26,7 +26,7 @@ repositories {
apply
plugin:
'io.fabric'
apply
plugin:
'io.fabric'
apply
plugin:
'realm-android'
apply
plugin:
'realm-android'
def
g
it
Version
()
{
def
g
enerate
Version
Code
()
{
// current dir is <your proj>/app, so it's likely that all your git repo files are in the dir
// current dir is <your proj>/app, so it's likely that all your git repo files are in the dir
// above.
// above.
ext
.
repo
=
Grgit
.
open
()
ext
.
repo
=
Grgit
.
open
()
...
@@ -34,19 +34,16 @@ def gitVersion() {
...
@@ -34,19 +34,16 @@ def gitVersion() {
// should result in the same value as running
// should result in the same value as running
// git tag -l | wc -l or git tag -l | grep -c ".*" -
// git tag -l | wc -l or git tag -l | grep -c ".*" -
def
numOfTags
=
ext
.
repo
.
tag
.
list
().
size
()
def
numOfTags
=
ext
.
repo
.
tag
.
list
().
size
()
logger
.
warn
(
"Generated Version Code: "
+
numOfTags
)
return
numOfTags
return
numOfTags
}
}
def
g
itCommitId
()
{
def
g
enerateVersionName
()
{
ext
.
repo
=
Grgit
.
open
()
ext
.
repo
=
Grgit
.
open
()
return
ext
.
repo
.
log
().
first
().
id
.
substring
(
0
,
7
)
//+ " " + ext.repo.branch.current.name
def
tag
=
ext
.
repo
.
describe
().
replaceFirst
(
"^v"
,
""
)
}
logger
.
warn
(
"Generated Version Name: "
+
tag
)
return
tag
def
gitBranch
()
{
ext
.
repo
=
Grgit
.
open
()
return
ext
.
repo
.
branch
.
current
.
name
}
}
def
getBugfenderApiKey
()
{
def
getBugfenderApiKey
()
{
...
@@ -74,8 +71,8 @@ android {
...
@@ -74,8 +71,8 @@ android {
applicationId
"info.nightscout.android"
applicationId
"info.nightscout.android"
minSdkVersion
14
minSdkVersion
14
targetSdkVersion
25
targetSdkVersion
25
versionName
project
.
properties
[
'version'
]
+
"/"
+
gitCommitId
()
// + " (" + gitBranch()+")"
versionName
generateVersionName
()
versionCode
g
it
Version
()
versionCode
g
enerate
Version
Code
()
buildConfigField
"String"
,
"BUGFENDER_API_KEY"
,
getBugfenderApiKey
()
buildConfigField
"String"
,
"BUGFENDER_API_KEY"
,
getBugfenderApiKey
()
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment