Commit 288a6c07 authored by Jaewook Jung's avatar Jaewook Jung Committed by Dan Mihai

Integrated the version info of IoTivity

The version of IoTivity is hard-coded in several files
and it is hard to manage.
So I integrated some of them except spec files for tizen.

The version info will be handled in octypes.h and
/build_common/SConscript.

And made applications can get the version info.
 - C/C++ : 'IOTIVITY_VERSION' in octype.h
 - Java  : 'OCPlatform.getIoTivityVersion()'

Change-Id: Ief7a7ba104faaa9397c314e4efa9426c81a7c0ed
Signed-off-by: default avatarJaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16527Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarjihwan seo <jihwan.seo@samsung.com>
Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
parent b9f73b08
......@@ -87,6 +87,9 @@ if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support
targets_disallow_multitransport = ['arduino']
help_vars = Variables()
help_vars.Add('PROJECT_VERSION', 'The version of IoTivity', project_version)
help_vars.Add(BoolVariable('VERBOSE', 'Show compilation', False))
help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
......
......@@ -2,6 +2,8 @@ import os
import platform
Import('env')
PROJECT_VERSION = env.get('PROJECT_VERSION')
TARGET_ARCH = env.get('TARGET_ARCH')
if env.get('RELEASE'):
RELEASE="release"
......@@ -94,14 +96,14 @@ def ensure_libs(target, source, env):
SConscript('jni/SConscript')
jdk_env = Environment(ENV=os.environ)
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
cmdBuildApi=jdk_env.Gradle(target="base/objs", source="common/src/main/java/org/iotivity/base/OcResource.java")
examples_target = "java"
if target_os == 'android':
examples_target = "android"
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
#cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, ))
cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
......
......@@ -73,7 +73,7 @@ android {
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.3.0"
versionName PROJECT_VERSION
buildConfigField 'int', 'SECURED', SECURED
buildConfigField 'int', 'WITH_TCP', WITH_TCP
buildConfigField 'int', 'WITH_CLOUD', WITH_CLOUD
......
......@@ -1234,4 +1234,9 @@ public final class OcPlatform {
* Method to set DeviceId.
*/
public static native void setDeviceId(byte[] deviceId) throws OcException;
/**
* Method to get the version of IoTivity.
*/
public static native String getIoTivityVersion();
}
......@@ -1225,4 +1225,9 @@ public final class OcPlatform {
* Method to set DeviceId.
*/
public static native void setDeviceId(byte[] deviceId) throws OcException;
/**
* Method to get the version of IoTivity.
*/
public static native String getIoTivityVersion();
}
......@@ -2762,3 +2762,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_setDeviceId(
ThrowOcException(e.code(), e.reason().c_str());
}
}
/*
* Class: org_iotivity_base_OcPlatform
* Method: getIoTivityVersion
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcPlatform_getIoTivityVersion(
JNIEnv *env, jclass thiz)
{
LOGI("OcPlatform_getIoTivityVersion");
return env->NewStringUTF(IOTIVITY_VERSION);
}
......@@ -402,8 +402,16 @@ extern "C" {
* Method: setDeviceId
* Signature: (Ljava/lang/byte;)V
*/
JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_setDeviceId(
JNIEnv *, jobject, jbyteArray);
JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_setDeviceId
(JNIEnv *, jobject, jbyteArray);
/*
* Class: org_iotivity_base_OcPlatform
* Method: getIoTivityVersion
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcPlatform_getIoTivityVersion
(JNIEnv *, jclass);
#ifdef __cplusplus
}
......
......@@ -57,7 +57,6 @@ extern void CAsetCredentialTypesCallback(CAgetCredentialTypesHandler credCallbac
CAResult_t CAInitialize(CATransportAdapter_t transportType)
{
OIC_LOG_V(DEBUG, TAG, "IoTivity version is v%s", IOTIVITY_VERSION);
OIC_LOG_V(DEBUG, TAG, "CAInitialize type : %d", transportType);
if (!g_isInitialized)
......
......@@ -48,6 +48,9 @@ extern "C" {
// Defines
//-----------------------------------------------------------------------------
/** Version of IoTivity. */
#define IOTIVITY_VERSION "1.3.0"
/**
* OIC Virtual resources supported by every OIC device.
*/
......
......@@ -21,8 +21,6 @@
#ifndef LOGGER_H_
#define LOGGER_H_
#define IOTIVITY_VERSION "1.3.0"
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
......
......@@ -2483,8 +2483,8 @@ OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag
return OCInit2(mode, serverFlags, clientFlags, OC_DEFAULT_ADAPTER);
}
OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags,
OCTransportFlags clientFlags, OCTransportAdapter transportType)
OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags,
OCTransportAdapter transportType)
{
OIC_LOG(INFO, TAG, "Entering OCInit2");
......@@ -2498,7 +2498,7 @@ OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags,
// This is the first call to initialize the stack so it gets to do the real work.
result = OCInitializeInternal(mode, serverFlags, clientFlags, transportType);
}
if (result == OC_STACK_OK)
{
// Increment the start count since we're about to return success.
......@@ -2512,7 +2512,7 @@ OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags,
}
OCStackResult OCInitializeInternal(OCMode mode, OCTransportFlags serverFlags,
OCTransportFlags clientFlags, OCTransportAdapter transportType)
OCTransportFlags clientFlags, OCTransportAdapter transportType)
{
if (stackState == OC_STACK_INITIALIZED)
{
......@@ -2537,6 +2537,7 @@ OCStackResult OCInitializeInternal(OCMode mode, OCTransportFlags serverFlags,
}
#endif
OIC_LOG_V(INFO, TAG, "IoTivity version is v%s", IOTIVITY_VERSION);
OCStackResult result = OC_STACK_ERROR;
// Validate mode
......
......@@ -211,7 +211,7 @@
} \
}
#define VERSION "1.3.0"
#define VERSION IOTIVITY_VERSION
#define NS_ATTRIBUTE_VERSION "x.org.iotivity.ns.version"
#define NS_ATTRIBUTE_POLICY "x.org.iotivity.ns.subcontrollability"
......
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