[Test] Missing plugins.json in test package 35/93735/11
authorMateusz Bruno-Kaminski <m.bruno2@samsung.com>
Tue, 25 Oct 2016 12:39:03 +0000 (14:39 +0200)
committerHyunjin Park <hj.na.park@samsung.com>
Fri, 28 Oct 2016 08:04:40 +0000 (17:04 +0900)
[Details] Rewritten webapi-plugins-devel-test. The plugins.json
file is being created.

Change-Id: Ibcd5219bf59d8049a0a81c1e5f95f8ea6ba7c310
Signed-off-by: Mateusz Bruno-Kaminski <m.bruno2@samsung.com>
12 files changed:
doc/html/index.html
doc/src/assets/webapi-plugins-devel-test.zip
doc/src/assets/webapi-plugins-devel-test/LICENSE.MIT [new file with mode: 0644]
doc/src/assets/webapi-plugins-devel-test/packaging/webapi-plugins.spec [changed mode: 0755->0644]
doc/src/assets/webapi-plugins-devel-test/src/test/test.gyp
doc/src/assets/webapi-plugins-devel-test/src/test/test_extension.cc
doc/src/assets/webapi-plugins-devel-test/src/tizen-wrt.gyp
doc/src/assets/webapi-plugins-devel-test/src/tool/desc_gentool.cc [new file with mode: 0644]
doc/src/assets/webapi-plugins-devel-test/src/tool/tool.gyp [new file with mode: 0644]
doc/src/assets/webapi-plugins-devel-test/webapi-plugins.manifest [new file with mode: 0644]
doc/src/devel_package.md
doc/src/index.md

index 58ba589..cf82f40 100644 (file)
 <td>0.1.0</td>
 <td>2015-05-15</td>
 <td>Initial Draft</td>
-<td>Wojciech Kosowicz<br><a href="mailto:w.kosowicz@samsung.com">&#x77;&#46;&#107;&#x6f;&#115;&#x6f;&#x77;&#x69;&#x63;&#x7a;&#x40;&#115;&#97;&#109;&#x73;&#117;&#110;&#103;&#x2e;&#x63;&#x6f;&#109;</a></td>
+<td>Wojciech Kosowicz<br><a href="mailto:w.kosowicz@samsung.com">&#x77;&#46;&#x6b;&#111;&#x73;&#x6f;&#119;&#105;&#x63;&#x7a;&#x40;&#115;&#x61;&#109;&#115;&#x75;&#110;&#x67;&#x2e;&#99;&#111;&#109;</a></td>
 </tr>
 <tr>
 <td>0.2.0</td>
 <td>2015-05-22</td>
 <td>Extended version</td>
-<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#x2e;&#107;&#x61;&#x63;&#122;&#109;&#x61;&#x72;&#x65;&#107;&#x33;&#x40;&#x73;&#97;&#109;&#115;&#117;&#x6e;&#103;&#x2e;&#x63;&#x6f;&#x6d;</a></td>
+<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#46;&#107;&#x61;&#x63;&#122;&#x6d;&#97;&#x72;&#x65;&#x6b;&#x33;&#x40;&#115;&#97;&#x6d;&#115;&#x75;&#110;&#x67;&#46;&#x63;&#111;&#x6d;</a></td>
 </tr>
 <tr>
 <td>0.2.1</td>
 <td>2015-06-01</td>
 <td>Proofreading</td>
-<td>Rafal Galka<br><a href="mailto:r.galka@samsung.com">&#x72;&#46;&#103;&#97;&#108;&#x6b;&#97;&#64;&#115;&#x61;&#x6d;&#115;&#x75;&#x6e;&#103;&#x2e;&#x63;&#x6f;&#x6d;</a></td>
+<td>Rafal Galka<br><a href="mailto:r.galka@samsung.com">&#x72;&#46;&#x67;&#x61;&#108;&#107;&#x61;&#x40;&#115;&#x61;&#x6d;&#x73;&#117;&#x6e;&#x67;&#x2e;&#x63;&#111;&#x6d;</a></td>
 </tr>
 <tr>
 <td>0.3.0</td>
 <td>2015-06-08</td>
 <td>Supplemented C++ implementation guide</td>
