예제 #1
0
void SBWorkspace::queueTargets(const StringSet& targetNames, const StringSet& configNames) {
    BuildSettings bs(NULL);
    bool isInteractive = bs.getValue("VSIMPORTER_INTERACTIVE") == "YES";

    // Get the specified targets
    PotentialTargetsVec selectedTargets;
    if (isInteractive) {
        // Query the user to select targets to be queued
        selectTargets(selectedTargets);
    } else if (targetNames.empty()) {
        // Queue up all targets
        getAllTargets(selectedTargets);
    } else {
        // Try to find matching targets by name
        for (auto targetName : targetNames) {
            TargetProjectPair targetKV = findTargetWithName(targetName);
            if (targetKV.first) {
                selectedTargets.push_back(targetKV);
            }
        }
    }

    // Queue targets
    for (auto targetKV : selectedTargets) {
        SBTarget* target = targetKV.second->queueTarget(targetKV.first, &configNames);

        // Mark target as having been explicitly queued up
        if (target) {
            target->markExplicit();
        }
    }
}
예제 #2
0
void SBWorkspace::queueSchemes(const StringSet& schemeNames, const StringSet& configNames) {
    BuildSettings bs(NULL);
    bool isInteractive = bs.getValue("VSIMPORTER_INTERACTIVE") == "YES";

    // Get the specified schemes
    SchemeVec schemePtrs;
    if (schemeNames.empty()) {
        // Queue up all schemes
        schemePtrs.insert(schemePtrs.end(), m_schemes.begin(), m_schemes.end());
    } else {
        getSchemes(schemeNames, schemePtrs);
    }

    // Process all schemes
    for (auto scheme : schemePtrs) {
        // Process all build references in the scheme
        for (auto buildRef : scheme->getTargets()) {
            // Construct a path to the project specified by the BuildRef
            String projectPath = joinPaths(scheme->getContainerParentDir(), buildRef.container);

            // Find or create the project
            SBProject* targetProj = openProject(projectPath);

            // Create the target
            SBTarget* target = NULL;
            if (targetProj) {
                target = targetProj->queueTargetWithId(buildRef.id, &configNames);
            } else {
                SBLog::warning() << "Failed to open \"" << buildRef.container << "\" project referenced by \"" << scheme->getName()
                                 << "\" scheme. "
                                 << "Ignoring \"" << buildRef.targetName << "\" target." << std::endl;
            }

            // Mark target as having been explicitly queued up
            if (target) {
                target->markExplicit();
            }
        }
    }
}