1 /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
2 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3 // Use of this source code is governed by a apache 2.0 license that can be
4 // found in the LICENSE file.
6 #include <common/installer_runner.h>
7 #include <common/pkgmgr_interface.h>
10 #include "hybrid/hybrid_installer.h"
11 #include "hybrid/hybrid_installer_factory.h"
12 #include "wgt/utils/wgt_app_query_interface.h"
13 #include "wgt/wgt_installer.h"
14 #include "wgt/wgt_installer_factory.h"
16 namespace ci = common_installer;
18 #if __cplusplus < 201300L
21 template<typename T, typename... Args>
22 std::unique_ptr<T> make_unique(Args&&... args) {
23 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
29 int main(int argc, char** argv) {
30 ci::PkgmgrInstaller pkgmgr_installer;
31 wgt::WgtAppQueryInterface query_interface;
32 auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
34 std::unique_ptr<ci::InstallerFactory> installer_factory;
36 LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
40 #if __cplusplus >= 201300L
43 // This is workaround for hybrid apps as they requires much different flow
44 // but installer does not branch at all in current design
45 if (query_interface.IsHybridApplication(
46 pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
47 LOG(INFO) << "Hybrid package detected";
48 ci::InstallerRunner runner(
49 make_unique<hybrid::HybridInstallerFactory>(), pkgmgr);
50 return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
52 ci::InstallerRunner runner(make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
53 return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;