-<td>Rafal Galka<br><a href="mailto:r.galka@samsung.com">&#x72;&#46;&#x67;&#97;&#108;&#107;&#97;&#x40;&#x73;&#x61;&#109;&#115;&#117;&#110;&#x67;&#x2e;&#99;&#x6f;&#x6d;</a></td>
+<td>Rafal Galka<br><a href="mailto:r.galka@samsung.com">&#114;&#46;&#103;&#97;&#108;&#107;&#97;&#x40;&#x73;&#x61;&#x6d;&#115;&#x75;&#x6e;&#x67;&#x2e;&#99;&#111;&#109;</a></td>
 </tr>
 <tr>
 <td>0.4.0</td>
 <td>2015-06-16</td>
 <td>Guideline</td>
-<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#x2e;&#107;&#x61;&#99;&#x7a;&#x6d;&#x61;&#x72;&#101;&#107;&#51;&#64;&#115;&#x61;&#109;&#x73;&#117;&#110;&#x67;&#46;&#x63;&#111;&#109;</a></td>
+<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#46;&#107;&#97;&#99;&#x7a;&#109;&#x61;&#114;&#x65;&#107;&#51;&#x40;&#x73;&#97;&#x6d;&#115;&#117;&#x6e;&#103;&#x2e;&#99;&#111;&#109;</a></td>
 </tr>
 <tr>
 <td>0.5.0</td>
 <td>2015-06-18</td>
 <td>Devel package</td>
-<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#46;&#x6b;&#97;&#x63;&#122;&#109;&#x61;&#114;&#101;&#107;&#51;&#x40;&#x73;&#x61;&#x6d;&#x73;&#117;&#x6e;&#x67;&#46;&#99;&#111;&#x6d;</a></td>
+<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#x2e;&#107;&#x61;&#99;&#x7a;&#109;&#97;&#x72;&#x65;&#107;&#x33;&#x40;&#x73;&#x61;&#109;&#x73;&#x75;&#x6e;&#103;&#x2e;&#x63;&#111;&#109;</a></td>
 </tr>
 <tr>
 <td>0.5.1</td>
 <td>2015-06-24</td>
 <td>Add info about WAPIOven.py</td>
-<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#x2e;&#x6b;&#97;&#99;&#122;&#109;&#97;&#x72;&#101;&#x6b;&#x33;&#x40;&#x73;&#x61;&#109;&#115;&#x75;&#110;&#x67;&#x2e;&#99;&#x6f;&#109;</a></td>
+<td>Pawel Kaczmarek<br><a href="mailto:p.kaczmarek3@samsung.com">&#112;&#46;&#107;&#x61;&#x63;&#x7a;&#x6d;&#x61;&#114;&#x65;&#107;&#x33;&#x40;&#115;&#x61;&#109;&#x73;&#117;&#x6e;&#x67;&#x2e;&#99;&#x6f;&#x6d;</a></td>
+</tr>
+<tr>
+<td>0.6.0</td>
+<td>2016-10-28</td>
+<td>update devel package for tizen 3.0</td>
+<td>Annie Park<br><a href="mailto:hj.na.park@samsung.com">&#x68;&#x6a;&#46;&#110;&#x61;&#46;&#112;&#97;&#x72;&#x6b;&#x40;&#x73;&#97;&#109;&#x73;&#117;&#110;&#x67;&#46;&#99;&#111;&#x6d;</a></td>
 </tr>
 </tbody>
 </table>
@@ -294,11 +300,9 @@ lacks of keyword <code>FunctionOnly</code>.</p>
 <code>tools/skeleton_generator/</code> directory and run the python command:</p>
 <pre><code class="lang-sh">$ python WAPIOven.py -d &lt;stub code destination directory name&gt; &lt;widl directory/pluginname&gt;.widl
 </code></pre>
-<p>If tizen.widl is needed, add tizen.widl you can use stub generator located in
-<code>tools/skeleton_generator/</code> directory and run the python command:</p>
-<pre><code class="lang-sh">$ python WAPIOven.py -d &lt;stub code destination directory name&gt; &lt;widl directory/pluginname&gt;.widl &lt;widl directory/&gt;tizen.widl
-</code></pre>
-<p>Path to WAPIOven.py:</p>
+<p>If tizen.widl is needed, add tizen.widl</p>
+<pre class="prettyprint linenums"><code>$ python WAPIOven.py -d &lt;stub code destination directory name&gt; &lt;widl directory/pluginname&gt;.widl &lt;widl directory/&gt;tizen.widl
+</code></pre><p>Path to WAPIOven.py:</p>
 <pre><code class="lang-sh">$ tools/skeleton_generator/WAPIOven.py
 </code></pre>
 <p>You need to install jinja2 for WAPIOven.py:</p>
