diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-18 11:10:22 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-07-18 16:09:57 +0200 |
commit | 0ebf1bfa336b8d1fdf864925cd0cb45f0f56c572 (patch) | |
tree | 954348e80efa2d3110c79342729bf6fe2967d4d3 /src/lib/corelib/api | |
parent | cc864b59e10358aa9470a0e03b16bd507bf02033 (diff) |
API: Make the ability to update project files optional.
This is the functionality that allows callers to add files to groups
etc. Unfortunately, the QML/JS rewriter we use for this purpose pulls in
the Qt GUI module, which results in unnecessary library dependencies if
one only wants to use the command-line frontend. Therefore, allow this
feature to be compiled out.
Task-number: QBS-565
Change-Id: Ic134ff9cf37bd552ad493b388c05bcece983fd65
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/corelib/api')
-rw-r--r-- | src/lib/corelib/api/api.pri | 23 | ||||
-rw-r--r-- | src/lib/corelib/api/project.cpp | 9 | ||||
-rw-r--r-- | src/lib/corelib/api/project.h | 2 | ||||
-rw-r--r-- | src/lib/corelib/api/projectfileupdater.h | 1 |
4 files changed, 25 insertions, 10 deletions
diff --git a/src/lib/corelib/api/api.pri b/src/lib/corelib/api/api.pri index a4b9c4dd7..2bd59b5b6 100644 --- a/src/lib/corelib/api/api.pri +++ b/src/lib/corelib/api/api.pri @@ -1,27 +1,21 @@ HEADERS += \ - $$PWD/changeset.h \ $$PWD/internaljobs.h \ $$PWD/projectdata.h \ - $$PWD/projectfileupdater.h \ $$PWD/runenvironment.h \ $$PWD/jobs.h \ $$PWD/languageinfo.h \ $$PWD/project.h \ $$PWD/project_p.h \ $$PWD/propertymap_p.h \ - $$PWD/projectdata_p.h \ - $$PWD/qmljsrewriter.h + $$PWD/projectdata_p.h SOURCES += \ - $$PWD/changeset.cpp \ $$PWD/internaljobs.cpp \ - $$PWD/projectfileupdater.cpp \ $$PWD/runenvironment.cpp \ $$PWD/projectdata.cpp \ $$PWD/jobs.cpp \ $$PWD/languageinfo.cpp \ - $$PWD/project.cpp \ - $$PWD/qmljsrewriter.cpp + $$PWD/project.cpp !qbs_no_dev_install { api_headers.files = \ @@ -33,3 +27,16 @@ SOURCES += \ api_headers.path = $${QBS_INSTALL_PREFIX}/include/qbs/api INSTALLS += api_headers } + +qbs_enable_project_file_updates { + HEADERS += \ + $$PWD/changeset.h \ + $$PWD/projectfileupdater.h \ + $$PWD/qmljsrewriter.h + + SOURCES += \ + $$PWD/changeset.cpp \ + $$PWD/projectfileupdater.cpp \ + $$PWD/qmljsrewriter.cpp + DEFINES += QBS_ENABLE_PROJECT_FILE_UPDATES +} diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index 80b5f6632..c83471dbb 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -29,10 +29,13 @@ #include "project.h" #include "project_p.h" +#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES +#include "projectfileupdater.h" +#endif + #include "internaljobs.h" #include "jobs.h" #include "projectdata_p.h" -#include "projectfileupdater.h" #include "propertymap_p.h" #include "runenvironment.h" #include <buildgraph/artifact.h> @@ -242,6 +245,7 @@ GroupData ProjectPrivate::createGroupDataFromGroup(const GroupPtr &resolvedGroup return group; } +#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES void ProjectPrivate::addGroup(const ProductData &product, const QString &groupName) { if (groupName.isEmpty()) @@ -472,6 +476,7 @@ void ProjectPrivate::removeGroup(const ProductData &product, const GroupData &gr QBS_CHECK(removed); } } +#endif // QBS_ENABLE_PROJECT_FILE_UPDATES void ProjectPrivate::removeFilesFromBuildGraph(const ResolvedProductConstPtr &product, const QList<SourceArtifactPtr> &files) @@ -936,6 +941,7 @@ QSet<QString> Project::buildSystemFiles() const return d->internalProject->buildSystemFiles; } +#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES /*! * \brief Adds a new empty group to the given product. * Returns an \c ErrorInfo object for which \c hasError() is false in case of a success @@ -1021,5 +1027,6 @@ ErrorInfo Project::removeGroup(const ProductData &product, const GroupData &grou return errorInfo; } } +#endif // QBS_ENABLE_PROJECT_FILE_UPDATES } // namespace qbs diff --git a/src/lib/corelib/api/project.h b/src/lib/corelib/api/project.h index a68bbc1c0..efe6e35dc 100644 --- a/src/lib/corelib/api/project.h +++ b/src/lib/corelib/api/project.h @@ -123,12 +123,14 @@ public: QSet<QString> buildSystemFiles() const; +#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES ErrorInfo addGroup(const ProductData &product, const QString &groupName); ErrorInfo addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo removeGroup(const ProductData &product, const GroupData &group); +#endif // QBS_ENABLE_PROJECT_FILE_UPDATES private: Project(const Internal::TopLevelProjectPtr &internalProject, const Internal::Logger &logger); diff --git a/src/lib/corelib/api/projectfileupdater.h b/src/lib/corelib/api/projectfileupdater.h index 2ff1566ce..552ae9149 100644 --- a/src/lib/corelib/api/projectfileupdater.h +++ b/src/lib/corelib/api/projectfileupdater.h @@ -134,5 +134,4 @@ private: } // namespace Internal } // namespace qbs - #endif // Include guard. |