aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick LE COLLEN <yannick@matrix.org>2017-03-02 13:01:32 +0100
committerRichard van der Hoff <github@rvanderhoff.org.uk>2017-03-02 12:01:32 +0000
commita9aeb6b5d743cc203f8e76c1a180d0cd8d433ed8 (patch)
treee877b6aa847280c35dc09d1ac44eab7f0c3eaf24
parent77eaaa3d5f60b83a618ee2034e2934bd6889339d (diff)
Android : improve the version number management (#46)
Add functions to make the difference between the native and the java code version. Factor out the version management in the makefiles.
-rw-r--r--Makefile4
-rw-r--r--README.rst2
-rw-r--r--android/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java2
-rw-r--r--android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java17
-rw-r--r--android/olm-sdk/src/main/jni/Android.mk8
-rw-r--r--common.mk4
6 files changed, 24 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 77bf0ec..f53be1f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,6 @@
#!/usr/bin/make -f
-MAJOR := 2
-MINOR := 2
-PATCH := 2
+include common.mk
VERSION := $(MAJOR).$(MINOR).$(PATCH)
PREFIX ?= /usr/local
BUILD_DIR := build
diff --git a/README.rst b/README.rst
index 82359c6..21ac11d 100644
--- a/README.rst
+++ b/README.rst
@@ -49,7 +49,7 @@ To build the Xcode workspace for Objective-C bindings, run:
Release process
---------------
-First: bump version numbers in ``Makefile``, ``javascript/package.json``,
+First: bump version numbers in ``common.mk``, ``javascript/package.json``,
``OLMKit.podspec``, and ``android/olm-sdk/build.gradle`` (``versionCode``,
``versionName`` and ``version``).
diff --git a/android/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java b/android/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
index ffbbca1..44405e3 100644
--- a/android/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
+++ b/android/olm-sdk/src/androidTest/java/org/matrix/olm/OlmAccountTest.java
@@ -65,7 +65,7 @@ public class OlmAccountTest {
String olmLibVersion = mOlmManager.getOlmLibVersion();
assertNotNull(olmLibVersion);
- String olmSdkVersion = mOlmManager.getSdkOlmVersion(getInstrumentation().getContext());
+ String olmSdkVersion = mOlmManager.getDetailedVersion(getInstrumentation().getContext());
assertNotNull(olmLibVersion);
Log.d(LOG_TAG, "## setUpClass(): Versions - Android Olm SDK = "+olmSdkVersion+" Olm lib ="+olmLibVersion);
}
diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java
index c1e6031..cd33a5a 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java
@@ -43,17 +43,26 @@ public class OlmManager {
/**
* Provide the android library version
- * @param context the context
* @return the library version
*/
- public String getSdkOlmVersion(Context context) {
+ public String getVersion() {
+ return BuildConfig.VERSION_NAME;
+ }
+
+ /**
+ * Provide a detailed version.
+ * It contains the android and the native libraries versions.
+ * @param context the context
+ * @return the detailed version
+ */
+ public String getDetailedVersion(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;
+ return getVersion() + " - olm version (" + getOlmLibVersion() + ") - " + gitVersion + "-" + date;
}
/**
- * Get the OLM lib version.
+ * Provide the native OLM lib version.
* @return the lib version as a string
*/
public String getOlmLibVersion(){
diff --git a/android/olm-sdk/src/main/jni/Android.mk b/android/olm-sdk/src/main/jni/Android.mk
index 97d747c..c51553c 100644
--- a/android/olm-sdk/src/main/jni/Android.mk
+++ b/android/olm-sdk/src/main/jni/Android.mk
@@ -1,11 +1,11 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := olm
-MAJOR := 2
-MINOR := 0
-PATCH := 0
+include ../../../../common.mk
OLM_VERSION := $(MAJOR).$(MINOR).$(PATCH)
+
+LOCAL_MODULE := olm
+
SRC_ROOT_DIR := ../../../../..
$(info LOCAL_PATH=$(LOCAL_PATH))
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..4f079d2
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,4 @@
+
+MAJOR := 2
+MINOR := 2
+PATCH := 2