@@ -672,39 +676,55 @@ Requires: dbus-1 dlog glib-2.0
 Libs: -L${libdir} -ltizen_common
 Cflags: -I${includedir}
 </code></pre><h3 id="devel-package/creating-custom-web-device-plugins-module">Creating custom web device plugins module</h3>
-<p>To create custom web device plugins module <code>webapi-plugins.spec</code>, <code>tizen-wrt.gyp</code> and <code>src</code> files are needed.
+<p>To create custom web device plugins module <code>webapi-plugins.spec</code>, <code>tizen-wrt.gyp</code>, <code>webapi-plugins.manifest</code> and <code>src</code> files are needed.
 Skeleton below shows the required structure of test module.</p>
 <pre><code class="lang-sh">├── packaging
 │   └── webapi-plugins.spec
 └── src
 │   ├── test
-│   ├── test_api.js
-│   ├── test_extension.cc
-│   ├── test_extension.h
-│   ├── test.gyp
-│   ├── test_instance.cc
-│   └── test_instance.h
-└── tizen-wrt.gyp
+│   |   ├── test_api.js
+│   |   ├── test_extension.cc
+│   |   ├── test_extension.h
+│   |   ├── test.gyp
+│   |   ├── test_instance.cc
+│   |   └── test_instance.h
+│   ├── tool
+│   |   ├── desc_gentool.cc
+│   |   └── tool.gyp
+|   └── tizen-wrt.gyp
+└── webapi-plugins.manifest
 </code></pre>
 <p>webapi-plugins.spec source:</p>
-<pre class="prettyprint linenums"><code>%define _manifestdir %{TZ_SYS_RW_PACKAGES}
+<pre class="prettyprint linenums"><code>%bcond_with wayland
+
+%define _manifestdir %{TZ_SYS_RW_PACKAGES}
 %define _desktop_icondir %{TZ_SYS_SHARE}/icons/default/small
 
 %define crosswalk_extensions tizen-extensions-crosswalk
 
+%define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions}
+
 Name:       webapi-plugins-test
 Version:    0.1
 Release:    0
 License:    Apache-2.0 and BSD-2.0 and MIT
 Group:      Development/Libraries
-Summary:    Tizen Web APIs implemented
+Summary:    Tizen Test Web APIs
 Source0:    %{name}-%{version}.tar.gz
 
+%ifarch %{arm} aarch64
+# ARM
+%define tizen_is_emulator           0
+%else
+# I586
+%define tizen_is_emulator           1
+%endif
+
 BuildRequires: ninja
 BuildRequires: pkgconfig(webapi-plugins)
 
 %description
-Tizen Test Web APIs.
+Tizen Test Web APIs
 
 %prep
 %setup -q
@@ -712,19 +732,36 @@ Tizen Test Web APIs.
 %build
 
 export GYP_GENERATORS=&#39;ninja&#39;
-GYP_OPTIONS=&quot;--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{tizen_profile_name} -Dprivilege_engine=%{tizen_privilege_engine}&quot;
-GYP_OPTIONS=&quot;$GYP_OPTIONS -Ddisplay_type=x11&quot;
+GYP_OPTIONS=&quot;--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{profile} -Dprivilege_engine=%{tizen_privilege_engine}&quot;
+GYP_OPTIONS=&quot;$GYP_OPTIONS -Ddisplay_type=%{display_type}&quot;
+GYP_OPTIONS=&quot;$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}&quot;
+
+# feature flags
+GYP_OPTIONS=&quot;$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}&quot;
 
 /usr/include/webapi-plugins/tools/gyp/gyp $GYP_OPTIONS src/tizen-wrt.gyp
 
 ninja -C out/Default %{?_smp_mflags}
 
 %install
-mkdir -p %{buildroot}%{_libdir}/%{crosswalk_extensions}
-install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_extensions}
+
+# Extensions.
+mkdir -p %{buildroot}%{crosswalk_extensions_path}
+install -p -m 644 out/Default/libwebapis*.so %{buildroot}%{crosswalk_extensions_path}
+
+# execute desc_gentool
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path} out/Default/desc_gentool \
+  %{crosswalk_extensions_path} \
+  %{buildroot}%{crosswalk_extensions_path} &gt; webapis-plugins.json
+
+# temporary plugins description for lazy loading
+install -p -m 644 webapis-plugins.json %{buildroot}%{crosswalk_extensions_path}/webapis-plugins.json
+
 
 %files
