From d256a3de2672e68ebb5c22d689488b332a293d04 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 16 Jul 2014 11:27:16 -0400 Subject: Expose additional properties in the ProductData API. Change-Id: I825deb8f44aa8e0fa2a1e89cae7a1c0c3e314073 Reviewed-by: Christian Kandeler --- src/lib/corelib/api/project.cpp | 8 ++++++++ src/lib/corelib/api/projectdata.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/lib/corelib/api/projectdata.h | 4 ++++ src/lib/corelib/api/projectdata_p.h | 4 ++++ 4 files changed, 52 insertions(+) diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index 69cb2034a..80b5f6632 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -579,7 +579,11 @@ void ProjectPrivate::retrieveProjectData(ProjectData &projectData, projectData.d->enabled = internalProject->enabled; foreach (const ResolvedProductConstPtr &resolvedProduct, internalProject->products) { ProductData product; + product.d->type = resolvedProduct->fileTags.toStringList(); product.d->name = resolvedProduct->name; + product.d->targetName = resolvedProduct->targetName; + product.d->version = resolvedProduct->productProperties + .value(QLatin1String("version")).toString(); product.d->profile = resolvedProduct->profile; product.d->location = resolvedProduct->location; product.d->isEnabled = resolvedProduct->enabled; @@ -597,8 +601,12 @@ void ProjectPrivate::retrieveProjectData(ProjectData &projectData, product.d->targetArtifacts << ta; } } + foreach (const ResolvedProductPtr &resolvedDependentProduct, resolvedProduct->dependencies) + product.d->dependencies << resolvedDependentProduct->name; + qSort(product.d->type); qSort(product.d->groups); qSort(product.d->targetArtifacts); + qSort(product.d->dependencies); product.d->isValid = true; projectData.d->products << product; } diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp index 105f144b5..6a43e363e 100644 --- a/src/lib/corelib/api/projectdata.cpp +++ b/src/lib/corelib/api/projectdata.cpp @@ -370,6 +370,22 @@ bool ProductData::isValid() const return d->isValid; } +/*! + * \brief The product type, which is the list of file tags matching the product's target artifacts. + */ +QStringList ProductData::type() const +{ + return d->type; +} + +/*! + * \brief The names of dependent products. + */ +QStringList ProductData::dependencies() const +{ + return d->dependencies; +} + /*! * \brief The name of the product as given in the qbs source file. */ @@ -378,6 +394,22 @@ QString ProductData::name() const return d->name; } +/*! + * \brief The base name of the product's target file as given in the qbs source file. + */ +QString ProductData::targetName() const +{ + return d->targetName; +} + +/*! + * \brief The version number of the product. + */ +QString ProductData::version() const +{ + return d->version; +} + /*! * \brief The profile this product will be built for. */ @@ -431,6 +463,10 @@ bool ProductData::isRunnable() const bool operator==(const ProductData &lhs, const ProductData &rhs) { return lhs.name() == rhs.name() + && lhs.targetName() == rhs.targetName() + && lhs.type() == rhs.type() + && lhs.version() == rhs.version() + && lhs.dependencies() == rhs.dependencies() && lhs.profile() == rhs.profile() && lhs.location() == rhs.location() && lhs.groups() == rhs.groups() diff --git a/src/lib/corelib/api/projectdata.h b/src/lib/corelib/api/projectdata.h index c1195e7f5..7d52ceaff 100644 --- a/src/lib/corelib/api/projectdata.h +++ b/src/lib/corelib/api/projectdata.h @@ -171,7 +171,11 @@ public: bool isValid() const; + QStringList type() const; + QStringList dependencies() const; QString name() const; + QString targetName() const; + QString version() const; QString profile() const; CodeLocation location() const; QList targetArtifacts() const; diff --git a/src/lib/corelib/api/projectdata_p.h b/src/lib/corelib/api/projectdata_p.h index 64f7a3084..13047036d 100644 --- a/src/lib/corelib/api/projectdata_p.h +++ b/src/lib/corelib/api/projectdata_p.h @@ -79,7 +79,11 @@ public: ProductDataPrivate() : isValid(false) { } + QStringList type; + QStringList dependencies; QString name; + QString targetName; + QString version; QString profile; CodeLocation location; QList groups; -- cgit v1.2.3