File indexing completed on 2024-05-05 04:39:50

0001 /*
0002     SPDX-FileCopyrightText: 2017 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef FLATPAKRUNTIME_H
0008 #define FLATPAKRUNTIME_H
0009 
0010 #include <interfaces/iruntime.h>
0011 #include <util/path.h>
0012 
0013 class KJob;
0014 class FlatpakPlugin;
0015 
0016 class FlatpakRuntime : public KDevelop::IRuntime
0017 {
0018     Q_OBJECT
0019 public:
0020     FlatpakRuntime(const KDevelop::Path &buildDirectory, const KDevelop::Path &file, const QString &arch);
0021     ~FlatpakRuntime() override;
0022 
0023     QString name() const override;
0024 
0025     void setEnabled(bool enabled) override;
0026 
0027     void startProcess(KProcess *process) const override;
0028     void startProcess(QProcess *process) const override;
0029     KDevelop::Path pathInHost(const KDevelop::Path & runtimePath) const override;
0030     KDevelop::Path pathInRuntime(const KDevelop::Path & localPath) const override;
0031     QString findExecutable(const QString& executableName) const override;
0032     QByteArray getenv(const QByteArray &varname) const override;
0033 
0034     static KJob* createBuildDirectory(const KDevelop::Path &path, const KDevelop::Path &file, const QString &arch);
0035 
0036     KJob* rebuild();
0037     QList<KJob*> exportBundle(const QString &path) const;
0038     KJob* executeOnDevice(const QString &host, const QString &path) const;
0039 
0040     static QJsonObject config(const KDevelop::Path& path);
0041     KDevelop::Path buildPath() const override;
0042 
0043 private:
0044     void refreshJson();
0045     QJsonObject config() const;
0046 
0047     const KDevelop::Path m_file;
0048     const KDevelop::Path m_buildDirectory;
0049     const QString m_arch;
0050     QStringList m_finishArgs;
0051     KDevelop::Path m_sdkPath;
0052 };
0053 
0054 #endif