-%{_libdir}/%{crosswalk_extensions}/libtizen*.so
+%{crosswalk_extensions_path}/libwebapis*.so
+%{crosswalk_extensions_path}/webapis-plugins.json
+%manifest webapi-plugins.manifest
 </code></pre><p>tizen-wrt.gyp source:</p>
 <pre class="prettyprint linenums"><code>{
   &#39;includes&#39;:[
@@ -736,6 +773,7 @@ install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_ex
       &#39;target_name&#39;: &#39;extensions&#39;,
       &#39;type&#39;: &#39;none&#39;,
       &#39;dependencies&#39;: [
+        &#39;tool/tool.gyp:*&#39;,
         &#39;test/test.gyp:*&#39;,
       ],
       &#39;conditions&#39;: [],
@@ -749,7 +787,7 @@ install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_ex
   ],
   &#39;targets&#39;: [
     {
-      &#39;target_name&#39;: &#39;tizen_test&#39;,
+      &#39;target_name&#39;: &#39;webapis_test&#39;,
       &#39;type&#39;: &#39;loadable_module&#39;,
       &#39;sources&#39;: [
         &#39;test_api.js&#39;,
@@ -774,8 +812,8 @@ install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_ex
 Custom web device plugins module test is placed in <code>src/</code> directory and contains all required files.
 Please see <a href="#plugin-structure">Plugin structure</a> chapter for more details.</p>
 <p>To install custom web device plugins module <code>webapi-plugins-xxx.rpm</code> and <code>webapi-plugins-devel-xxx.rpm</code> must be installed first.
-After build and installation webapi-plugins-devel-test <code>tizen.test</code> namespace should be available.</p>
-<pre class="prettyprint linenums"><code class="lang-javascript">var test = tizen.test.ping();
+After build and installation webapi-plugins-test <code>webapis.test</code> namespace should be available.</p>
+<pre class="prettyprint linenums"><code class="lang-javascript">var test = webapis.test.ping();
 console.log(test); // Hello!
 </code></pre>
 
index b940fb5..52201f4 100644 (file)
Binary files a/doc/src/assets/webapi-plugins-devel-test.zip and b/doc/src/assets/webapi-plugins-devel-test.zip differ
diff --git a/doc/src/assets/webapi-plugins-devel-test/LICENSE.MIT b/doc/src/assets/webapi-plugins-devel-test/LICENSE.MIT
new file mode 100644 (file)
index 0000000..f1aebff
--- /dev/null
@@ -0,0 +1,8 @@
+MIT License
+Copyright (c) 2015 Samsung Electronics Co, Ltd. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
old mode 100755 (executable)
new mode 100644 (file)
index 8bddfb4..c992a8a
@@ -1,21 +1,33 @@
+%bcond_with wayland
+
 %define _manifestdir %{TZ_SYS_RW_PACKAGES}
 %define _desktop_icondir %{TZ_SYS_SHARE}/icons/default/small
 
 %define crosswalk_extensions tizen-extensions-crosswalk
 
+%define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions}
+
 Name:       webapi-plugins-test
 Version:    0.1
 Release:    0
 License:    Apache-2.0 and BSD-2.0 and MIT
 Group:      Development/Libraries
-Summary:    Tizen Web APIs implemented
+Summary:    Tizen Test Web APIs
 Source0:    %{name}-%{version}.tar.gz
 
+%ifarch %{arm} aarch64
+# ARM
+%define tizen_is_emulator           0
+%else
+# I586
+%define tizen_is_emulator           1
+%endif
+
 BuildRequires: ninja
 BuildRequires: pkgconfig(webapi-plugins)
 
 %description
-Tizen Test Web APIs.
+Tizen Test Web APIs
 
 %prep
 %setup -q
@@ -23,16 +35,33 @@ Tizen Test Web APIs.
 %build
 
 export GYP_GENERATORS='ninja'
-GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{tizen_profile_name} -Dprivilege_engine=%{tizen_privilege_engine}"
-GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=x11"
+GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{profile} -Dprivilege_engine=%{tizen_privilege_engine}"
+GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}"
+GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}"
+
+# feature flags
+GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}"
 
 /usr/include/webapi-plugins/tools/gyp/gyp $GYP_OPTIONS src/tizen-wrt.gyp
 
 ninja -C out/Default %{?_smp_mflags}
 
 %install
-mkdir -p %{buildroot}%{_libdir}/%{crosswalk_extensions}
-install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_extensions}
+
+# Extensions.
+mkdir -p %{buildroot}%{crosswalk_extensions_path}
+install -p -m 644 out/Default/libwebapis*.so %{buildroot}%{crosswalk_extensions_path}
+
+# execute desc_gentool
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path} out/Default/desc_gentool \
+  %{crosswalk_extensions_path} \
+  %{buildroot}%{crosswalk_extensions_path} > webapis-plugins.json
+
+# temporary plugins description for lazy loading
+install -p -m 644 webapis-plugins.json %{buildroot}%{crosswalk_extensions_path}/webapis-plugins.json
+
 
 %files
-%{_libdir}/%{crosswalk_extensions}/libtizen*.so
+%{crosswalk_extensions_path}/libwebapis*.so
+%{crosswalk_extensions_path}/webapis-plugins.json
+%manifest webapi-plugins.manifest
index 93b73b7..26d41d9 100644 (file)
@@ -4,7 +4,7 @@
   ],
   'targets': [
     {
-      'target_name': 'tizen_test',
+      'target_name': 'webapis_test',
       'type': 'loadable_module',
       'sources': [
         'test_api.js',
index 8832847..0e62ef9 100755 (executable)
@@ -26,7 +26,7 @@ common::Extension* CreateExtension() {
 }
 
 TestExtension::TestExtension() {
-  SetExtensionName("tizen.test");
+  SetExtensionName("webapis.test");
   SetJavaScriptAPI(kSource_test_api);
 }
 
index fc15ca5..6370937 100755 (executable)
@@ -8,6 +8,7 @@
       'target_name': 'extensions',
       'type': 'none',
       'dependencies': [
+        'tool/tool.gyp:*',
         'test/test.gyp:*',
       ],
       'conditions': [],
diff --git a/doc/src/assets/webapi-plugins-devel-test/src/tool/desc_gentool.cc b/doc/src/assets/webapi-plugins-devel-test/src/tool/desc_gentool.cc
new file mode 100644 (file)
index 0000000..b6fda30
--- /dev/null
@@ -0,0 +1,223 @@
+#include <iostream>
+#include <string>
+#include <vector>
+#include <map>
+#include <functional>
+
+#include <dlfcn.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <common/extension.h>
+
+static std::string prefix_ = "libwebapis";
+static std::string postfix_ = ".so";
+static std::vector<std::string> apinamespaces = {"tizen", "xwalk", "webapis"};
+
+typedef common::Extension *(*CreateExtensionFunc)(void);
+
+struct module_description {
+  std::string name;
+  std::string lib;
+  std::vector<std::string> entries;
+};
+
+
+static XW_Extension ext = 0;
+static std::map<XW_Extension, module_description> descriptions;
+
+#ifndef JSON_MINIFY
+  #define PRINT_TAB() std::cout << "\t"
+#else
+  #define PRINT_TAB()
+#endif
+
+void print_json() {
+  std::cout << "[" << std::endl;
+  for (const auto& kv : descriptions) {
+    const module_description &desc = kv.second;
+
+    std::string::size_type n = desc.name.find('.');
+    std::string ns =
+        n == std::string::npos ? desc.name : desc.name.substr(0, n);
+
+    if (std::find(apinamespaces.begin(), apinamespaces.end(), ns) ==
+        apinamespaces.end()) {
+      continue;
+    }
+
+    PRINT_TAB();
+    std::cout << "{" << std::endl;
+    PRINT_TAB();
+    PRINT_TAB();
+    std::cout << "\"name\":\"" << desc.name << "\"," << std::endl;
+    PRINT_TAB();
+    PRINT_TAB();
+    std::cout << "\"lib\":\"" << desc.lib << "\"," << std::endl;
+    PRINT_TAB();
+    PRINT_TAB();
+    std::cout << "\"entry_points\": [";
+    for (std::vector<std::string>::size_type i=0; i<desc.entries.size(); i++) {
+      if (i != 0) {
+        std::cout << ",";
+      }
+      std::cout << "\"" << desc.entries[i] << "\"";
+    }
+    std::cout << "]" << std::endl;
+    PRINT_TAB();
+    std::cout << "}";
+    if (kv.first != ext) {
+      std::cout << ",";
+    }
+    std::cout << std::endl;
+  }
+  std::cout << "]" << std::endl;
+}
+
+const void* get_interface(const char* name) {
+  if (!strcmp(name, XW_CORE_INTERFACE_1)) {
+    static const XW_CoreInterface coreInterface1 = {
+      [](XW_Extension extension, const char* name) {
+        module_description *desc = &descriptions[extension];
+        desc->name = name;
+      },
+      [](XW_Extension extension, const char* api) {},
+      [](XW_Extension extension, XW_CreatedInstanceCallback created,
+         XW_DestroyedInstanceCallback destroyed) {},
+      [](XW_Extension extension, XW_ShutdownCallback shutdown_callback) {},
+      [](XW_Instance instance, void* data) {},
+      [](XW_Instance instance) -> void* { return nullptr; }
+      };
+    return &coreInterface1;
+  }
+
+  if (!strcmp(name, XW_INTERNAL_ENTRY_POINTS_INTERFACE_1)) {
+    static const XW_Internal_EntryPointsInterface entryPointsInterface1 = {
+      [](XW_Extension extension, const char** entries) {
+        module_description *desc = &descriptions[extension];
+        for (int i=0; entries[i]; i++) {
+          desc->entries.push_back(std::string(entries[i]));
+        }
+      }
+    };
+    return &entryPointsInterface1;
+  }
+
+  if (!strcmp(name, XW_MESSAGING_INTERFACE_1)) {
+    static const XW_MessagingInterface_1 messagingInterface1 = {
+      [](XW_Extension extension, XW_HandleMessageCallback handle_message) {
+      },
+      [](XW_Instance instance, const char* message) {
+      }
+    };
+    return &messagingInterface1;
+  }
+
+  if (!strcmp(name, XW_INTERNAL_SYNC_MESSAGING_INTERFACE_1)) {
+    static const XW_Internal_SyncMessagingInterface syncMessagingInterface1 = {
+      [](XW_Extension extension, XW_HandleSyncMessageCallback handle_sync_msg) {
+      },
+      [](XW_Instance instance, const char* reply){
+      }
+    };
+    return &syncMessagingInterface1;
+  }
+
+  if (!strcmp(name, XW_INTERNAL_RUNTIME_INTERFACE_1)) {
+    static const XW_Internal_RuntimeInterface_1 runtimeInterface1 = {
+      [](XW_Extension extension, const char* key, char* value, size_t vlen) {
+      }
+    };
+    return &runtimeInterface1;
+  }
+
+  if (!strcmp(name, XW_INTERNAL_PERMISSIONS_INTERFACE_1)) {
+    static const XW_Internal_PermissionsInterface_1 permissionsInterface1 = {
+      [](XW_Extension extension, const char* api_name) -> int {
+        return XW_ERROR;
+      },
+      [](XW_Extension extension, const char* perm_table) -> int {
+        return XW_ERROR;
+      }
+    };
+    return &permissionsInterface1;
+  }
+
+  return NULL;
+}
+
+int main(int argc, char* argv[]) {
+  if (argc < 3) {
+    std::cerr << "Need tizen crosswalk path" << std::endl;
+    return -1;
+  }
+  std::string lib_path = argv[1];
+  if (lib_path.empty()) {
+    std::cerr << "Invalid libpath for tec." << std::endl;
+    return -1;
+  }
+
+  std::string tec_path = argv[2];
+  if (tec_path.empty()) {
+    std::cerr << "Invalid tizen crosswalk path" << std::endl;
+    return -1;
+  }
+
+  struct dirent** namelist;
+  int num_entries = scandir(tec_path.c_str(), &namelist, NULL, alphasort);
+  if( num_entries >= 0 ) {
+    for( int i = 0; i < num_entries; ++i ) {
+      std::string fname = namelist[i]->d_name;
+
+      if (fname.size() >= prefix_.size() + postfix_.size() &&
+          !fname.compare(0, prefix_.size(), prefix_) &&
+          !fname.compare(fname.size() - postfix_.size(), postfix_.size(),
+                        postfix_)) {
+        std::string so_path = tec_path + "/" + fname;
+        void *handle = dlopen(so_path.c_str(), RTLD_LAZY);
+        if (handle == NULL) {
+          std::cerr << "cannot open " << so_path << std::endl;
+          char* error = dlerror();
+          std::cerr << "Error >>" << ((error == NULL) ? "NULL" : error) << std::endl;
+          return -1;
+        }
+
+        XW_Initialize_Func initialize = reinterpret_cast<XW_Initialize_Func>(
+                dlsym(handle, "XW_Initialize"));
+
+        if (!initialize) {
+          std::cerr << "Can not loading extension " << fname << std::endl;
+        } else {
+          ext++;
+          descriptions[ext] = module_description();
+          descriptions[ext].lib = lib_path + "/" + fname;
+          int ret = initialize(ext, get_interface);
+          if (ret != XW_OK) {
+            std::cerr << "Error loading extension " << fname << std::endl;
+          }
+        }
+
+        // some Shared libraries have static finalizer.
+        // __attribute__((destructor)) this gcc extension makes finalizer.
+        // if close it, it can makes segfault.
+        // True, It's shared object's problem. but we can't fix it.
+        // so don't close it in only this tool. just finish process.
+        //
+        // dlclose(handle);
+      }
+      free(namelist[i]);
+    }
+    free(namelist);
+    print_json();
+  } else {
+    perror("scandir");
+    if( errno == ENOENT )
+      std::cerr << "path not exist : " << tec_path << std::endl;
+    return -1;
+  }
+
+  // it would be need for ignore loaded libraries destructor
+  _exit(0);
+}
diff --git a/doc/src/assets/webapi-plugins-devel-test/src/tool/tool.gyp b/doc/src/assets/webapi-plugins-devel-test/src/tool/tool.gyp
new file mode 100644 (file)
index 0000000..ed978ce
--- /dev/null
@@ -0,0 +1,25 @@
+{
+    'target_defaults': {
+        'variables': {'packages': ['dlog']},
+        'includes': [
+            '/usr/include/webapi-plugins/src/common/pkg-config.gypi'
+        ]
+    },
+    'targets' : [
+        {
+            'target_name': 'desc_gentool',
+            'cflags': [
+                '-std=c++0x',
+                '-Wall'
+            ],
+            'link_settings': {'libraries': [ '-ldl'], },
+            'include_dirs': [
+                '/usr/include/webapi-plugins/src/'
+            ],
+            'type': 'executable',
+            'sources': [
+                'desc_gentool.cc'
+            ]
+        }
+    ]
+}
diff --git a/doc/src/assets/webapi-plugins-devel-test/webapi-plugins.manifest b/doc/src/assets/webapi-plugins-devel-test/webapi-plugins.manifest
new file mode 100644 (file)
index 0000000..f5a44ec
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+        <request>
+                <domain name="_"/>
+        </request>
+</manifest>
index 601cb3e..c6b9e4c 100644 (file)
@@ -38,7 +38,7 @@ Cflags: -I${includedir}
 
 ### Creating custom web device plugins module
 
-To create custom web device plugins module ```webapi-plugins.spec```, ```tizen-wrt.gyp``` and ```src``` files are needed.
+To create custom web device plugins module ```webapi-plugins.spec```, ```tizen-wrt.gyp```, ```webapi-plugins.manifest``` and ```src``` files are needed.
 Skeleton below shows the required structure of test module.
 
 ```sh
@@ -46,35 +46,51 @@ Skeleton below shows the required structure of test module.
 │   └── webapi-plugins.spec
 └── src
 │   ├── test
-│   ├── test_api.js
-│   ├── test_extension.cc
-│   ├── test_extension.h
-│   ├── test.gyp
-│   ├── test_instance.cc
-│   └── test_instance.h
-└── tizen-wrt.gyp
+│   |   ├── test_api.js
+│   |   ├── test_extension.cc
+│   |   ├── test_extension.h
+│   |   ├── test.gyp
+│   |   ├── test_instance.cc
+│   |   └── test_instance.h
+│   ├── tool
+│   |   ├── desc_gentool.cc
+│   |   └── tool.gyp
+|   └── tizen-wrt.gyp
+└── webapi-plugins.manifest
 ```
 
 webapi-plugins.spec source:
 ```
+%bcond_with wayland
+
 %define _manifestdir %{TZ_SYS_RW_PACKAGES}
 %define _desktop_icondir %{TZ_SYS_SHARE}/icons/default/small
 
 %define crosswalk_extensions tizen-extensions-crosswalk
 
+%define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions}
+
 Name:       webapi-plugins-test
 Version:    0.1
 Release:    0
 License:    Apache-2.0 and BSD-2.0 and MIT
 Group:      Development/Libraries
-Summary:    Tizen Web APIs implemented
+Summary:    Tizen Test Web APIs
 Source0:    %{name}-%{version}.tar.gz
 
+%ifarch %{arm} aarch64
+# ARM
+%define tizen_is_emulator           0
+%else
+# I586
+%define tizen_is_emulator           1
+%endif
+
 BuildRequires: ninja
 BuildRequires: pkgconfig(webapi-plugins)
 
 %description
-Tizen Test Web APIs.
+Tizen Test Web APIs
 
 %prep
 %setup -q
@@ -82,19 +98,36 @@ Tizen Test Web APIs.
 %build
 
 export GYP_GENERATORS='ninja'
-GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{tizen_profile_name} -Dprivilege_engine=%{tizen_privilege_engine}"
-GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=x11"
+GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{profile} -Dprivilege_engine=%{tizen_privilege_engine}"
+GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}"
+GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}"
+
+# feature flags
+GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}"
 
 /usr/include/webapi-plugins/tools/gyp/gyp $GYP_OPTIONS src/tizen-wrt.gyp
 
 ninja -C out/Default %{?_smp_mflags}
 
 %install
-mkdir -p %{buildroot}%{_libdir}/%{crosswalk_extensions}
-install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_extensions}
+
+# Extensions.
+mkdir -p %{buildroot}%{crosswalk_extensions_path}
+install -p -m 644 out/Default/libwebapis*.so %{buildroot}%{crosswalk_extensions_path}
+
+# execute desc_gentool
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path} out/Default/desc_gentool \
+  %{crosswalk_extensions_path} \
+  %{buildroot}%{crosswalk_extensions_path} > webapis-plugins.json
+
+# temporary plugins description for lazy loading
+install -p -m 644 webapis-plugins.json %{buildroot}%{crosswalk_extensions_path}/webapis-plugins.json
+
 
 %files
-%{_libdir}/%{crosswalk_extensions}/libtizen*.so
+%{crosswalk_extensions_path}/libwebapis*.so
+%{crosswalk_extensions_path}/webapis-plugins.json
+%manifest webapi-plugins.manifest
 ```
 
 tizen-wrt.gyp source:
@@ -109,6 +142,7 @@ tizen-wrt.gyp source:
       'target_name': 'extensions',
       'type': 'none',
       'dependencies': [
+        'tool/tool.gyp:*',
         'test/test.gyp:*',
       ],
       'conditions': [],
@@ -125,7 +159,7 @@ test.gyp source:
   ],
   'targets': [
     {
-      'target_name': 'tizen_test',
+      'target_name': 'webapis_test',
       'type': 'loadable_module',
       'sources': [
         'test_api.js',
@@ -153,9 +187,9 @@ Custom web device plugins module test is placed in ```src/``` directory and cont
 Please see [Plugin structure](#plugin-structure) chapter for more details.
 
 To install custom web device plugins module ```webapi-plugins-xxx.rpm``` and ```webapi-plugins-devel-xxx.rpm``` must be installed first.
-After build and installation webapi-plugins-devel-test ```tizen.test``` namespace should be available.
+After build and installation webapi-plugins-test ```webapis.test``` namespace should be available.
 
 ```javascript
-var test = tizen.test.ping();
+var test = webapis.test.ping();
 console.log(test); // Hello!
 ```
index 46e1e57..12d50f4 100644 (file)
@@ -10,6 +10,7 @@
 | 0.4.0 | 2015-06-16 | Guideline | Pawel Kaczmarek<br><p.kaczmarek3@samsung.com> |
 | 0.5.0 | 2015-06-18 | Devel package | Pawel Kaczmarek<br><p.kaczmarek3@samsung.com> |
 | 0.5.1 | 2015-06-24 | Add info about WAPIOven.py | Pawel Kaczmarek<br><p.kaczmarek3@samsung.com> |
+| 0.6.0 | 2016-10-28 | update devel package for tizen 3.0 | Annie Park<br><hj.na.park@samsung.com> |
 
 ## Overview
 This document should be used as a guideline for developers who are creating web