[QBS] Problem with retrieving artifacts in generator.

mapron mapron at yandex.ru
Sat Aug 2 09:48:12 CEST 2014



i am started to rewrite MSVS generator.

1) I've checked out   https://codereview.qt-project.org/#/c/89972/13
2) compiled qbs, set up toolchains and qt profiles;
3) from <qbs>/bin path executing command:
>qbs generate -g MSVS2010 -f ../qbs.qbs profile:qt4 release debug
4)
 I use such test code in MsvsGenerator:

static QString buildVariant(const qbs::Project &project) 
{
    return project.projectConfiguration()
        [QLatin1String("qbs")].toMap()
        [QLatin1String("buildVariant")].toString();
}
void MsvsGenerator::generate()
{
    foreach (const Project& project, projects()){
        qDebug() << "project file location:" << project.projectData().location().filePath();
        qDebug() << "build variant:" << buildVariant(project);
        qDebug() << "profile:" << project.profile();
        foreach (const ProductData& pd, project.projectData().allProducts() ) {
            qDebug() << "product:" << pd.name() << pd.location().filePath() << pd.targetName()
                     << " targetsCount:" << pd.targetArtifacts().size();
            foreach (const GroupData& gd, pd.groups()){
                // properties are empty, nothing intresting.
                // qDebug() << "group:" << gd.properties().allProperties();
            }
        }
    }
}

I've noticed:
a) When running command line, sometimes it crashes (only release mode, so i could n't provide more info). When i passed only one configuration (one variant and profile), it doesn't.
b) targetCount is always zero. So i could not determine destination or installation directories, how to do this? it's important to debugger (qbs run command not suitable).
c)  we can only fetch filePaths, not their tags. That's why we have to duplicate "filters/tags" logic. It's undesirable.
d) how could i get additional options from user? e.g.:
-generated solution destination path, and maybe filename;
-generated projects output directory;
-version of MSVC toolchain, project format version and various "v120_xp" suffixes and variations... for now i determine that by different generator names. Is it ok to return over 9000 kind of ProjectGenerator objects?

e) xcode and msvs generators created as static variable in heap of dll.
static qbs::ProjectGenerator* generators[] = { new qbs::XcodeNativeGenerator(),	 ...
then it returned as pointer...  all generators placed as pointers in m_generators. Seems valid at this point.
Then in generate() command-line method, it placed in scoped pointer, which remove ONE of that generators... is it correct? maybe we should delete all such objects?
i wondered just because when i created Generator object as plain static object (no heap), it caused heap corruption.




More information about the Qbs mailing list