From: jinwoo jeong Date: Wed, 31 Jan 2018 08:59:22 +0000 (+0900) Subject: Getting application data using wrt common library. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33efdff9c835296e135507a21f9eb7125d0ca349;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Getting application data using wrt common library. To use wrt common library, it should be complied to shared library. Because it has many dependency with system libraries. In wrt common, there are CommandLine and ApplicationData modules. Using those modules, the arguements can be parsed. And electron can get more information from app db or app control. Change-Id: Idb7f906b240de01f04ad4ed145266e23615ef4d3 Signed-off-by: jinwoo jeong --- diff --git a/atom/app/atom_main.cc b/atom/app/atom_main.cc index 0d6ea8b32..49625a66f 100644 --- a/atom/app/atom_main.cc +++ b/atom/app/atom_main.cc @@ -37,6 +37,9 @@ #include "base/i18n/icu_util.h" #if defined(OS_TIZEN) +#include "base/logging.h" +#include "tizen/common/application_data.h" +#include "tizen/common/command_line.h" #include "tizen/loader/prelauncher.h" #include "base/logging.h" #endif @@ -144,9 +147,18 @@ int main(int argc, char* argv[]) { } #if defined(USE_EFL) - if (argv[0] == "/usr/bin/electron") // not browser process - base::CommandLine::Init(argc, argv); - else if (efl::Initialize(argc, const_cast(argv))) + common::CommandLine::Init(argc, argv); + common::CommandLine* runtime_cmd = common::CommandLine::ForCurrentProcess(); + std::string appid = runtime_cmd->GetAppIdFromCommandLine("/usr/bin/electron"); + + // load manifest + auto appdata_manager = common::ApplicationDataManager::GetInstance(); + common::ApplicationData* appdata = appdata_manager->GetApplicationData(appid); + if (!appdata->LoadManifestData()) { + return false; + } + + if (efl::Initialize(argc, const_cast(argv))) return 1; // Add params for EFL port diff --git a/electron.gyp b/electron.gyp index dda2dff4f..d876687f4 100644 --- a/electron.gyp +++ b/electron.gyp @@ -221,18 +221,23 @@ ], }], # OS=="linux" ['is_tizen==1', { + 'includes': [ + 'tizen/build/common.gypi', + ], 'dependencies': [ - 'tizen/common/common.gyp:*', - 'tizen/loader/loader.gyp:*', + 'tizen/common/common.gyp:wrt_common', + 'tizen/loader/loader.gyp:wrt-loader', '<(DEPTH)/efl/build/system.gyp:ecore', '<(DEPTH)/efl/build/system.gyp:launchpad', ], + 'sources': [ + 'tizen/loader/prelauncher.h', + 'tizen/loader/prelauncher.cc', + ], 'ldflags': [ '-pie', '-export-dynamic', ], - 'cflags': [ '-fPIC' ], - 'cflags_cc': [ '-fPIC' ], }], # is_tizen==1 ], }, # target <(project_name) diff --git a/packaging/electron-efl.spec b/packaging/electron-efl.spec index f9099784c..42f9c65eb 100755 --- a/packaging/electron-efl.spec +++ b/packaging/electron-efl.spec @@ -105,6 +105,10 @@ install -m 0644 %{_out}/packaging/%{_pkgid}.xml %{buildroot}%{_xmldir} mkdir -p %{buildroot}%{_datadir}/aul/ cp %{SOURCE1002} %{buildroot}%{_datadir}/aul/ +# wrt_common +mkdir -p %{buildroot}%{_libdir} +install -p -m 644 %{_out}/lib/libwrt_common.so %{buildroot}%{_libdir} + mkdir -p %{buildroot}/usr/apps/org.tizen.electron-efl/bin/ install -d %{buildroot}/%{_icondir} install -d %{buildroot}/%{_libdir} @@ -162,3 +166,4 @@ rm -fr %{buildroot} %attr(755,root,root) %{_bindir}/wrt-loader %attr(755,root,root) %{_bindir}/xwalk_runtime %attr(644,root,root) %{_datadir}/aul/wrt.loader +%attr(644,root,root) %{_libdir}/libwrt_common.so diff --git a/tizen/common/common.gyp b/tizen/common/common.gyp index 25d27a8e6..7d56a2ebe 100644 --- a/tizen/common/common.gyp +++ b/tizen/common/common.gyp @@ -5,7 +5,7 @@ 'targets': [ { 'target_name': 'wrt_common', - 'type': 'static_library', + 'type': 'shared_library', 'sources': [ 'command_line.h', 'command_line.cc', diff --git a/tizen/loader/loader.gyp b/tizen/loader/loader.gyp index 14d1fdc79..d71af008e 100755 --- a/tizen/loader/loader.gyp +++ b/tizen/loader/loader.gyp @@ -1,4 +1,7 @@ { + 'includes': [ + '../build/common.gypi', + ], 'targets': [ { 'target_name': 'wrt-loader', @@ -9,36 +12,14 @@ 'libraries' : [ '-ldl', ], - 'include_dirs': [ - '<(libchromiumcontent_src_dir)', - ], 'ldflags': [ - '-Wl,--whole-archive', - '<@(libchromiumcontent_libraries)', - '-Wl,--no-whole-archive', + '-pie', ], - 'link_settings': { - 'libraries': [ - '<@(libchromiumcontent_libraries)', - ] + 'variables': { + 'packages': [ + 'dlog', + ], }, }, # end of target 'wrt-loader' - { - 'target_name': 'prelauncher', - 'type': 'static_library', - 'dependencies': [ - '<(DEPTH)/efl/build/system.gyp:ecore', - '<(DEPTH)/efl/build/system.gyp:launchpad', - ], - 'include_dirs': [ - '<(libchromiumcontent_src_dir)', - ], - 'cflags': [ '-fPIC' ], - 'cflags_cc': [ '-fPIC' ], - 'sources': [ - 'prelauncher.cc', - 'prelauncher.h', - ], - }, # end of target 'preloader' ], } diff --git a/tizen/loader/wrt_loader.cc b/tizen/loader/wrt_loader.cc index 57b9d3bff..bb9144998 100644 --- a/tizen/loader/wrt_loader.cc +++ b/tizen/loader/wrt_loader.cc @@ -14,15 +14,15 @@ * limitations under the License. */ #include -#include "base/logging.h" +#include // loader file must have "User" execute label, because launchpad daemon runs // with "System::Privileged" label. int main(int argc, char* argv[]) { - LOG(INFO) << "Begin wrt-loader"; + dlog_print(DLOG_INFO, "CHROMIUM", "Begin wrt-loader"); void* handle = dlopen("/usr/bin/electron", RTLD_NOW); if (!handle) { - LOG(ERROR) << "Failed to load electorn"; + dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load electorn"); return false; } @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { MAIN_FUNC real_main = reinterpret_cast(dlsym(handle, "main")); if (!real_main) { - LOG(ERROR) << "Failed to load real_main"; + dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load real_main"); return false; }