VCSharedProject::VCSharedProject(VSTemplateProject* projTemplate) : VCProject(projTemplate) { m_sharedId = sole::uuid4().str(); m_globalProps.clear(); m_globalProps["ItemsProjectGuid"] = formatVSGUID(m_id); m_globalProps["SharedGUID"] = formatVSGUID(m_sharedId); }
void VSSolution::writeNestedProjects(std::ostream& out) const { out << "\t" << "GlobalSection(NestedProjects) = preSolution" << std::endl; for (auto project : m_nestingMap) { if (project.first) { std::string childId = formatVSGUID(project.second->getId()); std::string parentId = formatVSGUID(project.first->getId()); out << "\t\t" << childId << " = " << parentId << std::endl; } } out << "\t" << "EndGlobalSection" << std::endl; }
void VSBuildableSolutionProject::writeSharedProjects(std::ostream& out) const { if (m_project->getSubType() == VCShared) { out << "\t\t" << getPath() << "*" << formatVSGUID(m_project->getId()) << "*SharedItemsImports = 9" << std::endl; } else { for (auto sproj : m_project->getSharedProjects()) { VSBuildableSolutionProject* solutionProj = m_parent.findBuildableProject(sproj->getPath()); if (solutionProj) { out << "\t\t" << solutionProj->getPath() << "*" << formatVSGUID(m_project->getId()) << "*SharedItemsImports = 4" << std::endl; } } } }
VCProject::VCProject(VSTemplateProject* projTemplate, const std::string& id) : m_template(projTemplate) { sbAssert(projTemplate); sbAssert(isAbsolutePath(projTemplate->getPath())); // Determine subtype (shared or not) m_subType = projTemplate->isShared() ? VCShared : VCNone; // TODO: validate passed in id if (!id.empty()) m_id = id; else m_id = sole::uuid4().str(); string guid = formatVSGUID(m_id); if (m_subType == VCShared) { TELEMETRY_EVENT_GUID(L"VSImporterSharedProjectGuid", guid); } else { TELEMETRY_EVENT_GUID(L"VSImporterProjectGuid", guid); } addGlobalProperty("ProjectGuid", guid); }
void VSSolution::writeProjectConfigurationPlatforms(std::ostream& out) const { out << "\t" << "GlobalSection(ProjectConfigurationPlatforms) = postSolution" << std::endl; for (auto project : m_buildableProjects) { std::string projId = formatVSGUID(project.second->getId()); // Keeping for now - will be phased out once we get enough traction on project tracking for // solution folder, shared project, standard project TELEMETRY_EVENT_GUID(L"VSImporterNewProject", projId); // Ignore shared projects if (project.second->getProject()->getSubType() == VCShared) continue; bool isDeployable = project.second->getProject()->isDeployable(); for (auto config : m_configurations) { for (auto platform : m_platforms) { std::string projConfig = project.second->getMappedConfiguration(config); std::string projPlatform = project.second->getMappedPlatform(platform); out << "\t\t" << projId << "." << config << "|" << platform << ".ActiveCfg = " << projConfig << "|" << projPlatform << std::endl; out << "\t\t" << projId << "." << config << "|" << platform << ".Build.0 = " << projConfig << "|" << projPlatform << std::endl; if (isDeployable) { out << "\t\t" << projId << "." << config << "|" << platform << ".Deploy.0 = " << projConfig << "|" << projPlatform << std::endl; } } } } out << "\t" << "EndGlobalSection" << std::endl; }
void VCProject::writeProjectReferences(pugi::xml_node& node) const { std::string projectPath = getPath(); std::string projectDir = sb_dirname(projectPath); for (auto dep : m_projectRefs) { std::string depGUID = formatVSGUID(dep->getId()); std::string depRelativePath = getRelativePath(projectDir, dep->getPath()); pugi::xml_node projRef = node.append_child("ProjectReference"); projRef.append_attribute("Include") = depRelativePath.c_str(); appendNodeWithText(projRef, "Project", depGUID); } }
void VSBuildableSolutionProject::writeProjectDependencies(std::ostream& out) const { const VCProjectSet& refs = m_project->getProjectReferences(); if (refs.empty()) return; out << "\t" << "ProjectSection(ProjectDependencies) = postProject" << std::endl; for (auto dep : refs) { std::string depProjId = formatVSGUID(dep->getId()); out << "\t\t" << depProjId << " = " << depProjId << std::endl; } out << "\t" << "EndProjectSection" << std::endl; }
void VCProject::writeFilterDescriptions(pugi::xml_node& node) const { StringSet filters; for (auto item : m_items) { recordFilterPath(item->getFilterPath(), filters); } pugi::xml_node tempNode = node.parent().append_child("Temp"); for (auto filter : filters) { // Generate a unique id std::string id = sole::uuid4().str(); // Fix up the filter path to be Windows-style std::string winFilterPath = winPath(filter); // Create a filter description node pugi::xml_node filterDesc = tempNode.append_child("Filter"); filterDesc.append_attribute("Include") = winFilterPath.c_str(); appendNodeWithText(filterDesc, "UniqueIdentifier", formatVSGUID(id)); } mergeNodes(node, tempNode); }
VSSolutionFolderProject::VSSolutionFolderProject(const std::string& name, VSSolution& parent) : VSSolutionProject(parent), m_name(name) { m_id = sole::uuid4().str(); std::string guid = formatVSGUID(m_id); TELEMETRY_EVENT_GUID(L"VSImporterSolutionFolderGuid", guid); }