refact: restructure project
1. adjust project structure; 2. use config.h to locate app-launch-helper binary.
This commit is contained in:
parent
fe284e78b6
commit
4687265e65
@ -16,35 +16,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core DBus Concurrent)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
qt_add_dbus_adaptor(ApplicationManagerSource ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.xml applicationmanager1service.h ApplicationManager1Service)
|
||||
add_library(ApplicationManager OBJECT ${ApplicationManagerSource})
|
||||
qt_add_dbus_adaptor(ApplicationSource ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.Application.xml applicationservice.h ApplicationService)
|
||||
add_library(Application OBJECT ${ApplicationSource})
|
||||
qt_add_dbus_adaptor(InstnaceSource ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.Instance.xml instanceservice.h InstanceService)
|
||||
add_library(Instance OBJECT ${InstnaceSource})
|
||||
qt_add_dbus_adaptor(JobManagerSource ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.JobManager1.xml jobmanager1service.h JobManager1Service)
|
||||
add_library(JobManager OBJECT ${JobManagerSource})
|
||||
qt_add_dbus_adaptor(JobSource ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.JobManager1.Job.xml jobservice.h JobService)
|
||||
add_library(Job OBJECT ${JobSource})
|
||||
|
||||
set(AdaptorLib)
|
||||
list(APPEND AdaptorLib ApplicationManager Application Instance JobManager Job)
|
||||
|
||||
foreach(obj IN LISTS AdaptorLib)
|
||||
target_link_libraries(${obj} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::DBus
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
)
|
||||
|
||||
target_include_directories(${obj} PUBLIC
|
||||
${PROJECT_SOURCE_DIR}/src/include
|
||||
${PROJECT_SOURCE_DIR}/src/dbus
|
||||
)
|
||||
endforeach()
|
||||
set(APP_LAUNCH_HELPER_BIN app-launch-helper)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(plugin)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(apps)
|
||||
|
||||
# add_subdirectory(docs)
|
||||
include(CTest)
|
||||
|
3
apps/CMakeLists.txt
Normal file
3
apps/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
add_subdirectory(dde-application-manager)
|
||||
add_subdirectory(app-launch-helper)
|
||||
|
1
apps/app-launch-helper/CMakeLists.txt
Normal file
1
apps/app-launch-helper/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(src)
|
10
apps/app-launch-helper/src/CMakeLists.txt
Normal file
10
apps/app-launch-helper/src/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
|
||||
|
||||
add_executable(${APP_LAUNCH_HELPER_BIN} main.cpp)
|
||||
target_link_libraries(${APP_LAUNCH_HELPER_BIN} PRIVATE
|
||||
PkgConfig::SYSTEMD
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS ${APP_LAUNCH_HELPER_BIN} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/deepin/application-manager/)
|
@ -2,10 +2,12 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include <numeric>
|
||||
#include <systemd/sd-bus.h>
|
||||
#include <systemd/sd-journal.h>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -62,7 +64,7 @@ static ExitCode fromString(const char *str)
|
||||
std::exit(static_cast<int>(ret));
|
||||
}
|
||||
|
||||
static int processExecStart(msg_ptr &msg, const std::vector<std::string_view> &execArgs)
|
||||
static int processExecStart(msg_ptr &msg, const std::deque<std::string_view> &execArgs)
|
||||
{
|
||||
int ret;
|
||||
if (ret = sd_bus_message_append(msg, "s", "ExecStart"); ret < 0) {
|
||||
@ -147,17 +149,20 @@ static int processKVPair(msg_ptr &msg, const std::map<std::string_view, std::str
|
||||
return 0;
|
||||
}
|
||||
|
||||
static std::string cmdParse(msg_ptr &msg, const std::vector<std::string_view> cmdLines)
|
||||
static std::string cmdParse(msg_ptr &msg, std::deque<std::string_view> &&cmdLines)
|
||||
{
|
||||
std::string serviceName{"internalError"};
|
||||
std::map<std::string_view, std::string_view> props;
|
||||
for (auto str : cmdLines) { // avoid stl exception
|
||||
while (!cmdLines.empty()) { // NOTE: avoid stl exception
|
||||
auto str = cmdLines.front();
|
||||
if (str.size() < 2) {
|
||||
sd_journal_print(LOG_WARNING, "invalid option %s.", str.data());
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
if (str.substr(0, 2) != "--") {
|
||||
sd_journal_print(LOG_INFO, "unknown option %s.", str.data());
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -166,92 +171,100 @@ static std::string cmdParse(msg_ptr &msg, const std::vector<std::string_view> cm
|
||||
auto it = kvStr.cbegin();
|
||||
if (it = std::find(it, kvStr.cend(), '='); it == kvStr.cend()) {
|
||||
sd_journal_print(LOG_WARNING, "invalid k-v pair: %s", kvStr.data());
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
auto splitIndex = std::distance(kvStr.cbegin(), it);
|
||||
if (++it == kvStr.cend()) {
|
||||
sd_journal_print(LOG_WARNING, "invalid k-v pair: %s", kvStr.data());
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
|
||||
auto key = kvStr.substr(0, splitIndex);
|
||||
if (key == "Type") { // type must be exec
|
||||
if (key == "Type") {
|
||||
// NOTE:
|
||||
// Systemd service type must be "exec",
|
||||
// this should not be configured in command line arguments.
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
props[key] = kvStr.substr(splitIndex + 1);
|
||||
cmdLines.pop_front();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Processing of the binary file and its parameters that am want to launch
|
||||
auto it = std::find(cmdLines.cbegin(), cmdLines.cend(), str);
|
||||
std::vector execArgs(++it, cmdLines.cend());
|
||||
if (execArgs.empty()) {
|
||||
sd_journal_print(LOG_ERR, "param exec is empty.");
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
int ret;
|
||||
if (props.find("unitName") == props.cend()) {
|
||||
sd_journal_perror("unitName doesn't exists.");
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
if (ret = sd_bus_message_append(msg, "s", props["unitName"].data()); ret < 0) { // unitName
|
||||
sd_journal_perror("append unitName failed.");
|
||||
return serviceName;
|
||||
} else {
|
||||
serviceName = props["unitName"];
|
||||
props.erase("unitName");
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_append(msg, "s", "replace"); ret < 0) { // start mode
|
||||
sd_journal_perror("append startMode failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
// process properties: a(sv)
|
||||
if (ret = sd_bus_message_open_container(msg, SD_BUS_TYPE_ARRAY, "(sv)"); ret < 0) {
|
||||
sd_journal_perror("open array failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_append(msg, "(sv)", "Type", "s", "exec"); ret < 0) {
|
||||
sd_journal_perror("append type failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_open_container(msg, SD_BUS_TYPE_STRUCT, "sv"); ret < 0) {
|
||||
sd_journal_perror("open struct failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = processKVPair(msg, props); ret < 0) { // process props
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = processExecStart(msg, execArgs); ret < 0) {
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_close_container(msg); ret < 0) {
|
||||
sd_journal_perror("close struct failed.");
|
||||
return serviceName;
|
||||
}
|
||||
if (ret = sd_bus_message_close_container(msg); ret < 0) {
|
||||
sd_journal_perror("close array failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
// append aux, it's unused for now
|
||||
if (ret = sd_bus_message_append(msg, "a(sa(sv))", 0); ret < 0) {
|
||||
sd_journal_perror("append aux failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
cmdLines.pop_front(); // NOTE: skip "--"
|
||||
break;
|
||||
}
|
||||
|
||||
// Processing of the binary file and its parameters that am want to launch
|
||||
auto &execArgs = cmdLines;
|
||||
if (execArgs.empty()) {
|
||||
sd_journal_print(LOG_ERR, "param exec is empty.");
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
int ret;
|
||||
if (props.find("unitName") == props.cend()) {
|
||||
sd_journal_perror("unitName doesn't exists.");
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
if (ret = sd_bus_message_append(msg, "s", props["unitName"].data()); ret < 0) { // unitName
|
||||
sd_journal_perror("append unitName failed.");
|
||||
return serviceName;
|
||||
} else {
|
||||
serviceName = props["unitName"];
|
||||
props.erase("unitName");
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_append(msg, "s", "replace"); ret < 0) { // start mode
|
||||
sd_journal_perror("append startMode failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
// process properties: a(sv)
|
||||
if (ret = sd_bus_message_open_container(msg, SD_BUS_TYPE_ARRAY, "(sv)"); ret < 0) {
|
||||
sd_journal_perror("open array failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_append(msg, "(sv)", "Type", "s", "exec"); ret < 0) {
|
||||
sd_journal_perror("append type failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_open_container(msg, SD_BUS_TYPE_STRUCT, "sv"); ret < 0) {
|
||||
sd_journal_perror("open struct failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = processKVPair(msg, props); ret < 0) { // process props
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = processExecStart(msg, execArgs); ret < 0) {
|
||||
serviceName = "invalidInput";
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_close_container(msg); ret < 0) {
|
||||
sd_journal_perror("close struct failed.");
|
||||
return serviceName;
|
||||
}
|
||||
if (ret = sd_bus_message_close_container(msg); ret < 0) {
|
||||
sd_journal_perror("close array failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
// append aux, it's unused for now
|
||||
if (ret = sd_bus_message_append(msg, "a(sa(sv))", 0); ret < 0) {
|
||||
sd_journal_perror("append aux failed.");
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
@ -322,12 +335,12 @@ int main(int argc, const char *argv[])
|
||||
releaseRes(error, msg, bus, ExitCode::InternalError);
|
||||
}
|
||||
|
||||
std::vector<std::string_view> args;
|
||||
for (std::size_t i = 1; i < argc; ++i) {
|
||||
std::deque<std::string_view> args;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
args.emplace_back(argv[i]);
|
||||
}
|
||||
|
||||
serviceId = cmdParse(msg, args);
|
||||
serviceId = cmdParse(msg, std::move(args));
|
||||
if (serviceId == "internalError") {
|
||||
releaseRes(error, msg, bus, ExitCode::InternalError);
|
||||
} else if (serviceId == "invalidInput") {
|
||||
@ -349,6 +362,8 @@ int main(int argc, const char *argv[])
|
||||
sd_bus_error_get_errno(&error);
|
||||
sd_journal_print(LOG_ERR, "launch failed: [%s,%s]", error.name, error.message);
|
||||
releaseRes(error, msg, bus, ExitCode::InternalError);
|
||||
} else {
|
||||
sd_journal_print(LOG_INFO, "launch %s success.", serviceId.c_str());
|
||||
}
|
||||
|
||||
if (ret = sd_bus_message_read(reply, "o", &path); ret < 0) {
|
1
apps/dde-application-manager/CMakeLists.txt
Normal file
1
apps/dde-application-manager/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(src)
|
14
apps/dde-application-manager/src/CMakeLists.txt
Normal file
14
apps/dde-application-manager/src/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
set(BIN_NAME dde-application-manager)
|
||||
|
||||
add_executable(${BIN_NAME} main.cpp utils.cpp)
|
||||
|
||||
target_link_libraries(${BIN_NAME} PRIVATE
|
||||
dde_am_static
|
||||
)
|
||||
|
||||
target_include_directories(${BIN_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
@ -6,7 +6,7 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include "applicationmanager1service.h"
|
||||
#include "dbus/applicationmanager1service.h"
|
||||
#include "cgroupsidentifier.h"
|
||||
#include "global.h"
|
||||
|
@ -1 +0,0 @@
|
||||
add_subdirectory(appLauncher)
|
@ -1,13 +0,0 @@
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(APP_LAUNCHER_BIN_NAME am-launcher)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
|
||||
|
||||
add_executable(${APP_LAUNCHER_BIN_NAME} launcher.cpp)
|
||||
target_link_libraries(${APP_LAUNCHER_BIN_NAME} PRIVATE
|
||||
PkgConfig::SYSTEMD
|
||||
)
|
||||
|
||||
install(TARGETS ${APP_LAUNCHER_BIN_NAME} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/deepin/application-manager/)
|
1
plugins/CMakeLists.txt
Normal file
1
plugins/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,31 +1,21 @@
|
||||
add_subdirectory(dbus)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(BIN_NAME dde-application-manager)
|
||||
set(LIB_NAME ddeam)
|
||||
configure_file(config.h.in config.h)
|
||||
|
||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
|
||||
set(LIB_NAME dde_am_static)
|
||||
|
||||
list(REMOVE_ITEM SRCS "${PROJECT_SOURCE_DIR}/src/utils.cpp")
|
||||
file(GLOB SRCS ${CMAKE_CURRENT_LIST_DIR}/*.cpp ${CMAKE_CURRENT_LIST_DIR}/*.h)
|
||||
|
||||
add_library(${LIB_NAME} ${SRCS})
|
||||
|
||||
target_include_directories(${LIB_NAME} PRIVATE
|
||||
${PROJECT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_NAME} PUBLIC
|
||||
Threads::Threads
|
||||
${AdaptorLib}
|
||||
dde_am_dbus
|
||||
)
|
||||
|
||||
add_executable(${BIN_NAME} main.cpp utils.cpp)
|
||||
|
||||
target_link_libraries(${BIN_NAME} PRIVATE
|
||||
${LIB_NAME}
|
||||
)
|
||||
|
||||
target_include_directories(${BIN_NAME} PRIVATE
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
11
src/config.h.in
Normal file
11
src/config.h.in
Normal file
@ -0,0 +1,11 @@
|
||||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
constexpr auto ApplicationLaunchHelperBinary =
|
||||
u8"@CMAKE_INSTALL_FULL_LIBEXECDIR@/deepin/application-manager/@APP_LAUNCH_HELPER_BIN@";
|
||||
|
||||
#endif
|
31
src/dbus/CMakeLists.txt
Normal file
31
src/dbus/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
add_library(dde_am_dbus OBJECT)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE dde_am_dbus_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
)
|
||||
|
||||
qt_add_dbus_adaptor(dde_am_dbus_SOURCE ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.xml dbus/applicationmanager1service.h ApplicationManager1Service)
|
||||
qt_add_dbus_adaptor(dde_am_dbus_SOURCE ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.Application.xml dbus/applicationservice.h ApplicationService)
|
||||
qt_add_dbus_adaptor(dde_am_dbus_SOURCE ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.ApplicationManager1.Instance.xml dbus/instanceservice.h InstanceService)
|
||||
qt_add_dbus_adaptor(dde_am_dbus_SOURCE ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.JobManager1.xml dbus/jobmanager1service.h JobManager1Service)
|
||||
qt_add_dbus_adaptor(dde_am_dbus_SOURCE ${PROJECT_SOURCE_DIR}/api/dbus/org.desktopspec.JobManager1.Job.xml dbus/jobservice.h JobService)
|
||||
|
||||
|
||||
target_sources(dde_am_dbus PRIVATE
|
||||
${dde_am_dbus_SOURCE}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
dde_am_dbus PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::DBus
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
dde_am_dbus PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
#include "applicationmanager1service.h"
|
||||
#include "applicationmanager1adaptor.h"
|
||||
#include "dbus/applicationmanager1service.h"
|
||||
#include "dbus/applicationmanager1adaptor.h"
|
||||
#include <QFile>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include <QScopedPointer>
|
||||
#include <memory>
|
||||
#include <QMap>
|
||||
#include "jobmanager1service.h"
|
||||
#include "applicationservice.h"
|
||||
#include "applicationadaptor.h"
|
||||
#include "dbus/jobmanager1service.h"
|
||||
#include "dbus/applicationservice.h"
|
||||
#include "dbus/applicationadaptor.h"
|
||||
#include "identifier.h"
|
||||
|
||||
class ApplicationManager1Service final : public QObject
|
||||
|
@ -2,9 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "applicationservice.h"
|
||||
#include "dbus/applicationservice.h"
|
||||
#include "applicationmanager1service.h"
|
||||
#include "instanceadaptor.h"
|
||||
#include "dbus/instanceadaptor.h"
|
||||
#include "pwd.h"
|
||||
#include <QUuid>
|
||||
#include <QStringList>
|
||||
@ -162,7 +162,7 @@ QDBusObjectPath ApplicationService::Launch(QString action, QStringList fields, Q
|
||||
auto instanceRandomUUID = QUuid::createUuid().toString(QUuid::Id128);
|
||||
tmp.push_front(QString{R"(--unitName=DDE-%1@%2.service)"}.arg(this->id(), instanceRandomUUID));
|
||||
QProcess process;
|
||||
process.start(ApplicationLauncherBinary, tmp);
|
||||
process.start(getApplicationLauncherBinary(), tmp);
|
||||
process.waitForFinished();
|
||||
auto exitCode = process.exitCode();
|
||||
if (exitCode != 0) {
|
||||
@ -318,6 +318,10 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
|
||||
}
|
||||
case 'u': {
|
||||
execList.removeAt(location);
|
||||
if (fields.empty()) {
|
||||
task.command.append(execList);
|
||||
break;
|
||||
}
|
||||
if (fields.count() > 1) {
|
||||
qDebug() << R"(fields count is greater than one, %u will only take first element.)";
|
||||
}
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include <QUuid>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include "instanceservice.h"
|
||||
#include "dbus/instanceservice.h"
|
||||
#include "global.h"
|
||||
#include "desktopentry.h"
|
||||
#include "desktopicons.h"
|
||||
#include "jobmanager1service.h"
|
||||
#include "dbus/jobmanager1service.h"
|
||||
|
||||
class ApplicationService : public QObject
|
||||
{
|
||||
@ -102,7 +102,7 @@ private:
|
||||
bool m_isPersistence;
|
||||
ApplicationManager1Service *m_parent{nullptr};
|
||||
QDBusObjectPath m_applicationPath;
|
||||
QString m_launcher{ApplicationLauncherBinary};
|
||||
QString m_launcher{getApplicationLauncherBinary()};
|
||||
union DesktopSource
|
||||
{
|
||||
template <typename T, std::enable_if_t<std::is_same_v<T, DesktopFile>, bool> = true>
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "instanceservice.h"
|
||||
#include "dbus/instanceservice.h"
|
||||
|
||||
InstanceService::InstanceService(QString instanceId, QString application, QString systemdUnitPath)
|
||||
: m_instanceId(std::move(instanceId))
|
||||
|
@ -2,8 +2,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "jobmanager1service.h"
|
||||
#include "jobmanager1adaptor.h"
|
||||
#include "dbus/jobmanager1service.h"
|
||||
#include "dbus/jobmanager1adaptor.h"
|
||||
|
||||
LaunchTask::LaunchTask()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <QFuture>
|
||||
#include <QUuid>
|
||||
#include "global.h"
|
||||
#include "jobadaptor.h"
|
||||
#include "dbus/jobadaptor.h"
|
||||
|
||||
class ApplicationManager1Service;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "jobservice.h"
|
||||
#include "dbus/jobservice.h"
|
||||
|
||||
JobService::JobService(const QFuture<QVariantList> &job)
|
||||
: m_job(job)
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <unistd.h>
|
||||
#include <optional>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
using IconMap = QMap<QString, QMap<uint, QMap<QString, QDBusUnixFileDescriptor>>>;
|
||||
|
||||
constexpr auto DDEApplicationManager1ServiceName = u8"org.deepin.dde.ApplicationManager1";
|
||||
@ -29,8 +31,16 @@ constexpr auto DDEApplicationManager1JobManagerObjectPath = u8"/org/deepin/dde/A
|
||||
constexpr auto DDEApplicationManager1JobObjectPath = u8"/org/deepin/dde/ApplicationManager1/JobManager1/Job/";
|
||||
constexpr auto DesktopFileEntryKey = u8"Desktop Entry";
|
||||
constexpr auto DesktopFileActionKey = u8"Desktop Action ";
|
||||
constexpr auto ApplicationLauncherBinary =
|
||||
u8"/home/heyuming/workspace/dde-application-manager/build/plugin/appLauncher/am-launcher";
|
||||
inline QString getApplicationLauncherBinary()
|
||||
{
|
||||
auto value = qgetenv("DEEPIN_APPLICATION_MANAGER_APP_LAUNCH_HELPER_BIN");
|
||||
if (value.isEmpty()) {
|
||||
return ApplicationLaunchHelperBinary;
|
||||
} else {
|
||||
qWarning() << "Using app launch helper defined in environment variable DEEPIN_APPLICATION_MANAGER_APP_LAUNCH_HELPER_BIN.";
|
||||
return value;
|
||||
}
|
||||
}
|
||||
constexpr auto ApplicationManagerDBusName = u8"deepin_application_manager_bus";
|
||||
|
||||
enum class DBusType { Session = QDBusConnection::SessionBus, System = QDBusConnection::SystemBus, Custom };
|
@ -19,7 +19,7 @@ target_include_directories(${BIN_NAME} PRIVATE
|
||||
|
||||
target_link_libraries(${BIN_NAME} PRIVATE
|
||||
GTest::gtest
|
||||
${AdaptorLib}
|
||||
dde_am_static
|
||||
)
|
||||
|
||||
target_compile_options(${BIN_NAME} PRIVATE
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "jobmanager1service.h"
|
||||
#include "dbus/jobmanager1service.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class TestJobManager : public testing::Test
|
||||
|
Loading…
Reference in New Issue
Block a user