summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-29 11:49:24 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-29 15:01:34 +0900
commit45cd0465a49590f8b459e5d2cc340d42467cfecf (patch)
tree47611b004162d1102035cd009abdc5d557273922
parenta73e51136f019f24c331529f87edf9c57b04b7dc (diff)
downloadefl-45cd0465a49590f8b459e5d2cc340d42467cfecf.tar.gz
efl: Add Efl.Version struct and APIs
The original idea behind knowing the app's version of EFL is not a great story. It comes from the fact that some bugs exist in earlier versions of EFL, and some things need to be fixed. But those fixes may break behaviour for older apps. This patch is opening the way to the slippery slope of bug compatibility. Unfortunately this is a requirement if we want to be able to move forward and not break apps when we fix bugs (behaviour or ABI). I hope we will not need to implement too many (if any) workaround such issues. For now, this will only be used as debugging info. EFL_MAIN() and ELM_MAIN() will both set the app's EFL version automatically at startup time. Some internal helpers can be added later to check how the app build-time and run-time version of EFL differ. @feature
-rw-r--r--src/lib/ecore/Ecore_Common.h7
-rw-r--r--src/lib/ecore/ecore_main.c40
-rw-r--r--src/lib/ecore/ecore_private.h1
-rw-r--r--src/lib/ecore/efl_loop.eo22
-rw-r--r--src/lib/efl/interfaces/efl_types.eot20
5 files changed, 90 insertions, 0 deletions
diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h
index c2ed8a3caf..c4d68dc1f1 100644
--- a/src/lib/ecore/Ecore_Common.h
+++ b/src/lib/ecore/Ecore_Common.h
@@ -51,6 +51,13 @@ EAPI int ecore_init(void);
EAPI int ecore_shutdown(void);
/**
+ * @brief Inform EFL of the version this application was built for.
+ *
+ * This is transparently called from $EFL_MAIN().
+ */
+EWAPI void efl_build_version_set(int vmaj, int vmin, int vmic, int revision, const char *flavor, const char *build_id);
+
+/**
* @}
*/
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index e09c77d62b..438b5c7f15 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -3033,4 +3033,44 @@ _efl_loop_unregister(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd, const Eo_Class *kla
return eina_hash_del(pd->providers, &klass, provider);
}
+Efl_Version _app_efl_version = { 0, 0, 0, 0, NULL, NULL };
+
+EWAPI void
+efl_build_version_set(int vmaj, int vmin, int vmic, int revision,
+ const char *flavor, const char *build_id)
+{
+ // note: EFL has not been initialized yet at this point (ie. no eina call)
+ _app_efl_version.major = vmaj;
+ _app_efl_version.minor = vmin;
+ _app_efl_version.micro = vmic;
+ _app_efl_version.revision = revision;
+ free((char *) _app_efl_version.flavor);
+ free((char *) _app_efl_version.build_id);
+ _app_efl_version.flavor = flavor ? strdup(flavor) : NULL;
+ _app_efl_version.build_id = build_id ? strdup(build_id) : NULL;
+}
+
+EOLIAN static const Efl_Version *
+_efl_loop_app_efl_version_get(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED)
+{
+ return &_app_efl_version;
+}
+
+EOLIAN static const Efl_Version *
+_efl_loop_efl_version_get(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED)
+{
+ /* vanilla EFL: flavor = NULL */
+ static const Efl_Version version = {
+ .major = VMAJ,
+ .minor = VMIN,
+ .micro = VMIC,
+ .revision = VREV,
+ .build_id = EFL_BUILD_ID,
+ .flavor = NULL
+ };
+
+ return &version;
+}
+
+
#include "efl_loop.eo.c"
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index 781846c8ed..40fa0807e2 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -365,6 +365,7 @@ GENERIC_ALLOC_FREE_HEADER(Ecore_Win32_Handler, ecore_win32_handler);
extern Eo *_mainloop_singleton;
extern Eo *_ecore_parent;
+extern Efl_Version _app_efl_version;
#define ECORE_PARENT_CLASS ecore_parent_class_get()
EAPI const Eo_Class *ecore_parent_class_get(void) EINA_CONST;
diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo
index bd878a2e68..74544cd70f 100644
--- a/src/lib/ecore/efl_loop.eo
+++ b/src/lib/ecore/efl_loop.eo
@@ -1,3 +1,5 @@
+import efl_types;
+
struct Efl.Loop.Arguments {
argv: const(array<const(stringshare)>);
}
@@ -22,6 +24,26 @@ class Efl.Loop (Eo.Base)
main_loop: Efl.Loop;
}
}
+ @property app_efl_version {
+ [[Indicates the version of EFL with which this application was compiled.
+
+ This might differ from @.efl_version.
+ ]]
+ get {}
+ values {
+ version: const(Efl.Version)*;
+ }
+ }
+ @property efl_version {
+ [[Indicates the currently running version of EFL.
+
+ This might differ from @.app_efl_version.
+ ]]
+ get {}
+ values {
+ version: const(Efl.Version)*;
+ }
+ }
iterate {
[[Runs a single iteration of the main loop to process everything on the
queue.]]
diff --git a/src/lib/efl/interfaces/efl_types.eot b/src/lib/efl/interfaces/efl_types.eot
index dd6d08c04b..0625dc3c65 100644
--- a/src/lib/efl/interfaces/efl_types.eot
+++ b/src/lib/efl/interfaces/efl_types.eot
@@ -18,3 +18,23 @@ struct @extern Efl.Time
tm_yday: int; [[Days in year.[0-365] ]]
tm_isdst: int; [[DST. [-1/0/1] ]]
}
+
+struct Efl.Version
+{
+ [[This type describes the version of EFL with an optional variant.
+
+ This may be used to query the current running version of EFL. Or it can
+ be passed by applications at startup time to inform EFL of the version
+ a certain application was built for.
+
+ @since 1.18
+ ]]
+
+ major: int; [[Major component of the version (>= 1).]]
+ minor: int; [[Minor component of the version (>= 0).]]
+ micro: int; [[Micro component of the version (>= 0).]]
+ revision: int; [[Revision component of the version (>= 0).]]
+ flavor: string; [[Special version string for this build of EFL, $null for
+ vanilla (upstream) EFL. Contains $EFL_VERSION_FLAVOR.]]
+ build_id: string; [[Contains $EFL_BUILD_ID.]]
+}