Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matrix-org
Olm
Commits
29339bc0
Commit
29339bc0
authored
Jan 09, 2017
by
ylecollen
Browse files
Update getSdkOlmVersion to provide the git commit
parent
a14bf30c
Changes
3
Show whitespace changes
Inline
Side-by-side
java/android/OlmLibSdk/olm-sdk/build.gradle
View file @
29339bc0
...
...
@@ -15,7 +15,17 @@ android {
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes
{
debug
{
resValue
"string"
,
"git_olm_revision"
,
"\"${gitRevision()}\""
resValue
"string"
,
"git_olm_revision_unix_date"
,
"\"${gitRevisionUnixDate()}\""
resValue
"string"
,
"git_olm_revision_date"
,
"\"${gitRevisionDate()}\""
}
release
{
resValue
"string"
,
"git_olm_revision"
,
"\"${gitRevision()}\""
resValue
"string"
,
"git_olm_revision_unix_date"
,
"\"${gitRevisionUnixDate()}\""
resValue
"string"
,
"git_olm_revision_date"
,
"\"${gitRevisionDate()}\""
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
...
...
@@ -93,6 +103,21 @@ def getNdkBuildCmd() {
return
ndkBuildCmd
}
def
gitRevision
()
{
def
cmd
=
"git rev-parse --short HEAD"
return
cmd
.
execute
().
text
.
trim
()
}
def
gitRevisionUnixDate
()
{
def
cmd
=
"git show -s --format=%ct HEAD^{commit}"
return
cmd
.
execute
().
text
.
trim
()
}
def
gitRevisionDate
()
{
def
cmd
=
"git show -s --format=%ci HEAD^{commit}"
return
cmd
.
execute
().
text
.
trim
()
}
dependencies
{
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
compile
'com.android.support:appcompat-v7:21.+'
...
...
java/android/OlmLibSdk/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
View file @
29339bc0
...
...
@@ -65,7 +65,7 @@ public class OlmAccountTest {
String
olmLibVersion
=
mOlmManager
.
getOlmLibVersion
();
assertNotNull
(
olmLibVersion
);
String
olmSdkVersion
=
mOlmManager
.
getSdkOlmVersion
();
String
olmSdkVersion
=
mOlmManager
.
getSdkOlmVersion
(
getInstrumentation
().
getContext
()
);
assertNotNull
(
olmLibVersion
);
Log
.
d
(
LOG_TAG
,
"## setUpClass(): Versions - Android Olm SDK = "
+
olmSdkVersion
+
" Olm lib ="
+
olmLibVersion
);
}
...
...
java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java
View file @
29339bc0
...
...
@@ -17,6 +17,7 @@
package
org.matrix.olm
;
import
android.content.Context
;
import
android.util.Log
;
/**
...
...
@@ -25,7 +26,6 @@ import android.util.Log;
*/
public
class
OlmManager
{
private
static
final
String
LOG_TAG
=
"OlmManager"
;
private
static
final
String
SDK_OLM_VERSION
=
"V0.1.0_1"
;
/**
* Constructor.
...
...
@@ -41,8 +41,15 @@ public class OlmManager {
}
}
public
String
getSdkOlmVersion
()
{
return
SDK_OLM_VERSION
;
/**
* Provide the android library version
* @param context the context
* @return the library version
*/
public
String
getSdkOlmVersion
(
Context
context
)
{
String
gitVersion
=
context
.
getResources
().
getString
(
R
.
string
.
git_olm_revision
);
String
date
=
context
.
getResources
().
getString
(
R
.
string
.
git_olm_revision_date
);
return
gitVersion
+
"-"
+
date
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment