From: Mateusz Bruno-Kaminski Date: Tue, 25 Oct 2016 12:39:03 +0000 (+0200) Subject: [Test] Missing plugins.json in test package X-Git-Tag: submit/tizen_3.0/20161102.040156~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2079a0d62992824c1df3176dbb6b59f7bdb6f7f3;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Test] Missing plugins.json in test package [Details] Rewritten webapi-plugins-devel-test. The plugins.json file is being created. Change-Id: Ibcd5219bf59d8049a0a81c1e5f95f8ea6ba7c310 Signed-off-by: Mateusz Bruno-Kaminski --- diff --git a/doc/html/index.html b/doc/html/index.html index 58ba5894..cf82f401 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -35,43 +35,49 @@ 0.1.0 2015-05-15 Initial Draft -Wojciech Kosowicz
w.kosowicz@samsung.com +Wojciech Kosowicz
w.kosowicz@samsung.com 0.2.0 2015-05-22 Extended version -Pawel Kaczmarek
p.kaczmarek3@samsung.com +Pawel Kaczmarek
p.kaczmarek3@samsung.com 0.2.1 2015-06-01 Proofreading -Rafal Galka
r.galka@samsung.com +Rafal Galka
r.galka@samsung.com 0.3.0 2015-06-08 Supplemented C++ implementation guide -Rafal Galka
r.galka@samsung.com +Rafal Galka
r.galka@samsung.com 0.4.0 2015-06-16 Guideline -Pawel Kaczmarek
p.kaczmarek3@samsung.com +Pawel Kaczmarek
p.kaczmarek3@samsung.com 0.5.0 2015-06-18 Devel package -Pawel Kaczmarek
p.kaczmarek3@samsung.com +Pawel Kaczmarek
p.kaczmarek3@samsung.com 0.5.1 2015-06-24 Add info about WAPIOven.py -Pawel Kaczmarek
p.kaczmarek3@samsung.com +Pawel Kaczmarek
p.kaczmarek3@samsung.com + + +0.6.0 +2016-10-28 +update devel package for tizen 3.0 +Annie Park
hj.na.park@samsung.com @@ -294,11 +300,9 @@ lacks of keyword FunctionOnly.

tools/skeleton_generator/ directory and run the python command:

$ python WAPIOven.py -d <stub code destination directory name> <widl directory/pluginname>.widl
 
-

If tizen.widl is needed, add tizen.widl you can use stub generator located in -tools/skeleton_generator/ directory and run the python command:

-
$ python WAPIOven.py -d <stub code destination directory name> <widl directory/pluginname>.widl <widl directory/>tizen.widl
-
-

Path to WAPIOven.py:

+

If tizen.widl is needed, add tizen.widl

+
$ python WAPIOven.py -d <stub code destination directory name> <widl directory/pluginname>.widl <widl directory/>tizen.widl
+

Path to WAPIOven.py:

$ tools/skeleton_generator/WAPIOven.py
 

You need to install jinja2 for WAPIOven.py:

@@ -672,39 +676,55 @@ Requires: dbus-1 dlog glib-2.0 Libs: -L${libdir} -ltizen_common 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.

├── 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
 

webapi-plugins.spec source:

-
%define _manifestdir %{TZ_SYS_RW_PACKAGES}
+
%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='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:

{
   'includes':[
@@ -736,6 +773,7 @@ install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_ex
       'target_name': 'extensions',
       'type': 'none',
       'dependencies': [
+        'tool/tool.gyp:*',
         'test/test.gyp:*',
       ],
       'conditions': [],
@@ -749,7 +787,7 @@ install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_ex
   ],
   'targets': [
     {
-      'target_name': 'tizen_test',
+      'target_name': 'webapis_test',
       'type': 'loadable_module',
       'sources': [
         'test_api.js',
@@ -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 src/ directory and contains all required files.
 Please see 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.

-
var test = tizen.test.ping();
+After build and installation webapi-plugins-test webapis.test namespace should be available.

+
var test = webapis.test.ping();
 console.log(test); // Hello!
 
diff --git a/doc/src/assets/webapi-plugins-devel-test.zip b/doc/src/assets/webapi-plugins-devel-test.zip index b940fb5c..52201f4e 100644 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 index 00000000..f1aebff7 --- /dev/null +++ b/doc/src/assets/webapi-plugins-devel-test/LICENSE.MIT @@ -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. diff --git a/doc/src/assets/webapi-plugins-devel-test/packaging/webapi-plugins.spec b/doc/src/assets/webapi-plugins-devel-test/packaging/webapi-plugins.spec old mode 100755 new mode 100644 index 8bddfb40..c992a8a8 --- a/doc/src/assets/webapi-plugins-devel-test/packaging/webapi-plugins.spec +++ b/doc/src/assets/webapi-plugins-devel-test/packaging/webapi-plugins.spec @@ -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 diff --git a/doc/src/assets/webapi-plugins-devel-test/src/test/test.gyp b/doc/src/assets/webapi-plugins-devel-test/src/test/test.gyp index 93b73b78..26d41d99 100644 --- a/doc/src/assets/webapi-plugins-devel-test/src/test/test.gyp +++ b/doc/src/assets/webapi-plugins-devel-test/src/test/test.gyp @@ -4,7 +4,7 @@ ], 'targets': [ { - 'target_name': 'tizen_test', + 'target_name': 'webapis_test', 'type': 'loadable_module', 'sources': [ 'test_api.js', diff --git a/doc/src/assets/webapi-plugins-devel-test/src/test/test_extension.cc b/doc/src/assets/webapi-plugins-devel-test/src/test/test_extension.cc index 88328471..0e62ef9f 100755 --- a/doc/src/assets/webapi-plugins-devel-test/src/test/test_extension.cc +++ b/doc/src/assets/webapi-plugins-devel-test/src/test/test_extension.cc @@ -26,7 +26,7 @@ common::Extension* CreateExtension() { } TestExtension::TestExtension() { - SetExtensionName("tizen.test"); + SetExtensionName("webapis.test"); SetJavaScriptAPI(kSource_test_api); } diff --git a/doc/src/assets/webapi-plugins-devel-test/src/tizen-wrt.gyp b/doc/src/assets/webapi-plugins-devel-test/src/tizen-wrt.gyp index fc15ca50..63709379 100755 --- a/doc/src/assets/webapi-plugins-devel-test/src/tizen-wrt.gyp +++ b/doc/src/assets/webapi-plugins-devel-test/src/tizen-wrt.gyp @@ -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 index 00000000..b6fda30d --- /dev/null +++ b/doc/src/assets/webapi-plugins-devel-test/src/tool/desc_gentool.cc @@ -0,0 +1,223 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +static std::string prefix_ = "libwebapis"; +static std::string postfix_ = ".so"; +static std::vector apinamespaces = {"tizen", "xwalk", "webapis"}; + +typedef common::Extension *(*CreateExtensionFunc)(void); + +struct module_description { + std::string name; + std::string lib; + std::vector entries; +}; + + +static XW_Extension ext = 0; +static std::map 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::size_type i=0; iname = 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( + 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 index 00000000..ed978ce1 --- /dev/null +++ b/doc/src/assets/webapi-plugins-devel-test/src/tool/tool.gyp @@ -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 index 00000000..f5a44ec9 --- /dev/null +++ b/doc/src/assets/webapi-plugins-devel-test/webapi-plugins.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/doc/src/devel_package.md b/doc/src/devel_package.md index 601cb3e4..c6b9e4c6 100644 --- a/doc/src/devel_package.md +++ b/doc/src/devel_package.md @@ -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! ``` diff --git a/doc/src/index.md b/doc/src/index.md index 46e1e572..12d50f4f 100644 --- a/doc/src/index.md +++ b/doc/src/index.md @@ -10,6 +10,7 @@ | 0.4.0 | 2015-06-16 | Guideline | Pawel Kaczmarek
| | 0.5.0 | 2015-06-18 | Devel package | Pawel Kaczmarek
| | 0.5.1 | 2015-06-24 | Add info about WAPIOven.py | Pawel Kaczmarek
| +| 0.6.0 | 2016-10-28 | update devel package for tizen 3.0 | Annie Park
| ## Overview This document should be used as a guideline for developers who are creating web