Changeset View
Changeset View
Standalone View
Standalone View
buildsystem/builder.cpp
- This file was added.
1 | /* KDevelop go build support | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright 2017 Mikhail Ivchenko <ematirov@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU General Public License | ||||
7 | * as published by the Free Software Foundation; either version 2 | ||||
8 | * of the License, or (at your option) any later version. | ||||
9 | */ | ||||
10 | | ||||
11 | #include "builder.h" | ||||
12 | | ||||
13 | #include <interfaces/iproject.h> | ||||
14 | #include <project/projectmodel.h> | ||||
15 | #include <project/interfaces/ibuildsystemmanager.h> | ||||
16 | #include <outputview/outputexecutejob.h> | ||||
17 | | ||||
18 | #include "buildjob.h" | ||||
19 | | ||||
20 | KJob* GoBuilder::build( KDevelop::ProjectBaseItem *item ) | ||||
21 | { | ||||
22 | return createJobForAction(item, QStringLiteral("build")); | ||||
23 | } | ||||
24 | | ||||
25 | KJob* GoBuilder::clean( KDevelop::ProjectBaseItem *item ) | ||||
26 | { | ||||
27 | return createJobForAction(item, QStringLiteral("clean")); | ||||
28 | } | ||||
29 | | ||||
30 | KJob* GoBuilder::install(KDevelop::ProjectBaseItem *item, const QUrl &installPath) | ||||
31 | { | ||||
32 | Q_UNUSED(installPath) | ||||
33 | return createJobForAction(item, QStringLiteral("install")); | ||||
34 | } | ||||
35 | | ||||
36 | KJob* GoBuilder::createJobForAction(KDevelop::ProjectBaseItem *item, const QString &action) const | ||||
37 | { | ||||
38 | auto bsm = item->project()->buildSystemManager(); | ||||
39 | auto buildDir = bsm->buildDirectory(item); | ||||
40 | auto job = new GoBuildJob(nullptr, action, buildDir.toUrl()); | ||||
41 | job->setWorkingDirectory(buildDir.toUrl()); | ||||
42 | return job; | ||||
43 | } |