Commit a9aeb6b5 authored by Yannick LE COLLEN's avatar Yannick LE COLLEN Committed by Richard van der Hoff
Browse files

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.
parent 77eaaa3d
#!/usr/bin/make -f #!/usr/bin/make -f
MAJOR := 2 include common.mk
MINOR := 2
PATCH := 2
VERSION := $(MAJOR).$(MINOR).$(PATCH) VERSION := $(MAJOR).$(MINOR).$(PATCH)
PREFIX ?= /usr/local PREFIX ?= /usr/local
BUILD_DIR := build BUILD_DIR := build
......
...@@ -49,7 +49,7 @@ To build the Xcode workspace for Objective-C bindings, run: ...@@ -49,7 +49,7 @@ To build the Xcode workspace for Objective-C bindings, run:
Release process 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``, ``OLMKit.podspec``, and ``android/olm-sdk/build.gradle`` (``versionCode``,
``versionName`` and ``version``). ``versionName`` and ``version``).
......
...@@ -65,7 +65,7 @@ public class OlmAccountTest { ...@@ -65,7 +65,7 @@ public class OlmAccountTest {
String olmLibVersion = mOlmManager.getOlmLibVersion(); String olmLibVersion = mOlmManager.getOlmLibVersion();
assertNotNull(olmLibVersion); assertNotNull(olmLibVersion);
String olmSdkVersion = mOlmManager.getSdkOlmVersion(getInstrumentation().getContext()); String olmSdkVersion = mOlmManager.getDetailedVersion(getInstrumentation().getContext());
assertNotNull(olmLibVersion); assertNotNull(olmLibVersion);
Log.d(LOG_TAG, "## setUpClass(): Versions - Android Olm SDK = "+olmSdkVersion+" Olm lib ="+olmLibVersion); Log.d(LOG_TAG, "## setUpClass(): Versions - Android Olm SDK = "+olmSdkVersion+" Olm lib ="+olmLibVersion);
} }
......
...@@ -43,17 +43,26 @@ public class OlmManager { ...@@ -43,17 +43,26 @@ public class OlmManager {
/** /**
* Provide the android library version * Provide the android library version
* @param context the context
* @return the library version * @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 gitVersion = context.getResources().getString(R.string.git_olm_revision);
String date = context.getResources().getString(R.string.git_olm_revision_date); 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 * @return the lib version as a string
*/ */
public String getOlmLibVersion(){ public String getOlmLibVersion(){
......
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := olm include ../../../../common.mk
MAJOR := 2
MINOR := 0
PATCH := 0
OLM_VERSION := $(MAJOR).$(MINOR).$(PATCH) OLM_VERSION := $(MAJOR).$(MINOR).$(PATCH)
LOCAL_MODULE := olm
SRC_ROOT_DIR := ../../../../.. SRC_ROOT_DIR := ../../../../..
$(info LOCAL_PATH=$(LOCAL_PATH)) $(info LOCAL_PATH=$(LOCAL_PATH))
......
MAJOR := 2
MINOR := 2
PATCH := 2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment