1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "mavenbuild.h"
6
7#include "services/builder/builderservice.h"
8#include "services/option/optionmanager.h"
9
10class MavenBuildPrivate
11{
12 friend class MavenBuild;
13};
14
15MavenBuild::MavenBuild(QObject *parent)
16 : QObject(parent)
17 , d(new MavenBuildPrivate())
18{
19
20}
21
22MavenBuild::~MavenBuild()
23{
24 if (d)
25 delete d;
26}
27
28QString MavenBuild::build(const QString& kitName, const QString& projectPath)
29{
30 QString buildUuid;
31 auto &ctx = dpfInstance.serviceContext();
32 dpfservice::BuilderService *builderService = ctx.service<dpfservice::BuilderService>(dpfservice::BuilderService::name());
33
34 if (builderService) {
35 BuildCommandInfo commandInfo;
36 commandInfo.kitName = kitName;
37 commandInfo.program = OptionManager::getInstance()->getMavenToolPath();
38 commandInfo.arguments = QStringList("compile");
39 commandInfo.workingDir = projectPath;
40
41 buildUuid = commandInfo.uuid;
42 builderService->interface.builderCommand({commandInfo}, false);
43 }
44
45 return buildUuid;
46}
47
48
49