⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proj_tree_builder.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
        string name  = (*i)->GetName();        if ( name == "."  ||  name == ".."  ||               name == string(1,CDir::GetPathSeparator()) ) {            continue;        }        string path = (*i)->GetPath();        if ( (*i)->IsFile()  &&               !is_root        &&               filter->CheckProject(CDirEntry(path).GetDir()) ) {            if ( SMakeProjectT::IsMakeInFile(name) )	            ProcessMakeInFile(path, makefiles);            else if ( SMakeProjectT::IsMakeLibFile(name) )	            ProcessMakeLibFile(path, makefiles);            else if ( SMakeProjectT::IsMakeAppFile(name) )	            ProcessMakeAppFile(path, makefiles);            else if ( SMakeProjectT::IsUserProjFile(name) )	            ProcessUserProjFile(path, makefiles);        }         else if ( (*i)->IsDir() ) {            ProcessDir(path, false, filter, makefiles);        }    }#endif#if 0    // Node - Makefile.in should present    string node_path =         CDirEntry::ConcatPath(dir_name,                               GetApp().GetProjectTreeInfo().m_TreeNode);    if ( !CDirEntry(node_path).Exists() )        return;        bool process_projects = !is_root && filter->CheckProject(dir_name);        // Process Makefile.*.lib    if ( process_projects ) {        CDir dir(dir_name);        CDir::TEntries contents = dir.GetEntries("Makefile.*.lib");        ITERATE(CDir::TEntries, p, contents) {            const AutoPtr<CDirEntry>& dir_entry = *p;            if ( SMakeProjectT::IsMakeLibFile(dir_entry->GetName()) )	            ProcessMakeLibFile(dir_entry->GetPath(), makefiles);        }    }    // Process Makefile.*.app    if ( process_projects ) {        CDir dir(dir_name);        CDir::TEntries contents = dir.GetEntries("Makefile.*.app");        ITERATE(CDir::TEntries, p, contents) {            const AutoPtr<CDirEntry>& dir_entry = *p;            if ( SMakeProjectT::IsMakeAppFile(dir_entry->GetName()) )	            ProcessMakeAppFile(dir_entry->GetPath(), makefiles);        }    }    // Process Makefile.*.msvcproj    if ( process_projects ) {        CDir dir(dir_name);        CDir::TEntries contents = dir.GetEntries("Makefile.*.msvcproj");        ITERATE(CDir::TEntries, p, contents) {            const AutoPtr<CDirEntry>& dir_entry = *p;            if ( SMakeProjectT::IsUserProjFile(dir_entry->GetName()) )	            ProcessUserProjFile(dir_entry->GetPath(), makefiles);        }    }    // Process Makefile.in    list<string> subprojects;    if ( process_projects ) {        ProcessMakeInFile(node_path, makefiles);        TFiles::const_iterator p = makefiles->m_In.find(node_path);        const CSimpleMakeFileContents& makefile = p->second;        //         CSimpleMakeFileContents::TContents::const_iterator k =             makefile.m_Contents.find("SUB_PROJ");        if (k != makefile.m_Contents.end()) {            const list<string>& values = k->second;            copy(values.begin(),                  values.end(),                  back_inserter(subprojects));        }        k = makefile.m_Contents.find("EXPENDABLE_SUB_PROJ");        if (k != makefile.m_Contents.end()) {            const list<string>& values = k->second;            copy(values.begin(),                  values.end(),                  back_inserter(subprojects));        }    }    subprojects.sort();    subprojects.unique();    // Convert subprojects to subdirs    list<string> subprojects_dirs;    if ( is_root ) {        // for root node we'll take all subdirs        CDir dir(dir_name);        CDir::TEntries contents = dir.GetEntries("*");        ITERATE(CDir::TEntries, p, contents) {            const AutoPtr<CDirEntry>& dir_entry = *p;            string name  = dir_entry->GetName();            if ( name == "."  ||  name == ".."  ||                   name == string(1,CDir::GetPathSeparator()) ) {                continue;            }            if ( dir_entry->IsDir() ) {                subprojects_dirs.push_back(dir_entry->GetPath());            }        }    } else {        // for non-root only subprojects        ITERATE(list<string>, p, subprojects) {            const string& subproject = *p;            string subproject_dir =                 CDirEntry::ConcatPath(dir_name, subproject);            subprojects_dirs.push_back(subproject_dir);        }    }    // Process subproj ( e.t. subdirs )    ITERATE(list<string>, p, subprojects_dirs) {        const string& subproject_dir = *p;        ProcessDir(subproject_dir, false, filter, makefiles);    }#endif}void CProjectTreeBuilder::ProcessMakeInFile(const string& file_name,                                             SMakeFiles*   makefiles){    LOG_POST(Info << "Processing MakeIn: " + file_name);    CSimpleMakeFileContents fc(file_name);    if ( !fc.m_Contents.empty() )	    makefiles->m_In[file_name] = fc;}void CProjectTreeBuilder::ProcessMakeLibFile(const string& file_name,                                              SMakeFiles*   makefiles){    LOG_POST(Info << "Processing MakeLib: " + file_name);    CSimpleMakeFileContents fc(file_name);    if ( !fc.m_Contents.empty() )	    makefiles->m_Lib[file_name] = fc;}void CProjectTreeBuilder::ProcessMakeAppFile(const string& file_name,                                              SMakeFiles*   makefiles){    LOG_POST(Info << "Processing MakeApp: " + file_name);    CSimpleMakeFileContents fc(file_name);    if ( !fc.m_Contents.empty() )	    makefiles->m_App[file_name] = fc;}void CProjectTreeBuilder::ProcessUserProjFile(const string& file_name,                                              SMakeFiles*   makefiles){    LOG_POST(Info << "Processing MakeApp: " + file_name);    CSimpleMakeFileContents fc(file_name);    if ( !fc.m_Contents.empty() )	    makefiles->m_User[file_name] = fc;}//recursive resolvingvoid CProjectTreeBuilder::ResolveDefs(CSymResolver& resolver,                                       SMakeFiles&   makefiles){    {{        //App        set<string> keys;        keys.insert("LIB");        keys.insert("LIBS");        keys.insert("NCBI_C_LIBS");        SMakeProjectT::DoResolveDefs(resolver, makefiles.m_App, keys);    }}    {{        //Lib        set<string> keys;        keys.insert("LIBS");        SMakeProjectT::DoResolveDefs(resolver, makefiles.m_Lib, keys);    }}}//analyze modulesvoid s_CollectDatatoolIds(const CProjectItemsTree& tree,                          map<string, CProjKey>*   datatool_ids){    ITERATE(CProjectItemsTree::TProjects, p, tree.m_Projects) {        const CProjKey&  project_id = p->first;        const CProjItem& project    = p->second;        ITERATE(list<CDataToolGeneratedSrc>, n, project.m_DatatoolSources) {            const CDataToolGeneratedSrc& src = *n;            string src_abs_path =                 CDirEntry::ConcatPath(src.m_SourceBaseDir, src.m_SourceFile);            string src_rel_path =                 CDirEntry::CreateRelativePath                                 (GetApp().GetProjectTreeInfo().m_Src,                                   src_abs_path);            (*datatool_ids)[src_rel_path] = project_id;        }    }}void CProjectTreeBuilder::AddDatatoolSourcesDepends(CProjectItemsTree* tree){    //datatool src rel path / project ID    // 1. Collect all projects with datatool-generated-sources    map<string, CProjKey> whole_datatool_ids;    s_CollectDatatoolIds(GetApp().GetWholeTree(), &whole_datatool_ids);    // 2. Extent tree to accomodate more ASN projects if necessary    bool tree_extented = false;    map<string, CProjKey> datatool_ids;    do {                tree_extented = false;        s_CollectDatatoolIds(*tree, &datatool_ids);        NON_CONST_ITERATE(CProjectItemsTree::TProjects, p, tree->m_Projects) {            const CProjKey&  project_id = p->first;            CProjItem& project          = p->second;            ITERATE(list<CDataToolGeneratedSrc>, n, project.m_DatatoolSources) {                const CDataToolGeneratedSrc& src = *n;                ITERATE(list<string>, i, src.m_ImportModules) {                    const string& module = *i;                    map<string, CProjKey>::const_iterator j =                         datatool_ids.find(module);                    if (j == datatool_ids.end()) {                        j = whole_datatool_ids.find(module);                        if (j != whole_datatool_ids.end()) {                            const CProjKey& depends_id = j->second;                            tree->m_Projects[depends_id] =                                 GetApp().GetWholeTree().m_Projects.find(depends_id)->second;                            tree_extented = true;                        }                    }                }            }        }    } while( tree_extented );    // 3. Finally - generate depends    NON_CONST_ITERATE(CProjectItemsTree::TProjects, p, tree->m_Projects) {        const CProjKey&  project_id = p->first;        CProjItem& project          = p->second;        ITERATE(list<CDataToolGeneratedSrc>, n, project.m_DatatoolSources) {            const CDataToolGeneratedSrc& src = *n;            ITERATE(list<string>, i, src.m_ImportModules) {                const string& module = *i;                map<string, CProjKey>::const_iterator j =                     datatool_ids.find(module);                if (j != datatool_ids.end()) {                    const CProjKey& depends_id = j->second;                    if (depends_id != project_id) {                        project.m_Depends.push_back(depends_id);                        project.m_Depends.sort();                        project.m_Depends.unique();                    }                }            }        }    }}END_NCBI_SCOPE/* * =========================================================================== * $Log: proj_tree_builder.cpp,v $ * Revision 1000.3  2004/06/16 17:02:39  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * * Revision 1.13  2004/06/16 16:29:11  gorelenk * Changed directories traversing proc. * * Revision 1.12  2004/06/16 14:26:05  gorelenk * Re-designed CProjectTreeBuilder::ProcessDir . * * Revision 1.11  2004/06/15 14:14:31  gorelenk * Changed CProjectTreeBuilder::ProcessDir - changed procedure of * subdirs iteration . * * Revision 1.10  2004/06/14 18:57:59  gorelenk * Changed CProjectTreeBuilder::ProcessDir * - added support of EXPENDABLE_SUB_PROJ . * * Revision 1.9  2004/06/14 14:18:21  gorelenk * Changed CProjectTreeBuilder::ProcessDir - added SUB_PROJ processing. * * Revision 1.8  2004/05/21 21:41:41  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.7  2004/05/13 14:55:35  gorelenk * Changed SMakeProjectT::CreateIncludeDirs . * * Revision 1.6  2004/05/10 19:50:42  gorelenk * Implemented SMsvcProjectT . * * Revision 1.5  2004/04/06 17:15:47  gorelenk * Implemented member-functions IsConfigurableDefine and * StripConfigurableDefine of struct SMakeProjectT. * Changed implementations of SMakeProjectT::DoResolveDefs * SMakeProjectT::Create3PartyLibs and SAppProjectT::CreateNcbiCToolkitLibs. * * Revision 1.4  2004/03/23 14:41:50  gorelenk * Changed implementations of CProjectTreeBuilder::AddDatatoolSourcesDepends * and CProjectTreeBuilder::BuildProjectTree. * * Revision 1.3  2004/03/16 23:53:14  gorelenk * Changed implementations of: * SAppProjectT::DoCreate and * SAppProjectT::CreateNcbiCToolkitLibs . * * Revision 1.2  2004/03/04 23:31:10  gorelenk * Added call to AddDatatoolSourcesDepends in implementation of * CProjectTreeBuilder::BuildProjectTree. * * Revision 1.1  2004/03/02 16:23:57  gorelenk * Initial revision. * * =========================================================================== */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -