aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonbuildsystem.h
blob: 76874b911717ca9020f8a8193fdbc4bdcd642217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <projectexplorer/buildsystem.h>

namespace Python::Internal {

class PythonBuildSystem final : public ProjectExplorer::BuildSystem
{
public:
    explicit PythonBuildSystem(ProjectExplorer::BuildConfiguration *buildConfig);

    bool supportsAction(ProjectExplorer::Node *context,
                        ProjectExplorer::ProjectAction action,
                        const ProjectExplorer::Node *node) const override;
    bool addFiles(ProjectExplorer::Node *,
                  const Utils::FilePaths &filePaths,
                  Utils::FilePaths *) override;
    ProjectExplorer::RemovedFilesFromProject removeFiles(ProjectExplorer::Node *,
                                                         const Utils::FilePaths &filePaths,
                                                         Utils::FilePaths *) override;
    bool deleteFiles(ProjectExplorer::Node *, const Utils::FilePaths &) override;
    bool renameFiles(
        ProjectExplorer::Node *,
        const Utils::FilePairs &filesToRename,
        Utils::FilePaths *notRenamed) override;

    void parse();
    bool save();

    bool writePyProjectFile(const Utils::FilePath &filePath, QString &content,
                            const QStringList &rawList, QString *errorMessage);

    void triggerParsing() final;

private:
    struct FileEntry {
        QString rawEntry;
        Utils::FilePath filePath;
    };
    QList<FileEntry> processEntries(const QStringList &paths) const;

    QList<FileEntry> m_files;
    QList<FileEntry> m_qmlImportPaths;
};


} // namespace Python::Internal