├── .devcontainer └── devcontainer.json ├── .github ├── dependabot.yml ├── scripts │ └── ubuntu-22.04 │ │ ├── compile_build.sh │ │ ├── download_build.sh │ │ ├── postcompile_build.sh │ │ ├── setup_build.sh │ │ ├── setup_postgresql.sh │ │ └── setup_sqlite3.sh └── workflows │ ├── ci.yml │ ├── codeql.yml │ ├── docker.yml │ ├── linting.yml │ ├── scorecard.yml │ └── tarball.yml ├── .gitignore ├── .gitlab ├── README.md ├── build-codecompass.sh ├── build-deps.sh ├── cc-env.sh └── ci.yml ├── .idea └── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── CMakeLists.txt ├── Config.cmake ├── Exports.cmake ├── FindODB.cmake ├── FindOpenLdap.cmake ├── FindThrift.cmake ├── Functions.cmake ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── Testing.cmake ├── doc ├── authentication.md ├── coding_conventions.md ├── deps.md ├── images │ └── docker.jpg ├── logo │ ├── logo.png │ └── logo.svg ├── lsp.md ├── usage.md └── webgui.md ├── docker ├── README.md ├── dev │ ├── Dockerfile │ ├── codecompass-build.sh │ └── install_odb.sh ├── runtime │ └── Dockerfile └── web │ ├── Dockerfile │ └── entrypoint.sh ├── lib └── java │ ├── httpclient-4.5.6.jar │ ├── httpcore-4.4.10.jar │ ├── javax.annotation-api-1.3.2.jar │ ├── libthrift-0.16.0.jar │ ├── log4j-1.2.17.jar │ ├── slf4j-api-1.7.25.jar │ └── slf4j-log4j12-1.7.25.jar ├── logger ├── CMakeLists.txt └── src │ ├── ldlogger-hooks.c │ ├── ldlogger-hooks.h │ ├── ldlogger-logger.c │ ├── ldlogger-tool-gcc.c │ ├── ldlogger-tool-javac.c │ ├── ldlogger-tool.c │ ├── ldlogger-tool.h │ ├── ldlogger-util.c │ └── ldlogger-util.h ├── model ├── CMakeLists.txt └── include │ └── model │ ├── buildaction.h │ ├── buildlog.h │ ├── buildsourcetarget.h │ ├── file.h │ ├── filecontent.h │ ├── fileloc.h │ ├── position.h │ └── statistics.h ├── parser ├── CMakeLists.txt ├── include │ └── parser │ │ ├── abstractparser.h │ │ ├── parsercontext.h │ │ ├── pluginhandler.h │ │ └── sourcemanager.h └── src │ ├── parser.cpp │ ├── parsercontext.cpp │ ├── pluginhandler.cpp │ └── sourcemanager.cpp ├── plugins ├── CMakeLists.txt ├── cpp │ ├── CMakeLists.txt │ ├── model │ │ ├── CMakeLists.txt │ │ └── include │ │ │ └── model │ │ │ ├── common.h │ │ │ ├── cppastnode.h │ │ │ ├── cppdoccomment.h │ │ │ ├── cppedge.h │ │ │ ├── cppentity.h │ │ │ ├── cppenum.h │ │ │ ├── cppfriendship.h │ │ │ ├── cppfunction.h │ │ │ ├── cppheaderinclusion.h │ │ │ ├── cppinheritance.h │ │ │ ├── cppmacro.h │ │ │ ├── cppmacroexpansion.h │ │ │ ├── cppnamespace.h │ │ │ ├── cppnamespacealias.h │ │ │ ├── cpprecord.h │ │ │ ├── cpprelation.h │ │ │ ├── cpptypedef.h │ │ │ └── cppvariable.h │ ├── parser │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── cppparser │ │ │ │ ├── cppparser.h │ │ │ │ └── filelocutil.h │ │ └── src │ │ │ ├── clangastvisitor.h │ │ │ ├── cppparser.cpp │ │ │ ├── diagnosticmessagehandler.cpp │ │ │ ├── diagnosticmessagehandler.h │ │ │ ├── doccommentcollector.h │ │ │ ├── doccommentformatter.cpp │ │ │ ├── doccommentformatter.h │ │ │ ├── entitycache.cpp │ │ │ ├── entitycache.h │ │ │ ├── nestedscope.cpp │ │ │ ├── nestedscope.h │ │ │ ├── ppincludecallback.cpp │ │ │ ├── ppincludecallback.h │ │ │ ├── ppmacrocallback.cpp │ │ │ ├── ppmacrocallback.h │ │ │ ├── relationcollector.cpp │ │ │ ├── relationcollector.h │ │ │ ├── symbolhelper.cpp │ │ │ └── symbolhelper.h │ ├── service │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── service │ │ │ │ └── cppservice.h │ │ └── src │ │ │ ├── cppservice.cpp │ │ │ ├── diagram.cpp │ │ │ ├── diagram.h │ │ │ ├── filediagram.cpp │ │ │ ├── filediagram.h │ │ │ └── plugin.cpp │ ├── test │ │ ├── CMakeLists.txt │ │ ├── sources │ │ │ ├── parser │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── cxxrecord.cpp │ │ │ │ ├── enum.cpp │ │ │ │ ├── function.cpp │ │ │ │ ├── namespace.cpp │ │ │ │ ├── typedef.cpp │ │ │ │ ├── using.cpp │ │ │ │ └── variable.cpp │ │ │ └── service │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── inheritance.cpp │ │ │ │ ├── inheritance.h │ │ │ │ ├── nestedclass.cpp │ │ │ │ ├── nestedclass.h │ │ │ │ ├── simpleclass.cpp │ │ │ │ └── simpleclass.h │ │ └── src │ │ │ ├── cppparsertest.cpp │ │ │ ├── cpppropertiesservicetest.cpp │ │ │ ├── cppreferenceservicetest.cpp │ │ │ ├── cpptest.cpp │ │ │ ├── servicehelper.cpp │ │ │ └── servicehelper.h │ └── webgui │ │ ├── images │ │ ├── cpp_collaboration_diagram.png │ │ ├── cpp_detailed_class_diagram.png │ │ └── cpp_function_call_diagram.png │ │ ├── js │ │ ├── cppDiagram.js │ │ ├── cppInfoTree.js │ │ └── cppMenu.js │ │ └── userguide │ │ └── userguide.md ├── cpp_lsp │ ├── CMakeLists.txt │ └── service │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── cpplspservice │ │ │ └── cpplspservice.h │ │ └── src │ │ ├── cpplspservice.cpp │ │ └── plugin.cpp ├── cpp_metrics │ ├── CMakeLists.txt │ ├── model │ │ ├── CMakeLists.txt │ │ └── include │ │ │ └── model │ │ │ ├── cppastnodemetrics.h │ │ │ ├── cppcohesionmetrics.h │ │ │ ├── cppfilemetrics.h │ │ │ └── cpptypedependencymetrics.h │ ├── parser │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── cppmetricsparser │ │ │ │ └── cppmetricsparser.h │ │ └── src │ │ │ └── cppmetricsparser.cpp │ ├── service │ │ ├── CMakeLists.txt │ │ ├── cxxmetrics.thrift │ │ ├── include │ │ │ └── service │ │ │ │ └── cppmetricsservice.h │ │ └── src │ │ │ ├── cppmetricsservice.cpp │ │ │ └── plugin.cpp │ └── test │ │ ├── CMakeLists.txt │ │ ├── sources │ │ ├── parser │ │ │ ├── CMakeLists.txt │ │ │ ├── afferentcoupling.cpp │ │ │ ├── bumpyroad.cpp │ │ │ ├── functionmccabe.cpp │ │ │ ├── lackofcohesion.cpp │ │ │ ├── module_a │ │ │ │ ├── a1.h │ │ │ │ └── a2.h │ │ │ ├── module_b │ │ │ │ ├── b1.h │ │ │ │ └── b2.h │ │ │ ├── module_c │ │ │ │ ├── c1.h │ │ │ │ └── c2.h │ │ │ ├── module_d │ │ │ │ └── d1.h │ │ │ ├── modulemetrics.cpp │ │ │ ├── rc_module_a │ │ │ │ ├── a1.h │ │ │ │ ├── a2.h │ │ │ │ └── a3.h │ │ │ ├── rc_module_b │ │ │ │ └── b1.h │ │ │ ├── rc_module_c │ │ │ │ ├── c1.h │ │ │ │ ├── c2.h │ │ │ │ ├── c3.h │ │ │ │ └── c4.h │ │ │ ├── typemccabe.cpp │ │ │ └── typemccabe.h │ │ └── service │ │ │ ├── CMakeLists.txt │ │ │ ├── bumpyroad.cpp │ │ │ ├── functionmccabe.cpp │ │ │ ├── lackofcohesion.cpp │ │ │ ├── typemccabe.cpp │ │ │ └── typemccabe.h │ │ └── src │ │ ├── cppmetricsparsertest.cpp │ │ ├── cppmetricsservicetest.cpp │ │ └── cppmetricstest.cpp ├── cpp_reparse │ ├── CMakeLists.txt │ ├── service │ │ ├── CMakeLists.txt │ │ ├── cppreparse.thrift │ │ ├── include │ │ │ └── service │ │ │ │ ├── cppreparseservice.h │ │ │ │ └── reparser.h │ │ └── src │ │ │ ├── astcache.cpp │ │ │ ├── astcache.h │ │ │ ├── asthtml.cpp │ │ │ ├── asthtml.h │ │ │ ├── astnodelocator.h │ │ │ ├── cppreparseservice.cpp │ │ │ ├── databasefilesystem.cpp │ │ │ ├── databasefilesystem.h │ │ │ ├── plugin.cpp │ │ │ └── reparser.cpp │ └── webgui │ │ └── js │ │ ├── cppReparseFileAST.js │ │ └── cppReparseMenu.js ├── dummy │ ├── CMakeLists.txt │ ├── parser │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── dummyparser │ │ │ │ └── dummyparser.h │ │ └── src │ │ │ └── dummyparser.cpp │ ├── scripts │ │ └── client.py │ ├── service │ │ ├── CMakeLists.txt │ │ ├── dummy.thrift │ │ ├── include │ │ │ └── service │ │ │ │ └── dummyservice.h │ │ └── src │ │ │ ├── dummyservice.cpp │ │ │ └── plugin.cpp │ └── test │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── dummyparsertest.cpp │ │ └── dummyservicetest.cpp ├── git │ ├── CMakeLists.txt │ ├── FindLibGit2.cmake │ ├── parser │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── gitparser │ │ │ │ └── gitparser.h │ │ └── src │ │ │ └── gitparser.cpp │ ├── service │ │ ├── CMakeLists.txt │ │ ├── git.thrift │ │ ├── include │ │ │ └── service │ │ │ │ └── gitservice.h │ │ └── src │ │ │ ├── gitservice.cpp │ │ │ └── plugin.cpp │ └── webgui │ │ ├── css │ │ └── git.css │ │ └── js │ │ ├── GitDiff.js │ │ ├── gitBlame.js │ │ ├── gitCommitView.js │ │ ├── gitMenu.js │ │ ├── gitNavigator.js │ │ └── gitUtil.js ├── metrics │ ├── CMakeLists.txt │ ├── model │ │ ├── CMakeLists.txt │ │ └── include │ │ │ └── model │ │ │ └── metrics.h │ ├── parser │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── metricsparser │ │ │ │ └── metricsparser.h │ │ └── src │ │ │ └── metricsparser.cpp │ ├── service │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── metricsservice │ │ │ │ └── metricsservice.h │ │ ├── metrics.thrift │ │ └── src │ │ │ ├── metricsservice.cpp │ │ │ └── plugin.cpp │ └── webgui │ │ ├── images │ │ └── metrics.png │ │ ├── js │ │ └── metrics.js │ │ └── userguide │ │ └── userguide.md └── search │ ├── CMakeLists.txt │ ├── common │ ├── CMakeLists.txt │ └── src │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ └── cc │ │ └── search │ │ ├── analysis │ │ ├── LineInformations.java │ │ ├── Location.java │ │ ├── SourceTextAnalyzer.java │ │ ├── SourceTextTokenizer.java │ │ └── tags │ │ │ ├── Tag.java │ │ │ └── Tags.java │ │ └── common │ │ ├── FileLoggerInitializer.java │ │ ├── IndexFields.java │ │ ├── NFSFriendlyLockFactory.java │ │ ├── SuggestionDatabase.java │ │ ├── config │ │ ├── CommonOptions.java │ │ ├── InvalidValueException.java │ │ ├── LogConfigurator.java │ │ └── UnknownArgumentException.java │ │ └── ipc │ │ └── IPCProcessor.java │ ├── indexer │ ├── CMakeLists.txt │ ├── include │ │ └── indexer │ │ │ └── indexerprocess.h │ ├── indexer-java │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ │ └── cc │ │ │ └── search │ │ │ ├── analysis │ │ │ ├── MonoTokenizer.java │ │ │ ├── SourceAnalyzer.java │ │ │ └── tags │ │ │ │ ├── CTags.java │ │ │ │ ├── SourceTagGenerator.java │ │ │ │ ├── TagGenerator.java │ │ │ │ ├── TagGeneratorManager.java │ │ │ │ └── TagStream.java │ │ │ ├── indexer │ │ │ ├── AbstractIndexer.java │ │ │ ├── Context.java │ │ │ ├── FieldReIndexer.java │ │ │ ├── FileIndexer.java │ │ │ ├── IndexerTask.java │ │ │ ├── app │ │ │ │ ├── Indexer.java │ │ │ │ └── Options.java │ │ │ └── util │ │ │ │ └── IOHelper.java │ │ │ └── suggestion │ │ │ ├── DatabaseBuilder.java │ │ │ ├── DocumentIterator.java │ │ │ ├── TagInputIterator.java │ │ │ └── UniqueInputIterator.java │ ├── searchindexer.thrift │ └── src │ │ └── indexerprocess.cpp │ ├── lib │ └── java │ │ ├── lucene-analyzers-common-4.9.0.jar │ │ ├── lucene-core-4.9.0.jar │ │ ├── lucene-highlighter-4.9.0.jar │ │ ├── lucene-memory-4.9.0.jar │ │ ├── lucene-misc-4.9.0.jar │ │ ├── lucene-queries-4.9.0.jar │ │ ├── lucene-queryparser-4.9.0.jar │ │ ├── lucene-suggest-4.9.0.jar │ │ └── simplemagic-1.6.jar │ ├── parser │ ├── CMakeLists.txt │ ├── include │ │ └── searchparser │ │ │ └── searchparser.h │ └── src │ │ └── searchparser.cpp │ ├── service │ ├── CMakeLists.txt │ ├── include │ │ └── service │ │ │ ├── searchservice.h │ │ │ └── serviceprocess.h │ ├── search-java │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ │ └── cc │ │ │ └── search │ │ │ ├── analysis │ │ │ ├── AdvancedTagQueryParser.java │ │ │ ├── QueryAnalyzer.java │ │ │ ├── log │ │ │ │ └── LogQueryBuilder.java │ │ │ └── query │ │ │ │ ├── HIPDQuery.java │ │ │ │ ├── MatchCollector.java │ │ │ │ ├── MatchingDocEnum.java │ │ │ │ └── SimpleMatchCollector.java │ │ │ ├── match │ │ │ ├── Context.java │ │ │ ├── QueryContext.java │ │ │ └── matcher │ │ │ │ ├── LogQueryMatcherFactory.java │ │ │ │ ├── MasterMatcherFactory.java │ │ │ │ ├── OffsetBasedLineMatcher.java │ │ │ │ ├── ResultMatcher.java │ │ │ │ ├── ResultMatcherFactory.java │ │ │ │ ├── SourceLineMatcherFactory.java │ │ │ │ └── TagKindMatcherFactory.java │ │ │ ├── service │ │ │ └── app │ │ │ │ ├── SearchAppCommon.java │ │ │ │ ├── query │ │ │ │ ├── QueryApp.java │ │ │ │ └── QueryAppOptions.java │ │ │ │ └── service │ │ │ │ ├── SearchHandler.java │ │ │ │ ├── ServiceApp.java │ │ │ │ └── ServiceAppOptions.java │ │ │ └── suggestion │ │ │ └── SuggestionHandler.java │ ├── search.thrift │ └── src │ │ ├── plugin.cpp │ │ └── searchservice.cpp │ └── webgui │ ├── css │ └── search.css │ ├── images │ └── search.png │ ├── js │ ├── searchFields.js │ └── searchResult.js │ └── userguide │ └── userguide.md ├── scripts ├── CMakeLists.txt ├── CodeCompass_logger ├── install_latest_build2.sh ├── remover.sh └── setldlogenv.sh ├── service ├── CMakeLists.txt ├── authentication │ ├── CMakeLists.txt │ ├── authentication.thrift │ ├── include │ │ └── authenticationservice │ │ │ └── authenticationservice.h │ └── src │ │ ├── authenticationservice.cpp │ │ └── plugin.cpp ├── language │ ├── CMakeLists.txt │ └── language.thrift ├── lsp │ ├── CMakeLists.txt │ ├── include │ │ └── lspservice │ │ │ ├── lsp_types.h │ │ │ └── lspservice.h │ └── src │ │ ├── lsp_types.cpp │ │ └── lspservice.cpp ├── plugin │ ├── CMakeLists.txt │ ├── include │ │ └── pluginservice │ │ │ └── pluginservice.h │ ├── plugin.thrift │ └── src │ │ ├── plugin.cpp │ │ └── pluginservice.cpp ├── project │ ├── CMakeLists.txt │ ├── common.thrift │ ├── include │ │ └── projectservice │ │ │ └── projectservice.h │ ├── project.thrift │ └── src │ │ ├── plugin.cpp │ │ └── projectservice.cpp └── workspace │ ├── CMakeLists.txt │ ├── include │ └── workspaceservice │ │ └── workspaceservice.h │ ├── src │ ├── plugin.cpp │ └── workspaceservice.cpp │ └── workspace.thrift ├── util ├── CMakeLists.txt ├── include │ └── util │ │ ├── dbutil.h │ │ ├── dynamiclibrary.h │ │ ├── filesystem.h │ │ ├── graph.h │ │ ├── hash.h │ │ ├── legendbuilder.h │ │ ├── logutil.h │ │ ├── odbobjectcache.h │ │ ├── odbtransaction.h │ │ ├── parserutil.h │ │ ├── pipedprocess.h │ │ ├── scopedvalue.h │ │ ├── threadpool.h │ │ ├── util.h │ │ └── webserverutil.h └── src │ ├── dbutil.cpp │ ├── dynamiclibrary.cpp │ ├── filesystem.cpp │ ├── graph.cpp │ ├── graphpimpl.h │ ├── legendbuilder.cpp │ ├── logutil.cpp │ ├── parserutil.cpp │ ├── pipedprocess.cpp │ └── util.cpp ├── webgui-new ├── .env ├── .eslintrc.json ├── .gitignore ├── .nvmrc ├── CMakeLists.txt ├── InstallReact.cmake ├── README.md ├── next.config.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ └── images │ │ ├── cc_codebites.png │ │ ├── cc_diagrams.png │ │ ├── cc_file_manager_explorer.png │ │ ├── cc_file_manager_tree.png │ │ ├── cc_header_settings.png │ │ ├── cc_info_tree.png │ │ ├── cc_metrics.png │ │ ├── cc_overview.png │ │ ├── cc_revcontrol.png │ │ ├── cc_search_results.png │ │ └── logo.png ├── src │ ├── components │ │ ├── accordion-menu │ │ │ ├── accordion-menu.tsx │ │ │ └── styled-components.tsx │ │ ├── codebites │ │ │ ├── codebites-node.tsx │ │ │ ├── codebites.tsx │ │ │ └── styled-components.tsx │ │ ├── codemirror-editor │ │ │ ├── codemirror-editor.tsx │ │ │ └── styled-components.tsx │ │ ├── cookie-notice │ │ │ └── cookie-notice.tsx │ │ ├── credits │ │ │ ├── credits.tsx │ │ │ └── styled-components.tsx │ │ ├── custom-icon │ │ │ └── custom-icon.tsx │ │ ├── diagrams │ │ │ ├── diagrams.tsx │ │ │ └── styled-components.tsx │ │ ├── editor-context-menu │ │ │ ├── editor-context-menu.tsx │ │ │ └── styled-components.tsx │ │ ├── file-context-menu │ │ │ └── file-context-menu.tsx │ │ ├── file-manager │ │ │ ├── file-manager.tsx │ │ │ └── styled-components.tsx │ │ ├── file-name │ │ │ ├── file-name.tsx │ │ │ └── styled-components.tsx │ │ ├── git-diff │ │ │ ├── git-diff.tsx │ │ │ └── styled-components.tsx │ │ ├── header │ │ │ ├── get-tooltip-text.tsx │ │ │ ├── header.tsx │ │ │ └── styled-components.tsx │ │ ├── info-tree │ │ │ ├── info-tree.tsx │ │ │ └── styled-components.tsx │ │ ├── metrics │ │ │ ├── metrics.tsx │ │ │ └── styled-components.tsx │ │ ├── project-select │ │ │ └── project-select.tsx │ │ ├── revision-control │ │ │ ├── revision-control.tsx │ │ │ └── styled-components.tsx │ │ ├── search-results │ │ │ ├── search-results.tsx │ │ │ └── styled-components.tsx │ │ ├── settings-menu │ │ │ ├── settings-menu.tsx │ │ │ └── styled-components.tsx │ │ ├── user-guide │ │ │ ├── styled-components.tsx │ │ │ └── user-guide.tsx │ │ └── welcome │ │ │ ├── styled-components.tsx │ │ │ └── welcome.tsx │ ├── enums │ │ ├── accordion-enum.ts │ │ ├── entity-types.ts │ │ ├── search-enum.ts │ │ └── tab-enum.ts │ ├── global-context │ │ ├── app-context.tsx │ │ └── theme-context.tsx │ ├── hooks │ │ └── use-url-state.ts │ ├── i18n │ │ ├── i18n.ts │ │ └── locales │ │ │ └── en.json │ ├── pages │ │ ├── _app.tsx │ │ ├── index.tsx │ │ └── project.tsx │ ├── server.ts │ ├── service │ │ ├── config.ts │ │ ├── cpp-reparse-service.ts │ │ ├── cpp-service.ts │ │ ├── git-service.ts │ │ ├── language-service.ts │ │ ├── metrics-service.ts │ │ ├── project-service.ts │ │ ├── search-service.ts │ │ └── workspace-service.ts │ ├── themes │ │ ├── globals.scss │ │ ├── index-styles.tsx │ │ ├── project-styles.tsx │ │ └── theme.ts │ └── utils │ │ ├── analytics.ts │ │ ├── store.ts │ │ ├── types.ts │ │ └── utils.ts ├── thrift-codegen.sh └── tsconfig.json ├── webgui ├── CMakeLists.txt ├── InstallGUI.cmake ├── codecompass.profile.js.in ├── credits.html ├── fonts │ ├── codecompass.eot │ ├── codecompass.svg │ ├── codecompass.ttf │ ├── codecompass.woff │ └── codecompass.woff2 ├── images │ ├── bugstep_icon.png │ ├── codebites.png │ ├── earhart.png │ ├── favicon.ico │ ├── filemanager.png │ ├── git.png │ ├── home.png │ ├── infotree.png │ ├── infotree_functions.png │ ├── loading.gif │ ├── logo.png │ └── textmodule.png ├── index.html ├── login.html ├── package.json ├── scripts │ ├── codecompass │ │ ├── astHelper.js │ │ ├── codecompass.js │ │ ├── keypressHandler.js │ │ ├── model.js │ │ ├── urlHandler.js │ │ ├── util.js │ │ ├── view │ │ │ ├── codeBites.js │ │ │ ├── component │ │ │ │ ├── ContextMenu.js │ │ │ │ ├── HtmlTree.js │ │ │ │ ├── IconTextBox.js │ │ │ │ ├── Pager.js │ │ │ │ ├── Text.js │ │ │ │ └── TooltipTreeMixin.js │ │ │ ├── diagram.js │ │ │ ├── fileManager.js │ │ │ ├── header.js │ │ │ ├── infoPage.js │ │ │ ├── infoTree.js │ │ │ ├── infobox.js │ │ │ └── text.js │ │ └── viewHandler.js │ ├── ga.js │ ├── login │ │ ├── MessagePane.js │ │ └── login.js │ └── thrift.js ├── startpage.html ├── style │ ├── codecompass.css │ ├── doxygen.css │ ├── icons.css │ ├── login.css │ └── startpage.css └── userguide │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── InstallUserguide.cmake │ ├── footer.html │ ├── header.html │ ├── userguide.md │ └── webgui │ └── js │ └── userguide.js └── webserver ├── CMakeLists.txt ├── authenticators ├── CMakeLists.txt ├── ldap │ ├── CMakeLists.txt │ ├── ldap-cpp │ │ ├── cldap.h │ │ ├── cldap_entry.cpp │ │ ├── cldap_entry.h │ │ ├── cldap_mod.cpp │ │ ├── cldap_mod.h │ │ ├── cldap_server.cpp │ │ ├── cldap_server.h │ │ └── cldap_types.h │ └── src │ │ └── plugin.cpp └── plain │ ├── CMakeLists.txt │ └── src │ └── plugin.cpp ├── include └── webserver │ ├── authenticator.h │ ├── lsphandler.h │ ├── mongoose.h │ ├── pluginhandler.h │ ├── pluginhelper.h │ ├── requesthandler.h │ ├── servercontext.h │ ├── session.h │ └── thrifthandler.h └── src ├── authentication.cpp ├── authentication.h ├── mainrequesthandler.cpp ├── mainrequesthandler.h ├── mongoose.c ├── session.cpp ├── sessionmanager.cpp ├── sessionmanager.h ├── threadedmongoose.cpp ├── threadedmongoose.h └── webserver.cpp /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeCompass-devcontainer", 3 | "image": "modelcpp/codecompass:dev", 4 | "workspaceFolder": "/CodeCompass/CodeCompass", 5 | "workspaceMount": "src=${localWorkspaceFolder}/..,dst=/CodeCompass,type=bind,consistency=cached", 6 | "appPort": [ 7 | "8001:8080" 8 | ] 9 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/.github" 6 | schedule: 7 | interval: "weekly" 8 | labels: 9 | - "Target: Developer environment" 10 | 11 | # Maintain dependencies for npm 12 | - package-ecosystem: "npm" 13 | directory: "/webgui-new" 14 | schedule: 15 | interval: "weekly" 16 | labels: 17 | - "Target: WebGUI" 18 | # Disable version updates, only security updates will be made! 19 | open-pull-requests-limit: 0 20 | -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/compile_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Compile dependencies that cannot be acquired via the official repositories 4 | 5 | mkdir -p ${INSTALL_PATH} 6 | 7 | ## Compile build2 8 | 9 | sh "${DOWNLOAD_PATH}/install_latest_build2.sh" ${INSTALL_PATH}/build2 10 | 11 | ## Compile odb, libodb, and its connectors 12 | 13 | mkdir -p ${DOWNLOAD_PATH}/odb 14 | cd ${DOWNLOAD_PATH}/odb 15 | ${INSTALL_PATH}/build2/bin/bpkg create --quiet --jobs $(nproc) cc \ 16 | config.cxx=g++ \ 17 | config.cc.coptions=-O3 \ 18 | config.bin.rpath=${INSTALL_PATH}/odb/lib \ 19 | config.install.root=${INSTALL_PATH}/odb 20 | 21 | ### Getting the source 22 | ${INSTALL_PATH}/build2/bin/bpkg add https://pkg.cppget.org/1/beta --trust-yes 23 | ${INSTALL_PATH}/build2/bin/bpkg fetch --trust-yes 24 | 25 | ### Building odb 26 | ${INSTALL_PATH}/build2/bin/bpkg build odb --yes 27 | ${INSTALL_PATH}/build2/bin/bpkg build libodb --yes 28 | ${INSTALL_PATH}/build2/bin/bpkg build libodb-sqlite --yes 29 | ${INSTALL_PATH}/build2/bin/bpkg build libodb-pgsql --yes 30 | ${INSTALL_PATH}/build2/bin/bpkg install --all --recursive -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/download_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Download installers for compiled dependencies 4 | 5 | mkdir -p "${DOWNLOAD_PATH}" 6 | 7 | ## Thrift 0.16 + ODB beta 8 | 9 | wget -O "${DOWNLOAD_PATH}/install_latest_build2.sh" "https://github.com/Ericsson/CodeCompass/raw/master/scripts/install_latest_build2.sh" 10 | build2_version=$(sh "${DOWNLOAD_PATH}/install_latest_build2.sh" --version) 11 | odb_signature=$(wget -qO- https://pkg.cppget.org/1/beta/signature.manifest) 12 | 13 | # Calculate hash of dependencies for Github Cache Action 14 | 15 | hash_value=$(echo -n "${build2_version}${odb_signature}" | md5sum | awk '{print $1}') 16 | 17 | ## Save said hash 18 | 19 | ### Restore action 20 | echo "compile-hash-key=${hash_value}" >> "$GITHUB_OUTPUT" 21 | 22 | ### Save action 23 | echo "CACHE_KEY=${hash_value}" >> "$GITHUB_ENV" -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/postcompile_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Post compilation configuration for building (environmental variables, library location settings etc..) 4 | 5 | echo "${INSTALL_PATH}/odb/bin" >> $GITHUB_PATH 6 | echo "CMAKE_PREFIX_PATH=${INSTALL_PATH}/odb:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV 7 | 8 | # Clean up dependency sources and intermediate binaries to save space 9 | rm -rf ${DOWNLOAD_PATH}/odb -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/setup_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install required packages for CodeCompass build 4 | sudo apt install git cmake make g++ libboost-all-dev \ 5 | llvm-15-dev clang-15 libclang-15-dev \ 6 | gcc-11-plugin-dev thrift-compiler libthrift-dev \ 7 | default-jdk libssl-dev libgraphviz-dev libmagic-dev libgit2-dev exuberant-ctags doxygen \ 8 | libldap2-dev libgtest-dev -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/setup_postgresql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install PostgreSQL 4 | sudo apt-get install postgresql-server-dev-14 -------------------------------------------------------------------------------- /.github/scripts/ubuntu-22.04/setup_sqlite3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install SQLite3 4 | sudo apt-get install libsqlite3-dev -------------------------------------------------------------------------------- /.github/workflows/linting.yml: -------------------------------------------------------------------------------- 1 | name: Frontend linting 2 | 3 | on: [push, pull_request, workflow_dispatch] 4 | 5 | permissions: read-all 6 | 7 | jobs: 8 | linting: 9 | runs-on: ubuntu-22.04 10 | defaults: 11 | run: 12 | working-directory: ./webgui-new/ 13 | 14 | steps: 15 | - name: checkout 16 | uses: actions/checkout@v4 17 | 18 | - name: setup Node.JS 19 | uses: actions/setup-node@v3 20 | with: 21 | node-version: 20 22 | cache: 'npm' 23 | cache-dependency-path: ./webgui-new/package-lock.json 24 | 25 | - name: cache node modules 26 | id: cache_node_modules 27 | uses: actions/cache@v3 28 | with: 29 | path: ./webgui-new/node_modules 30 | key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 31 | restore-keys: | 32 | ${{ runner.os }}-npm- 33 | 34 | - name: install npm 35 | if: steps.cache_node_modules.outputs.cache-hit != 'true' 36 | run: npm install 37 | 38 | - name: run linter 39 | run: npm run lint 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /.github/workflows/tarball.yml: -------------------------------------------------------------------------------- 1 | name: Create Tarball 2 | 3 | on: 4 | workflow_dispatch: 5 | workflow_call: 6 | secrets: 7 | GITLAB_TRIGGER_TOKEN: 8 | required: true 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | tarball: 14 | runs-on: ubuntu-22.04 15 | 16 | steps: 17 | - name: Update apt-get 18 | run: sudo apt-get update 19 | 20 | - name: Install curl 21 | run: sudo apt-get install curl 22 | 23 | - name: Trigger GitLab CI 24 | run: curl -X POST -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=${{ github.ref_name }} https://gitlab.inf.elte.hu/api/v4/projects/85/trigger/pipeline 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## IDEs and editors 2 | # NetBeans 3 | nbproject/ 4 | # JetBrains CLion 5 | .idea/* 6 | !.idea/codeStyles/ 7 | # Visual Studio Code 8 | .vscode/ 9 | # Vim 10 | *.swp 11 | 12 | 13 | ## Build folders 14 | build/ 15 | build_*/ 16 | install/ 17 | install_*/ 18 | 19 | -------------------------------------------------------------------------------- /.gitlab/README.md: -------------------------------------------------------------------------------- 1 | How to use 2 | ========== 3 | 4 | Configure environment 5 | --------------------- 6 | Source the `cc-env.sh` file. 7 | 8 | Now the important binaries are available on the `PATH` environment variable: 9 | `CodeCompass_parser`, `CodeCompass_webserver`, `CodeCompass_logger`, `ccdb-tool`. 10 | 11 | 12 | Start a database 13 | ---------------- 14 | The tarball contains a CodeCompass instance linked against PostgreSQL, therefore two options are available. 15 | - Use the PostgreSQL database server on your machine. 16 | - The extracted tarball contains a PostgreSQL installation in the `runtime-deps/postgresql-install/bin` folder. 17 | Use the `initdb` and `postgres` binaries to create and start a new PostgreSQL database cluster. 18 | -------------------------------------------------------------------------------- /.gitlab/cc-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SOURCE THIS FILE! 3 | 4 | PS1_ORIG=$PS1 5 | 6 | ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd -P)" 7 | DEPS_INSTALL_DIR=$ROOT_DIR/deps-runtime 8 | CC_INSTALL_DIR=$ROOT_DIR/cc-install 9 | 10 | export LD_LIBRARY_PATH=$DEPS_INSTALL_DIR/libgit2-install/lib64\ 11 | :$DEPS_INSTALL_DIR/openssl-install/lib\ 12 | :$DEPS_INSTALL_DIR/graphviz-install/lib\ 13 | :$DEPS_INSTALL_DIR/libmagic-install/lib\ 14 | :$DEPS_INSTALL_DIR/boost-install/lib\ 15 | :$DEPS_INSTALL_DIR/odb-install/lib\ 16 | :$DEPS_INSTALL_DIR/thrift-install/lib\ 17 | :$DEPS_INSTALL_DIR/llvm-install/lib\ 18 | :$DEPS_INSTALL_DIR/libtool-install/lib\ 19 | :$DEPS_INSTALL_DIR/postgresql-install/lib\ 20 | :$DEPS_INSTALL_DIR/openldap-install/lib\ 21 | :$LD_LIBRARY_PATH 22 | 23 | export PATH=$DEPS_INSTALL_DIR/jdk-install/bin\ 24 | :$DEPS_INSTALL_DIR/ctags-install/bin\ 25 | :$DEPS_INSTALL_DIR/python-install/bin\ 26 | :$DEPS_INSTALL_DIR/node-install/bin\ 27 | :$DEPS_INSTALL_DIR/postgresql-install/bin\ 28 | :$CC_INSTALL_DIR/bin\ 29 | :$PATH 30 | 31 | export MAGIC=$DEPS_INSTALL_DIR/libmagic-install/share/misc/magic.mgc 32 | export JAVA_HOME=$DEPS_INSTALL_DIR/jdk-install 33 | 34 | if [ -f $ROOT_DIR/ccdb-tool/venv/bin/activate ]; then 35 | source $ROOT_DIR/ccdb-tool/venv/bin/activate 36 | else 37 | pushd $ROOT_DIR/ccdb-tool 38 | # install venv 39 | python3 -m pip install virtualenv 40 | # create venv 41 | make venv 42 | source venv/bin/activate 43 | # build ccdb-tool 44 | make package 45 | popd 46 | fi 47 | 48 | export PS1="(cc-env) $PS1_ORIG" 49 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16.3) 2 | project(CodeCompass) 3 | 4 | # Common config variables and settings 5 | include(Config.cmake) 6 | 7 | # Utility functions 8 | include(Functions.cmake) 9 | 10 | # Do some sanity check on the testing setup and enable testing if applicable. 11 | include(Testing.cmake) 12 | 13 | find_package(Boost REQUIRED COMPONENTS filesystem log program_options regex system thread) 14 | find_package(Java REQUIRED) 15 | find_package(ODB REQUIRED) 16 | find_package(Threads REQUIRED) 17 | find_package(Thrift REQUIRED) 18 | find_package(GTest) 19 | 20 | include(UseJava) 21 | set(CMAKE_JAVA_COMPILE_FLAGS -encoding utf8) 22 | 23 | # Set the third-party libraries' path properly so the installation can find them. 24 | include(Exports.cmake) 25 | set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${RUNENV_LD_LIBRARY_PATH}") 26 | 27 | # Modules 28 | add_subdirectory(logger) 29 | add_subdirectory(model) 30 | add_subdirectory(parser) 31 | add_subdirectory(scripts) 32 | add_subdirectory(service) 33 | add_subdirectory(util) 34 | add_subdirectory(plugins) # must precede webgui 35 | add_subdirectory(webgui) 36 | add_subdirectory(webgui-new) 37 | add_subdirectory(webserver) 38 | 39 | # Install java libraries 40 | install(DIRECTORY 41 | lib/java/ 42 | DESTINATION "${INSTALL_JAVA_LIB_DIR}") 43 | -------------------------------------------------------------------------------- /FindOpenLdap.cmake: -------------------------------------------------------------------------------- 1 | # - Find OpenLDAP C Libraries 2 | # 3 | # OPENLDAP_FOUND - True if found. 4 | # OPENLDAP_INCLUDE_DIR - Path to the openldap include directory 5 | # OPENLDAP_LIBRARIES - Paths to the ldap and lber libraries 6 | 7 | # Source: https://fossies.org/linux/ceph/cmake/modules/FindOpenLdap.cmake 8 | 9 | find_path(OPENLDAP_INCLUDE_DIR ldap.h PATHS 10 | /usr/include 11 | /opt/local/include 12 | /usr/local/include) 13 | 14 | find_library(LDAP_LIBRARY ldap) 15 | find_library(LBER_LIBRARY lber) 16 | 17 | include(FindPackageHandleStandardArgs) 18 | find_package_handle_standard_args(OpenLdap DEFAULT_MSG 19 | OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY) 20 | 21 | set(OPENLDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY}) 22 | 23 | mark_as_advanced( 24 | OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY) -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Only the current development release and the last stable version of CodeCompass is supported by security updates. 6 | 7 | | Version | Branch | Supported | 8 | | -------------------- | ----------------- | ------------------ | 9 | | Development release | `master` | :white_check_mark: | 10 | | Flash | `release/flash` | :white_check_mark: | 11 | | Earhart | `release/earhart` | :x: | 12 | 13 | Previous (not open source) versions of CodeCompass are also not supported anymore. 14 | 15 | ## Reporting a Vulnerability 16 | 17 | If you find a vulnerability in CodeCompass, please report it as a security vulnerability on GitHub: 18 | https://github.com/Ericsson/CodeCompass/security/advisories/new 19 | -------------------------------------------------------------------------------- /Testing.cmake: -------------------------------------------------------------------------------- 1 | # Testing-specific configurations and setup calls. 2 | 3 | if (NOT DEFINED TEST_DB) 4 | set(FUNCTIONAL_TESTING_ENABLED 5 | FALSE 6 | CACHE INTERNAL 7 | "Whether testing executable functionality was configured for the build.") 8 | 9 | message(WARNING "TEST_DB variable not set. Skipping generation of functional \ 10 | tests... To enable, set a database connection string which \ 11 | can be used for the parsing of the test projects' files.") 12 | else() 13 | enable_testing() 14 | 15 | # Initialize the variable in the cache and mark it as a string. 16 | set(TEST_DB "" CACHE STRING 17 | "Database connection string used in running functional tests.") 18 | 19 | set(FUNCTIONAL_TESTING_ENABLED 20 | TRUE 21 | CACHE INTERNAL 22 | "Whether testing executable functionality was configured for the build.") 23 | 24 | # Ensure that if TEST_DB is set, then it uses the database backend CodeCompass 25 | # will be built with. 26 | string(FIND "${TEST_DB}" "${DATABASE}:" testDbUsesProperBackend) 27 | if (NOT TEST_DB STREQUAL "" AND NOT testDbUsesProperBackend EQUAL 0) 28 | string(FIND "${TEST_DB}" ":" findPos) 29 | string(SUBSTRING "${TEST_DB}" 0 ${findPos} testDbBackend) 30 | message("${testDbBackend}") 31 | message(FATAL_ERROR "CodeCompass is being built with database backend \ 32 | '${DATABASE}', but TEST_DB was set to use \ 33 | '${testDbBackend}'. The same database system must be \ 34 | used, otherwise the tests won't run.") 35 | endif() 36 | endif() 37 | -------------------------------------------------------------------------------- /doc/images/docker.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/doc/images/docker.jpg -------------------------------------------------------------------------------- /doc/logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/doc/logo/logo.png -------------------------------------------------------------------------------- /docker/dev/codecompass-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script will run inside the Docker container. This will build CodeCompass 4 | # using the following environment variables: 5 | # 6 | # DATABASE - sqlite (by default) or psql 7 | # BUILD_TYPE - Release (by default) or Debug 8 | 9 | # DON'T MODIFY THE REST OF THIS SCRIPT UNLESS YOU KNOW WHAT YOU'RE DOING! 10 | 11 | mkdir -p $BUILD_DIR 12 | mkdir -p $TEST_WORKSPACE 13 | 14 | cd $BUILD_DIR 15 | cmake \ 16 | $SOURCE_DIR \ 17 | -DDATABASE=$DATABASE \ 18 | -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ 19 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 20 | -DTEST_DB=$TEST_DB 21 | 22 | make -C $BUILD_DIR $@ 23 | -------------------------------------------------------------------------------- /docker/dev/install_odb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | opt=${1:-"all"} 4 | 5 | wget https://raw.githubusercontent.com/Ericsson/CodeCompass/master/scripts/install_latest_build2.sh 6 | sh install_latest_build2.sh "/build2_install" 7 | export PATH=/build2_install/bin:$PATH 8 | # Configuring the build 9 | mkdir /odb_build 10 | cd /odb_build 11 | bpkg create --quiet --jobs $(nproc) cc \ 12 | config.cxx=g++ \ 13 | config.cc.coptions=-O3 \ 14 | config.bin.rpath=/opt/odb/lib \ 15 | config.install.root=/opt/odb 16 | # Getting the source 17 | bpkg add https://pkg.cppget.org/1/beta --trust-yes 18 | bpkg fetch --trust-yes 19 | # Building ODB 20 | BUILD_LIST="libodb" 21 | case $opt in 22 | "sqlite") 23 | BUILD_LIST="$BUILD_LIST libodb-sqlite" 24 | ;; 25 | "pgsql") 26 | BUILD_LIST="$BUILD_LIST libodb-pgsql" 27 | ;; 28 | *) 29 | BUILD_LIST="$BUILD_LIST odb libodb-sqlite libodb-pgsql" 30 | ;; 31 | esac 32 | for pack in "$BUILD_LIST"; do 33 | bpkg build $pack --yes 34 | done 35 | # Install ODB (to /usr/local) 36 | bpkg install --all --recursive 37 | # Clean up 38 | cd / 39 | sh install_latest_build2.sh --uninstall 40 | rm -rf /odb_build install_latest_build2.sh build2-toolchain-*.tar.gz 41 | -------------------------------------------------------------------------------- /docker/web/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" == '0' ]; then 4 | # Change the owner of the workspace directory 5 | mkdir -p /workspace 6 | chown codecompass:codecompass /workspace 7 | 8 | # Execute this script again with codecompass user. 9 | exec gosu codecompass "$0" "$@" 10 | fi 11 | 12 | exec "$@" 13 | -------------------------------------------------------------------------------- /lib/java/httpclient-4.5.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/httpclient-4.5.6.jar -------------------------------------------------------------------------------- /lib/java/httpcore-4.4.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/httpcore-4.4.10.jar -------------------------------------------------------------------------------- /lib/java/javax.annotation-api-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/javax.annotation-api-1.3.2.jar -------------------------------------------------------------------------------- /lib/java/libthrift-0.16.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/libthrift-0.16.0.jar -------------------------------------------------------------------------------- /lib/java/log4j-1.2.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/log4j-1.2.17.jar -------------------------------------------------------------------------------- /lib/java/slf4j-api-1.7.25.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/slf4j-api-1.7.25.jar -------------------------------------------------------------------------------- /lib/java/slf4j-log4j12-1.7.25.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/lib/java/slf4j-log4j12-1.7.25.jar -------------------------------------------------------------------------------- /logger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(_src 2 | src/ldlogger-hooks.c 3 | src/ldlogger-logger.c 4 | src/ldlogger-tool.c 5 | src/ldlogger-tool-gcc.c 6 | src/ldlogger-tool-javac.c 7 | src/ldlogger-util.c) 8 | 9 | add_definitions(-D_GNU_SOURCE -D__LOGGER_MAIN__) 10 | 11 | add_executable(logger ${_src}) 12 | target_link_libraries(logger 13 | ${CMAKE_DL_LIBS}) 14 | 15 | add_library(ldlogger SHARED ${_src}) 16 | target_compile_options(ldlogger PUBLIC -Wno-unknown-pragmas) 17 | target_link_libraries(ldlogger 18 | ${CMAKE_DL_LIBS}) 19 | 20 | install(TARGETS ldlogger 21 | DESTINATION ${INSTALL_LIB_DIR}/x86_64) 22 | 23 | install(TARGETS logger 24 | RUNTIME DESTINATION ${INSTALL_BIN_DIR} 25 | LIBRARY DESTINATION ${INSTALL_LIB_DIR}) -------------------------------------------------------------------------------- /logger/src/ldlogger-hooks.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_LOGGER_HOOKS_H 2 | #define CC_LOGGER_HOOKS_H 3 | 4 | int logExec(int argc_, const char** argv_); 5 | 6 | #endif // CC_LOGGER_HOOKS_H 7 | -------------------------------------------------------------------------------- /model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(ODB_SOURCES 2 | include/model/buildaction.h 3 | include/model/buildlog.h 4 | include/model/buildsourcetarget.h 5 | include/model/filecontent.h 6 | include/model/file.h 7 | include/model/fileloc.h 8 | include/model/position.h 9 | include/model/statistics.h) 10 | 11 | generate_odb_files("${ODB_SOURCES}") 12 | 13 | add_odb_library(model ${ODB_CXX_SOURCES}) 14 | 15 | install_sql() 16 | -------------------------------------------------------------------------------- /model/include/model/buildaction.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_BUILDACTION_H 2 | #define CC_MODEL_BUILDACTION_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace cc 14 | { 15 | namespace model 16 | { 17 | 18 | struct BuildSource; 19 | struct BuildTarget; 20 | 21 | #pragma db object 22 | struct BuildAction 23 | { 24 | enum Type 25 | { 26 | Compile, 27 | Link, 28 | Other 29 | }; 30 | 31 | #pragma db id auto 32 | std::uint64_t id; 33 | 34 | #pragma db not_null 35 | std::string command; 36 | 37 | #pragma db not_null 38 | Type type; 39 | 40 | #pragma db value_not_null inverse(action) 41 | std::vector> sources; 42 | 43 | #pragma db value_not_null inverse(action) 44 | std::vector> targets; 45 | }; 46 | 47 | typedef std::shared_ptr BuildActionPtr; 48 | 49 | #pragma db view object(BuildAction) 50 | struct BuildActionId 51 | { 52 | std::uint64_t id; 53 | }; 54 | 55 | } // model 56 | } // cc 57 | 58 | #endif // CC_MODEL_BUILDACTION_H 59 | -------------------------------------------------------------------------------- /model/include/model/buildlog.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_BUILDLOG_H 2 | #define CC_MODEL_BUILDLOG_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace cc 13 | { 14 | namespace model 15 | { 16 | 17 | #pragma db value 18 | struct BuildLogMessage 19 | { 20 | enum MessageType 21 | { 22 | Unknown, 23 | Error, 24 | FatalError, 25 | Warning, 26 | Note, 27 | CodingRule 28 | }; 29 | 30 | #pragma db not_null 31 | MessageType type; 32 | 33 | #pragma db not_null 34 | std::string message; 35 | }; 36 | 37 | #pragma db object 38 | struct BuildLog 39 | { 40 | #pragma db id auto 41 | std::uint64_t id; 42 | 43 | #pragma db not_null 44 | BuildLogMessage log; 45 | 46 | #pragma db null 47 | FileLoc location; 48 | }; 49 | 50 | typedef std::shared_ptr BuildLogPtr; 51 | 52 | } // model 53 | } // cc 54 | 55 | #endif // CC_MODEL_BUILDLOG_H 56 | -------------------------------------------------------------------------------- /model/include/model/buildsourcetarget.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_BUILDSOURCE_H 2 | #define CC_MODEL_BUILDSOURCE_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace cc 12 | { 13 | namespace model 14 | { 15 | 16 | struct BuildAction; 17 | 18 | #pragma db object 19 | struct BuildSource 20 | { 21 | #pragma db id auto 22 | std::uint64_t id; 23 | 24 | #pragma db not_null 25 | FilePtr file; 26 | 27 | #pragma db not_null 28 | #pragma db on_delete(cascade) 29 | std::shared_ptr action; 30 | }; 31 | 32 | typedef std::shared_ptr BuildSourcePtr; 33 | 34 | #pragma db object 35 | struct BuildTarget 36 | { 37 | #pragma db id auto 38 | std::uint64_t id; 39 | 40 | #pragma db not_null 41 | FilePtr file; 42 | 43 | #pragma db not_null 44 | #pragma db on_delete(cascade) 45 | std::shared_ptr action; 46 | }; 47 | 48 | typedef std::shared_ptr BuildTargetPtr; 49 | 50 | } // model 51 | } // cc 52 | 53 | #endif // CC_MODEL_BUILDSOURCE_H 54 | -------------------------------------------------------------------------------- /model/include/model/filecontent.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_FILECONTENT_H 2 | #define CC_MODEL_FILECONTENT_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace cc 14 | { 15 | namespace model 16 | { 17 | 18 | struct File; 19 | struct FileContent; 20 | 21 | typedef std::shared_ptr FileContentPtr; 22 | 23 | #pragma db object 24 | struct FileContent 25 | { 26 | #pragma db id not_null 27 | std::string hash; 28 | 29 | #pragma db not_null 30 | std::string content; 31 | }; 32 | 33 | #pragma db view object(FileContent) 34 | struct FileContentIds 35 | { 36 | std::string hash; 37 | }; 38 | 39 | #pragma db view object(FileContent) 40 | struct FileContentLength 41 | { 42 | std::string hash; 43 | 44 | #pragma db column("length(" + FileContent::content + ")") 45 | std::size_t size; 46 | }; 47 | 48 | } // model 49 | } // cc 50 | 51 | #endif // CC_MODEL_FILECONTENT_H 52 | -------------------------------------------------------------------------------- /model/include/model/fileloc.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_FILELOCATION_H 2 | #define CC_MODEL_FILELOCATION_H 3 | 4 | #include 5 | #include 6 | 7 | namespace cc 8 | { 9 | namespace model 10 | { 11 | 12 | #pragma db value 13 | struct FileLoc 14 | { 15 | Range range; 16 | 17 | #pragma db null 18 | #pragma db on_delete(cascade) 19 | odb::lazy_shared_ptr file; 20 | }; 21 | 22 | } // model 23 | } // cc 24 | 25 | 26 | #endif // CC_MODEL_FILELOCATION_H 27 | -------------------------------------------------------------------------------- /model/include/model/statistics.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_STATISTICS_H 2 | #define CC_MODEL_STATISTICS_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace cc 10 | { 11 | namespace model 12 | { 13 | 14 | struct Statistics; 15 | typedef std::shared_ptr StatisticsPtr; 16 | typedef int StatisticsId; 17 | 18 | #pragma db object 19 | struct Statistics 20 | { 21 | #pragma db id auto 22 | unsigned long id; 23 | 24 | std::string group; 25 | std::string key; 26 | int value; 27 | }; 28 | 29 | } // model 30 | } // cc 31 | 32 | #endif // CC_MODEL_STATISTICS_H 33 | -------------------------------------------------------------------------------- /parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/util/include 4 | ${PROJECT_SOURCE_DIR}/model/include) 5 | 6 | include_directories(SYSTEM 7 | ${ODB_INCLUDE_DIRS}) 8 | 9 | add_executable(CodeCompass_parser 10 | src/pluginhandler.cpp 11 | src/sourcemanager.cpp 12 | src/parser.cpp 13 | src/parsercontext.cpp) 14 | 15 | set_target_properties(CodeCompass_parser 16 | PROPERTIES ENABLE_EXPORTS 1) 17 | 18 | target_link_libraries(CodeCompass_parser 19 | util 20 | model 21 | ${Boost_LIBRARIES} 22 | ${ODB_LIBRARIES} 23 | ${CMAKE_DL_LIBS} 24 | magic 25 | pthread) 26 | 27 | install(TARGETS CodeCompass_parser 28 | RUNTIME DESTINATION ${INSTALL_BIN_DIR} 29 | LIBRARY DESTINATION ${INSTALL_LIB_DIR}) 30 | -------------------------------------------------------------------------------- /parser/include/parser/parsercontext.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_PARSERCONTEXT_H 2 | #define CC_PARSER_PARSERCONTEXT_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace po = boost::program_options; 12 | 13 | namespace cc 14 | { 15 | namespace parser 16 | { 17 | 18 | class SourceManager; 19 | 20 | /** 21 | * Defines file status categories for incremental parsing. 22 | * 23 | * State in database VERSUS state on disk at parse time. 24 | */ 25 | enum class IncrementalStatus 26 | { 27 | MODIFIED, 28 | ADDED, 29 | DELETED, 30 | ACTION_CHANGED 31 | }; 32 | 33 | struct ParserContext 34 | { 35 | ParserContext( 36 | std::shared_ptr db_, 37 | SourceManager& srcMgr_, 38 | std::string& compassRoot_, 39 | po::variables_map& options_); 40 | 41 | std::shared_ptr db; 42 | SourceManager& srcMgr; 43 | std::string& compassRoot; 44 | po::variables_map& options; 45 | std::unordered_map fileStatus; 46 | std::vector moduleDirectories; 47 | }; 48 | 49 | } // parser 50 | } // cc 51 | 52 | #endif // CC_PARSER_PARSERCONTEXT_H 53 | 54 | -------------------------------------------------------------------------------- /plugins/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(model) 2 | add_subdirectory(parser) 3 | add_subdirectory(service) 4 | add_subdirectory(test) 5 | 6 | install_webplugin(webgui) 7 | -------------------------------------------------------------------------------- /plugins/cpp/model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(ODB_SOURCES 2 | include/model/cppastnode.h 3 | include/model/cppentity.h 4 | include/model/cppenum.h 5 | include/model/cppfriendship.h 6 | include/model/cppfunction.h 7 | include/model/cppinheritance.h 8 | include/model/cppnamespace.h 9 | include/model/cppnamespacealias.h 10 | include/model/cpprelation.h 11 | include/model/cpptypedef.h 12 | include/model/cpprecord.h 13 | include/model/cppvariable.h 14 | include/model/cppheaderinclusion.h 15 | include/model/cppmacro.h 16 | include/model/cppmacroexpansion.h 17 | include/model/cppedge.h 18 | include/model/cppdoccomment.h) 19 | 20 | generate_odb_files("${ODB_SOURCES}") 21 | 22 | add_odb_library(cppmodel ${ODB_CXX_SOURCES}) 23 | target_link_libraries(cppmodel model) 24 | 25 | install_sql() 26 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/common.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_COMMON_H 2 | #define CC_MODEL_COMMON_H 3 | 4 | #include 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | enum Visibility 12 | { 13 | Private, 14 | Protected, 15 | Public 16 | }; 17 | 18 | enum Tag 19 | { 20 | Constructor = 0, 21 | Destructor = 1, 22 | Virtual = 2, 23 | Static = 3, 24 | Implicit = 4, 25 | Global = 5, 26 | Constant = 6, 27 | TemplateSpecialization = 7, 28 | TemplateInstantiation = 8 // all cases other than explicit specialization 29 | }; 30 | 31 | inline std::string visibilityToString(Visibility v_) 32 | { 33 | return 34 | v_ == Private ? "private" : 35 | v_ == Protected ? "protected" : 36 | v_ == Public ? "public" : ""; 37 | } 38 | 39 | inline std::string tagToString(Tag t_) 40 | { 41 | return 42 | t_ == Constructor ? "constructor" : 43 | t_ == Destructor ? "destructor" : 44 | t_ == Virtual ? "virtual" : 45 | t_ == Static ? "static" : 46 | t_ == Implicit ? "implicit" : 47 | t_ == Global ? "global" : 48 | t_ == Constant ? "constant" : ""; 49 | } 50 | 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppdoccomment.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPDOCCOMMENT_H 2 | #define CC_MODEL_CPPDOCCOMMENT_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace cc 11 | { 12 | namespace model 13 | { 14 | 15 | struct CppDocComment; 16 | typedef odb::lazy_shared_ptr CppDocCommentPtr; 17 | 18 | #pragma db object 19 | struct CppDocComment 20 | { 21 | 22 | #pragma db id auto 23 | int id; 24 | 25 | #pragma db not_null index 26 | unsigned long long contentHash; 27 | 28 | #pragma db not_null 29 | std::string content; 30 | 31 | #pragma db not_null index 32 | unsigned long long entityHash; 33 | }; 34 | 35 | } //model 36 | } // cc 37 | 38 | #endif //CC_MODEL_CPPDOCCOMMENT_H 39 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppentity.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPENTITY_H 2 | #define CC_MODEL_CPPENTITY_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "cppastnode.h" 10 | #include "common.h" 11 | 12 | namespace cc 13 | { 14 | namespace model 15 | { 16 | 17 | typedef std::uint64_t CppEntityId; 18 | 19 | #pragma db object polymorphic 20 | struct CppEntity 21 | { 22 | virtual ~CppEntity() {} 23 | 24 | #pragma db id auto 25 | CppEntityId id; 26 | 27 | #pragma db unique 28 | CppAstNodeId astNodeId; 29 | 30 | std::uint64_t entityHash = 0; 31 | 32 | std::string name; 33 | std::string qualifiedName; 34 | 35 | std::set tags; 36 | 37 | #pragma db index member(entityHash) 38 | }; 39 | 40 | typedef std::shared_ptr CppEntityPtr; 41 | 42 | #pragma db object 43 | struct CppTypedEntity : CppEntity 44 | { 45 | std::uint64_t typeHash; 46 | std::string qualifiedType; 47 | }; 48 | 49 | typedef std::shared_ptr CppTypedEntityPtr; 50 | 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppfriendship.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPFRIENDSHIP_H 2 | #define CC_MODEL_CPPFRIENDSHIP_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace cc 9 | { 10 | namespace model 11 | { 12 | 13 | #pragma db object 14 | struct CppFriendship 15 | { 16 | #pragma db id auto 17 | int id; 18 | 19 | std::uint64_t target; 20 | std::uint64_t theFriend; 21 | 22 | std::string toString() const 23 | { 24 | return std::string("CppFriendship") 25 | .append("\nid = ").append(std::to_string(id)) 26 | .append("\ntarget = ").append(std::to_string(target)) 27 | .append("\ntheFriend = ").append(std::to_string(theFriend)); 28 | } 29 | 30 | #pragma db index member(target) 31 | #pragma db index member(theFriend) 32 | }; 33 | 34 | typedef std::shared_ptr CppFriendshipPtr; 35 | 36 | #pragma db view object(CppFriendship) 37 | struct CppFriendshipCount 38 | { 39 | #pragma db column("count(" + CppFriendship::id + ")") 40 | std::size_t count; 41 | }; 42 | 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppheaderinclusion.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_HEADERINCLUSION_H 2 | #define CC_MODEL_HEADERINCLUSION_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "model/file.h" 11 | 12 | namespace cc 13 | { 14 | namespace model 15 | { 16 | 17 | #pragma db object 18 | struct CppHeaderInclusion 19 | { 20 | #pragma db id auto 21 | int id; 22 | 23 | #pragma db not_null 24 | #pragma db on_delete(cascade) 25 | odb::lazy_shared_ptr includer; 26 | 27 | #pragma db not_null 28 | #pragma db on_delete(cascade) 29 | odb::lazy_shared_ptr included; 30 | 31 | std::string toString() const 32 | { 33 | return std::string("CppHeaderInclusion") 34 | .append("\nid = ").append(std::to_string(id)) 35 | .append("\nincluder = ").append(std::to_string(includer->id)) 36 | .append("\nincluded = ").append(std::to_string(included->id)); 37 | } 38 | 39 | #pragma db index member(includer) 40 | #pragma db index member(included) 41 | }; 42 | 43 | typedef std::shared_ptr CppHeaderInclusionPtr; 44 | 45 | } // model 46 | } // cc 47 | 48 | #endif // CC_MODEL_HEADERINCLUSION_H 49 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppinheritance.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPINHERITANCE_H 2 | #define CC_MODEL_CPPINHERITANCE_H 3 | 4 | #include 5 | #include "common.h" 6 | 7 | namespace cc 8 | { 9 | namespace model 10 | { 11 | 12 | #pragma db object 13 | struct CppInheritance 14 | { 15 | #pragma db id auto 16 | int id; 17 | 18 | std::uint64_t derived; 19 | std::uint64_t base; 20 | 21 | bool isVirtual = false; 22 | Visibility visibility; 23 | 24 | std::string toString() const 25 | { 26 | return std::string("CppInheritance") 27 | .append("\nid = ").append(std::to_string(id)) 28 | .append("\nderived = ").append(std::to_string(derived)) 29 | .append("\nbase = ").append(std::to_string(base)) 30 | .append("\nisVirtual = ").append(std::to_string(isVirtual)) 31 | .append("\nvisibility = ").append(visibilityToString(visibility)); 32 | } 33 | 34 | #pragma db index member(derived) 35 | #pragma db index member(base) 36 | }; 37 | 38 | typedef std::shared_ptr CppInheritancePtr; 39 | 40 | #pragma db view object(CppInheritance) 41 | struct CppInheritanceCount 42 | { 43 | #pragma db column("count(" + CppInheritance::id + ")") 44 | std::size_t count; 45 | }; 46 | 47 | } 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppmacro.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPMACRO_H 2 | #define CC_MODEL_CPPMACRO_H 3 | 4 | #include "cppentity.h" 5 | #include 6 | 7 | namespace cc 8 | { 9 | namespace model 10 | { 11 | 12 | #pragma db object 13 | struct CppMacro : CppEntity 14 | { 15 | std::string toString() const 16 | { 17 | std::string ret("CppMacro"); 18 | 19 | ret 20 | .append("\nid = ").append(std::to_string(id)) 21 | .append("\nentityHash = ").append(std::to_string(entityHash)) 22 | .append("\nqualifiedName = ").append(qualifiedName); 23 | 24 | if (!tags.empty()) 25 | { 26 | ret.append("\ntags ="); 27 | for (const Tag& tag : tags) 28 | ret.append(' ' + tagToString(tag)); 29 | } 30 | 31 | return ret; 32 | } 33 | 34 | }; 35 | 36 | typedef std::shared_ptr CppMacroPtr; 37 | 38 | } // model 39 | } // cc 40 | 41 | #endif // CC_MODEL_CPPMACRO_H 42 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppmacroexpansion.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_MACROEXPANSION_H 2 | #define CC_MODEL_MACROEXPANSION_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "cppastnode.h" 11 | 12 | namespace cc 13 | { 14 | namespace model 15 | { 16 | 17 | #pragma db object 18 | struct CppMacroExpansion 19 | { 20 | #pragma db id auto 21 | int id; 22 | 23 | // #pragma db unique 24 | #pragma db not_null 25 | CppAstNodeId astNodeId; 26 | 27 | std::string expansion; 28 | 29 | std::string toString() const 30 | { 31 | std::string ret("CppMacroExpansion"); 32 | 33 | ret 34 | .append("\nid = ").append(std::to_string(id)) 35 | .append("\nexpansion = ").append(expansion) 36 | .append("\nastNodeId = ").append(std::to_string(astNodeId)); 37 | 38 | return ret; 39 | } 40 | }; 41 | 42 | typedef std::shared_ptr CppMacroExpansionPtr; 43 | 44 | #pragma db view object(CppMacroExpansion) 45 | struct CppMacroExpansionCount 46 | { 47 | #pragma db column("count(" + CppMacroExpansion::id + ")") 48 | std::size_t count; 49 | }; 50 | 51 | } // model 52 | } // cc 53 | 54 | #endif //CC_MODEL_MACROEXPANSION_H 55 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppnamespace.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPNAMESPACE_H 2 | #define CC_MODEL_CPPNAMESPACE_H 3 | 4 | #include "cppentity.h" 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | #pragma db object 12 | struct CppNamespace : CppEntity 13 | { 14 | std::string toString() const 15 | { 16 | std::string ret("CppNamespace"); 17 | 18 | ret 19 | .append("\nid = ").append(std::to_string(id)) 20 | .append("\nentityHash = ").append(std::to_string(entityHash)) 21 | .append("\nqualifiedName = ").append(qualifiedName); 22 | 23 | if (!tags.empty()) 24 | { 25 | ret.append("\ntags ="); 26 | for (const Tag& tag : tags) 27 | ret.append(' ' + tagToString(tag)); 28 | } 29 | 30 | return ret; 31 | } 32 | }; 33 | 34 | typedef std::shared_ptr CppNamespacePtr; 35 | 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppnamespacealias.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPNAMESPACEALIAS_H 2 | #define CC_MODEL_CPPNAMESPACEALIAS_H 3 | 4 | #include "cppentity.h" 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | #pragma db object 12 | struct CppNamespaceAlias : CppEntity 13 | { 14 | std::string toString() const 15 | { 16 | std::string ret("CppNamespaceAlias"); 17 | 18 | ret 19 | .append("\nid = ").append(std::to_string(id)) 20 | .append("\nentityHash = ").append(std::to_string(entityHash)) 21 | .append("\nqualifiedName = ").append(qualifiedName); 22 | 23 | if (!tags.empty()) 24 | { 25 | ret.append("\ntags ="); 26 | for (const Tag& tag : tags) 27 | ret.append(' ' + tagToString(tag)); 28 | } 29 | 30 | return ret; 31 | } 32 | }; 33 | 34 | typedef std::shared_ptr CppNamespaceAliasPtr; 35 | 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cpprelation.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPRELATION_H 2 | #define CC_MODEL_CPPRELATION_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace cc 9 | { 10 | namespace model 11 | { 12 | 13 | #pragma db object 14 | struct CppRelation 15 | { 16 | enum class Kind 17 | { 18 | Override, 19 | Alias, 20 | Assign, 21 | DeclContext 22 | }; 23 | 24 | #pragma db id auto 25 | int id; 26 | 27 | std::uint64_t lhs; 28 | std::uint64_t rhs; 29 | 30 | Kind kind; 31 | 32 | std::string toString() const 33 | { 34 | return std::string("id = ").append(std::to_string(id)) 35 | .append("\nlhs = ").append(std::to_string(lhs)) 36 | .append("\nrhs = ").append(std::to_string(rhs)) 37 | .append("\nkind = ").append( 38 | kind == Kind::Override ? "Override" : 39 | kind == Kind::Alias ? "Alias" : 40 | kind == Kind::Assign ? "Assign" : "DeclContext"); 41 | } 42 | 43 | #pragma db index member(lhs) 44 | #pragma db index member(rhs) 45 | }; 46 | 47 | typedef std::shared_ptr CppRelationPtr; 48 | 49 | #pragma db view object(CppRelation) 50 | struct CppRelationCount 51 | { 52 | #pragma db column("count(" + CppRelation::id + ")") 53 | std::size_t count; 54 | }; 55 | 56 | } 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cpptypedef.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPTYPEDEF_H 2 | #define CC_MODEL_CPPTYPEDEF_H 3 | 4 | #include "cppentity.h" 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | #pragma db object 12 | struct CppTypedef : CppTypedEntity 13 | { 14 | std::string toString() const 15 | { 16 | return std::string("CppTypedef") 17 | .append("\nid = ").append(std::to_string(id)) 18 | .append("\nentityHash = ").append(std::to_string(entityHash)) 19 | .append("\nqualifiedName = ").append(qualifiedName) 20 | .append("\nqualifiedType = ").append(qualifiedType); 21 | } 22 | }; 23 | 24 | typedef std::shared_ptr CppTypedefPtr; 25 | 26 | #pragma db view object(CppTypedef) 27 | struct CppTypedefCount 28 | { 29 | #pragma db column("count(" + CppTypedef::id + ")") 30 | std::size_t count; 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /plugins/cpp/model/include/model/cppvariable.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPVARIABLE_H 2 | #define CC_MODEL_CPPVARIABLE_H 3 | 4 | #include "cppentity.h" 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | #pragma db object 12 | struct CppVariable : CppTypedEntity 13 | { 14 | std::string toString() const 15 | { 16 | return std::string("CppVariable") 17 | .append("\nid = ").append(std::to_string(id)) 18 | .append("\nentityHash = ").append(std::to_string(entityHash)) 19 | .append("\nqualifiedName = ").append(qualifiedName) 20 | .append("\nqualifiedType = ").append(qualifiedType); 21 | } 22 | }; 23 | 24 | typedef std::shared_ptr CppVariablePtr; 25 | 26 | } 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/diagnosticmessagehandler.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_DIAGNOSTICMESSAGEHANDLER_H 2 | #define CC_PARSER_DIAGNOSTICMESSAGEHANDLER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace cc 11 | { 12 | namespace parser 13 | { 14 | 15 | class DiagnosticMessageHandler : public clang::TextDiagnosticPrinter 16 | { 17 | public: 18 | DiagnosticMessageHandler( 19 | clang::DiagnosticOptions* diags, 20 | SourceManager& srcMgr_, 21 | std::shared_ptr db_); 22 | ~DiagnosticMessageHandler(); 23 | 24 | void HandleDiagnostic( 25 | clang::DiagnosticsEngine::Level diagLevel_, 26 | const clang::Diagnostic& info_) override; 27 | 28 | private: 29 | SourceManager& _srcMgr; 30 | std::vector _messages; 31 | std::shared_ptr _db; 32 | }; 33 | 34 | } 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/doccommentformatter.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_DOCCOMMENTFORMATTER_H 2 | #define CC_PARSER_DOCCOMMENTFORMATTER_H 3 | 4 | #include 5 | 6 | namespace cc 7 | { 8 | namespace parser 9 | { 10 | 11 | /** 12 | * Converts a clang::comments::FullComment into a Markdown text. 13 | */ 14 | class DocCommentFormatter 15 | { 16 | public: 17 | 18 | /** 19 | * Converts a clang::comments::FullComment into a Markdown text. 20 | * 21 | * @param fc The comment to be formatted. 22 | * @return the Markdown-formatted string. 23 | */ 24 | std::string format( 25 | clang::comments::FullComment* fc, 26 | const clang::ASTContext& ctx_); 27 | }; 28 | 29 | } // parser 30 | } // cc 31 | 32 | #endif //CC_PARSER_DOCCOMMENTFORMATTER_H 33 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/entitycache.cpp: -------------------------------------------------------------------------------- 1 | #include "entitycache.h" 2 | 3 | namespace cc 4 | { 5 | namespace parser 6 | { 7 | 8 | bool EntityCache::insert(const model::CppAstNode& node_) 9 | { 10 | std::lock_guard guard(_cacheMutex); 11 | return _entityCache.insert( 12 | std::make_pair(node_.id, node_.entityHash)).second; 13 | } 14 | 15 | std::uint64_t EntityCache::at(const model::CppAstNodeId& id_) const 16 | { 17 | std::lock_guard guard(_cacheMutex); 18 | return _entityCache.at(id_); 19 | } 20 | 21 | void EntityCache::clear() 22 | { 23 | _entityCache.clear(); 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/entitycache.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_ENTITYCACHE_H 2 | #define CC_PARSER_ENTITYCACHE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace cc 10 | { 11 | namespace parser 12 | { 13 | 14 | /** 15 | * Thread safe entity cache. 16 | */ 17 | class EntityCache 18 | { 19 | public: 20 | /** 21 | * This function inserts a model::CppAstNodeId to a cache in a 22 | * thread-safe way. 23 | * @return If the insertion was successful (i.e. the cache didn't contain the 24 | * id before) then the function returns true. 25 | */ 26 | bool insert(const model::CppAstNode& node_); 27 | 28 | /** 29 | * Returns a reference to the mapped value of the element with key equivalent 30 | * to id_. If no such element exists, an exception of type 31 | * std::out_of_range is thrown. 32 | */ 33 | std::uint64_t at(const model::CppAstNodeId& id_) const; 34 | 35 | /** 36 | * Removes all elements from the cache. 37 | */ 38 | void clear(); 39 | 40 | private: 41 | std::unordered_map _entityCache; 42 | mutable std::mutex _cacheMutex; 43 | }; 44 | 45 | } // parser 46 | } // cc 47 | 48 | #endif // CC_PARSER_ENTITYCACHE_H 49 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/relationcollector.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_RELATIONCOLLECTOR_H 2 | #define CC_PARSER_RELATIONCOLLECTOR_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace cc 20 | { 21 | namespace parser 22 | { 23 | 24 | class RelationCollector : public clang::RecursiveASTVisitor 25 | { 26 | public: 27 | RelationCollector( 28 | ParserContext& ctx_, 29 | clang::ASTContext& astContext_); 30 | 31 | ~RelationCollector(); 32 | 33 | bool VisitFunctionDecl(clang::FunctionDecl* fd_); 34 | 35 | bool VisitValueDecl(clang::ValueDecl* vd_); 36 | 37 | bool VisitCallExpr(clang::CallExpr* ce_); 38 | 39 | static void cleanUp(); 40 | 41 | private: 42 | void addEdge( 43 | const model::FileId& from_, 44 | const model::FileId& to_, 45 | model::CppEdge::Type type_, 46 | model::CppEdgeAttributePtr attr_ = nullptr); 47 | 48 | ParserContext& _ctx; 49 | 50 | static std::unordered_set _edgeCache; 51 | static std::unordered_set _edgeAttrCache; 52 | static std::mutex _edgeCacheMutex; 53 | 54 | std::vector _newEdges; 55 | std::vector _newEdgeAttributes; 56 | 57 | FileLocUtil _fileLocUtil; 58 | }; 59 | 60 | } // parser 61 | } // cc 62 | 63 | #endif // CC_PARSER_RELATIONCOLLECTOR_H 64 | -------------------------------------------------------------------------------- /plugins/cpp/parser/src/symbolhelper.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_SYMBOLHELPER_H 2 | #define CC_PARSER_SYMBOLHELPER_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace cc 13 | { 14 | namespace parser 15 | { 16 | 17 | const clang::Type* getStrippedType(const clang::QualType& qt_); 18 | 19 | std::string getUSR(const clang::NamedDecl* nd_); 20 | std::string getUSR(const clang::QualType& qt_, clang::ASTContext& ctx_); 21 | 22 | bool isFunction(const clang::Type* type_); 23 | 24 | std::string getSignature(const clang::FunctionDecl* fn_); 25 | 26 | /** 27 | * Returns the source range of the prototype part of a tag declaration. If it's 28 | * a definition then this range ends before the opening curly brace, otherwise 29 | * at the end of the declaration. 30 | * For example: 31 | * template struct S { int i; }; 32 | * ^ ^ 33 | * enum Color; 34 | * ^ ^ 35 | */ 36 | std::string getDeclPartAsString( 37 | const clang::SourceManager& srcMgr_, 38 | const clang::TagDecl* td_); 39 | 40 | /** 41 | * This function returns the source code fragment between the given source 42 | * locations. inclusiveEnd determines whether the end of the range is 43 | * inclusive, i.e. the token starting at "to" is also the part of returned code 44 | * text. 45 | */ 46 | std::string getSourceText( 47 | const clang::SourceManager& srcMgr_, 48 | clang::SourceLocation from_, 49 | clang::SourceLocation to_, 50 | bool inclusiveEnd_ = false); 51 | 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /plugins/cpp/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/util/include 4 | ${PROJECT_SOURCE_DIR}/webserver/include 5 | ${PROJECT_SOURCE_DIR}/model/include 6 | ${PROJECT_BINARY_DIR}/service/language/gen-cpp 7 | ${PROJECT_BINARY_DIR}/service/project/gen-cpp 8 | ${PROJECT_SOURCE_DIR}/service/project/include 9 | ${PLUGIN_DIR}/model/include) 10 | 11 | include_directories(SYSTEM 12 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 13 | 14 | add_library(cppservice SHARED 15 | src/cppservice.cpp 16 | src/plugin.cpp 17 | src/diagram.cpp 18 | src/filediagram.cpp) 19 | 20 | target_compile_options(cppservice PUBLIC -Wno-unknown-pragmas) 21 | 22 | target_link_libraries(cppservice 23 | util 24 | model 25 | cppmodel 26 | mongoose 27 | projectservice 28 | languagethrift 29 | gvc 30 | ${THRIFT_LIBTHRIFT_LIBRARIES}) 31 | 32 | install(TARGETS cppservice DESTINATION ${INSTALL_SERVICE_DIR}) 33 | -------------------------------------------------------------------------------- /plugins/cpp/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | boost::program_options::options_description description("C++ Plugin"); 12 | return description; 13 | } 14 | 15 | void registerPlugin( 16 | const cc::webserver::ServerContext& context_, 17 | cc::webserver::PluginHandler* pluginHandler_) 18 | { 19 | cc::webserver::registerPluginSimple( 20 | context_, 21 | pluginHandler_, 22 | CODECOMPASS_LANGUAGE_SERVICE_FACTORY_WITH_CFG(Cpp), 23 | "CppService"); 24 | } 25 | } 26 | #pragma clang diagnostic pop 27 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(CppTestProject) 3 | 4 | # This is a dummy CMakeList that can be used to generate a build for the 5 | # C++ test input files. 6 | 7 | add_library(CppTestProject STATIC 8 | typedef.cpp 9 | cxxrecord.cpp 10 | enum.cpp 11 | function.cpp 12 | using.cpp 13 | variable.cpp 14 | namespace.cpp) 15 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/cxxrecord.cpp: -------------------------------------------------------------------------------- 1 | class MyClass; 2 | class MyClass 3 | { 4 | public: 5 | virtual void virtualFunction() {} 6 | void nonVirtualFunction () {} 7 | int memberVariable; 8 | }; 9 | 10 | MyClass globalVariable; 11 | 12 | MyClass function( 13 | const MyClass& param) 14 | { 15 | MyClass localVariable; 16 | MyClass localVariable2(localVariable); 17 | MyClass localVariable3 = localVariable; 18 | try 19 | { 20 | throw MyClass(); 21 | } 22 | catch (const MyClass&) 23 | { 24 | } 25 | return localVariable; 26 | } 27 | 28 | typedef MyClass MyClass2; 29 | 30 | struct Derived : public MyClass 31 | { 32 | MyClass fieldVariable; 33 | MyClass (*fieldFunction)(const MyClass&); 34 | Derived() : 35 | fieldVariable(MyClass()), 36 | fieldFunction(function) 37 | { 38 | MyClass* ptr = new MyClass; 39 | ptr->virtualFunction(); 40 | ptr->nonVirtualFunction(); 41 | delete ptr; 42 | ptr = new MyClass[10]; 43 | delete[] ptr; 44 | ptr->memberVariable; 45 | ptr->memberVariable = 42; 46 | } 47 | void memberFunction(); 48 | }; 49 | 50 | void Derived::memberFunction() {} 51 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/enum.cpp: -------------------------------------------------------------------------------- 1 | enum Enumeration : short; 2 | enum Enumeration : short 3 | { 4 | First, 5 | Second, 6 | Third 7 | }; 8 | 9 | Enumeration globalEnum; 10 | 11 | Enumeration enumUserFunction( 12 | Enumeration funcParamEnumeration) 13 | { 14 | Enumeration localEnumeration = First; 15 | enumUserFunction(Enumeration()); 16 | typedef Enumeration Enumeration2; 17 | 18 | try 19 | { 20 | throw localEnumeration; 21 | } 22 | catch (Enumeration e) 23 | { 24 | } 25 | 26 | return localEnumeration; 27 | } 28 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/function.cpp: -------------------------------------------------------------------------------- 1 | void singleFunc() 2 | { 3 | 4 | } 5 | 6 | void funcDecl(); 7 | 8 | void multiFunction(); 9 | void multiFunction(); 10 | void multiFunction() {} 11 | 12 | int callee(char c, bool b) 13 | { 14 | int i = b + c - 42; 15 | return i; 16 | } 17 | 18 | void caller() 19 | { 20 | callee('x', true); 21 | } 22 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/namespace.cpp: -------------------------------------------------------------------------------- 1 | namespace MyNamespace1 2 | { 3 | namespace MyNamespace2 4 | { 5 | void innerFunction () {} 6 | } 7 | } 8 | 9 | void namespaceUserFunction() 10 | { 11 | using namespace MyNamespace1; 12 | MyNamespace2::innerFunction(); 13 | } 14 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/typedef.cpp: -------------------------------------------------------------------------------- 1 | typedef int Integer; 2 | 3 | Integer globalInteger; 4 | 5 | Integer typedefUserFunction( 6 | Integer funcParamInteger) 7 | { 8 | Integer localInteger; 9 | typedefUserFunction(Integer()); 10 | typedef Integer Integer2; 11 | 12 | try 13 | { 14 | throw localInteger; 15 | } 16 | catch (Integer i) 17 | { 18 | } 19 | 20 | return localInteger; 21 | } 22 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/using.cpp: -------------------------------------------------------------------------------- 1 | namespace Nested 2 | { 3 | namespace MyNamespace 4 | { 5 | class C 6 | { 7 | }; 8 | 9 | void g(C) { } 10 | 11 | void g(double) { } 12 | 13 | constexpr C VAR1{}; 14 | 15 | template 16 | constexpr T VAR2 = T{}; 17 | } 18 | } 19 | 20 | using namespace Nested; 21 | void g() {} 22 | using MyNamespace::g; 23 | 24 | void using_fun() 25 | { 26 | using MyNamespace::C; 27 | using MyNamespace::VAR1; 28 | using MyNamespace::VAR2; 29 | 30 | g(); 31 | g(VAR1); 32 | g(VAR2); 33 | } -------------------------------------------------------------------------------- /plugins/cpp/test/sources/parser/variable.cpp: -------------------------------------------------------------------------------- 1 | struct S{}; 2 | 3 | void f(int) {} 4 | void g(int&) {} 5 | 6 | void varContainingFunction() 7 | { 8 | int variableDefinition; 9 | extern bool variableDeclaration; 10 | int (*variableFunctionPointer)(char, double); 11 | S variableUserType; 12 | 13 | f(variableDefinition); 14 | g(variableDefinition); 15 | } 16 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(CppTestProject) 3 | 4 | # This is a dummy CMakeList that can be used to generate a build for the 5 | # C++ test input files. 6 | 7 | add_library(CppTestProject STATIC 8 | inheritance.cpp 9 | nestedclass.cpp 10 | simpleclass.cpp) 11 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/inheritance.cpp: -------------------------------------------------------------------------------- 1 | #include "inheritance.h" 2 | 3 | namespace cc 4 | { 5 | namespace test 6 | { 7 | 8 | const int DerivedClass::Z = 10; /*!< TODO: InfoTree: DerivedClass */ 9 | 10 | BaseClass1::~BaseClass1() 11 | { 12 | 13 | } 14 | 15 | void BaseClass1::f() 16 | { 17 | 18 | } 19 | 20 | void BaseClass1::g() 21 | { 22 | 23 | } 24 | 25 | BaseClass2::~BaseClass2() 26 | { 27 | 28 | } 29 | 30 | void BaseClass2::f() 31 | { 32 | 33 | } 34 | 35 | void BaseClass2::h() const 36 | { 37 | 38 | } 39 | 40 | void DerivedClass::f() 41 | { 42 | _protBaseX = 10; 43 | } 44 | 45 | void DerivedClass::g() 46 | { 47 | 48 | } 49 | 50 | void DerivedClass::h() const 51 | { 52 | 53 | } 54 | 55 | } // test 56 | } // cc 57 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/inheritance.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_TEST_INHERITANCE_H 2 | #define CC_TEST_INHERITANCE_H 3 | 4 | namespace cc 5 | { 6 | namespace test 7 | { 8 | 9 | class BaseClass1{ 10 | public: 11 | virtual ~BaseClass1(); 12 | virtual void f() = 0; 13 | virtual void g(); 14 | 15 | int _pubBaseX; 16 | 17 | protected: 18 | int _protBaseX; 19 | }; 20 | 21 | class BaseClass2{ 22 | public: 23 | virtual ~BaseClass2(); 24 | virtual void f() = 0; 25 | virtual void h() const; 26 | 27 | protected: 28 | int _protBaseY; 29 | }; 30 | 31 | class DerivedClass : protected BaseClass1, protected BaseClass2 32 | { 33 | public: 34 | static const int Z; 35 | 36 | void f() override; 37 | 38 | void g() override; 39 | 40 | void h() const override; 41 | }; 42 | 43 | } // test 44 | } // cc 45 | 46 | #endif // CC_TEST_INHERITANCE_H 47 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/nestedclass.cpp: -------------------------------------------------------------------------------- 1 | #include "nestedclass.h" 2 | 3 | namespace cc 4 | { 5 | namespace test 6 | { 7 | 8 | const int NestedClass::InnerClass::staticInt = 1; 9 | 10 | void NestedClass::InnerClass::f(int param_) /*!< TODO: InfoTree: NestedClass and InnerClass */ 11 | { 12 | } 13 | 14 | NestedClass::InnerClass NestedClass::createNestedClass() /*!< TODO: InfoTree: first NestedClass */ 15 | { 16 | return InnerClass(); /*!< TODO: InfoTree: InnerClass */ 17 | } 18 | 19 | } // test 20 | } // cc 21 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/nestedclass.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_TEST_NESTEDCLASS_H 2 | #define CC_TEST_NESTEDCLASS_H 3 | 4 | namespace cc 5 | { 6 | namespace test 7 | { 8 | 9 | class NestedClass{ 10 | private: 11 | class InnerClass; 12 | 13 | struct InnerClass /*!< TODO: InfoTree: InnerClass */ 14 | { 15 | int innerX; 16 | static const int staticInt; 17 | void f(int param_); 18 | }; 19 | 20 | public: 21 | static InnerClass createNestedClass(); 22 | }; 23 | 24 | struct List 25 | { 26 | struct Node 27 | { 28 | int data; 29 | Node* next; 30 | Node* prev; 31 | }; 32 | 33 | Node* head; 34 | Node* tail; 35 | }; 36 | 37 | } // test 38 | } // cc 39 | 40 | #endif // CC_TEST_NESTEDCLASS_H 41 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/simpleclass.cpp: -------------------------------------------------------------------------------- 1 | #include "simpleclass.h" 2 | 3 | namespace cc 4 | { 5 | namespace test 6 | { 7 | 8 | SimpleClass::SimpleClass() : _locPrivX(-1), _locProtX(-1) 9 | { 10 | } 11 | 12 | SimpleClass::~SimpleClass() 13 | { 14 | } 15 | 16 | int SimpleClass::getPrivX() const 17 | { 18 | return _locPrivX; 19 | } 20 | 21 | void SimpleClass::setPrivX(int x_) 22 | { 23 | _locPrivX = x_; 24 | } 25 | 26 | } // test 27 | } // cc 28 | -------------------------------------------------------------------------------- /plugins/cpp/test/sources/service/simpleclass.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_TEST_SIMPLECLASS_H 2 | #define CC_TEST_SIMPLECLASS_H 3 | 4 | namespace cc 5 | { 6 | namespace test 7 | { 8 | 9 | class SimpleClass 10 | { 11 | public: 12 | 13 | SimpleClass(); 14 | 15 | ~SimpleClass(); 16 | 17 | int getPrivX() const; 18 | 19 | void setPrivX(int x_); 20 | 21 | protected: 22 | int _locProtX; 23 | 24 | private: 25 | int _locPrivX; 26 | }; 27 | 28 | } // test 29 | } // cc 30 | 31 | #endif // CC_TEST_SIMPLECLASS_H 32 | -------------------------------------------------------------------------------- /plugins/cpp/test/src/cpptest.cpp: -------------------------------------------------------------------------------- 1 | #define GTEST_HAS_TR1_TUPLE 1 2 | #define GTEST_USE_OWN_TR1_TUPLE 0 3 | 4 | #include 5 | 6 | const char* dbConnectionString; 7 | 8 | int main(int argc, char** argv) 9 | { 10 | dbConnectionString = argv[3]; 11 | if (strcmp(dbConnectionString, "") == 0) 12 | { 13 | GTEST_LOG_(FATAL) << "No test database connection given."; 14 | return 1; 15 | } 16 | 17 | GTEST_LOG_(INFO) << "Testing C++ started..."; 18 | GTEST_LOG_(INFO) << "Executing build command: " << argv[1]; 19 | system(argv[1]); 20 | 21 | GTEST_LOG_(INFO) << "Executing parser command: " << argv[2]; 22 | system(argv[2]); 23 | 24 | GTEST_LOG_(INFO) << "Using database for tests: " << dbConnectionString; 25 | ::testing::InitGoogleTest(&argc, argv); 26 | return RUN_ALL_TESTS(); 27 | } 28 | -------------------------------------------------------------------------------- /plugins/cpp/webgui/images/cpp_collaboration_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/cpp/webgui/images/cpp_collaboration_diagram.png -------------------------------------------------------------------------------- /plugins/cpp/webgui/images/cpp_detailed_class_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/cpp/webgui/images/cpp_detailed_class_diagram.png -------------------------------------------------------------------------------- /plugins/cpp/webgui/images/cpp_function_call_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/cpp/webgui/images/cpp_function_call_diagram.png -------------------------------------------------------------------------------- /plugins/cpp/webgui/userguide/userguide.md: -------------------------------------------------------------------------------- 1 | \section userguide_cpp Cpp Plugin 2 | 3 | \subsection userguide_cpp_diagrams_functioncall Function Call Diagram 4 | Function call diagram shows the called and caller functions of the current one 5 | (yellow node). Called functions are drawn in blue and connected with blue 6 | arrows, like caller functions and their arrows are red. 7 | 8 | In C++ it is possible to call virtual functions which may have several 9 | overridings. In this case the virtual function has diamond shape from which 10 | overrider functions point out with dashed arrows. (Callers of a virtual 11 | function are also connected with dashed arrow). 12 | 13 | ![Diagram view](images/cpp_function_call_diagram.png) 14 | 15 | \subsection userguide_cpp_diagrams_detailt_uml_class Detailed Class Diagram 16 | 17 | This is a classical UML class diagram for the selected class and its direct 18 | children and parents. The nodes contain the methods and member variables 19 | with their visibility. 20 | 21 | ![Diagram view](images/cpp_detailed_class_diagram.png) 22 | 23 | Visibilities: 24 | - + public 25 | - # protected 26 | - - private 27 | 28 | The meaning of special text format: 29 | - static methods and variables 30 | - virtual methods 31 | 32 | \subsection userguide_cpp_diagrams_collaboration Class Collaboration Diagram 33 | 34 | This returns a class collaboration diagram which shows the individual class 35 | members and their inheritance hierarchy. 36 | 37 | ![Diagram view](images/cpp_collaboration_diagram.png) -------------------------------------------------------------------------------- /plugins/cpp_lsp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The C++ lsp plugin depends on the C++ plugin's components to be built. 2 | 3 | if ("${cpp_PLUGIN_DIR}" STREQUAL "") 4 | # Use SEND_ERROR here so a build file is not generated at the end. 5 | # CodeCompass might use a lot of plugins and produce a lengthy build, so 6 | # a warning at configure time would easily be missed by the users. 7 | message(SEND_ERROR 8 | "C++ LSP plugin found without C++ plugin in the plugins directory.") 9 | endif() 10 | 11 | add_subdirectory(service) 12 | -------------------------------------------------------------------------------- /plugins/cpp_lsp/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${PROJECT_BINARY_DIR}/service/language/gen-cpp 5 | ${PROJECT_BINARY_DIR}/service/project/gen-cpp 6 | ${PROJECT_SOURCE_DIR}/service/project/include 7 | ${PROJECT_SOURCE_DIR}/plugins/cpp/service/include 8 | ${PROJECT_SOURCE_DIR}/plugins/cpp/model/include 9 | ${CMAKE_BINARY_DIR}/model/include 10 | ${CMAKE_BINARY_DIR}/plugins/cpp/model/include 11 | ${PROJECT_SOURCE_DIR}/util/include 12 | ${PROJECT_SOURCE_DIR}/webserver/include 13 | ${PROJECT_SOURCE_DIR}/service/lsp/include) 14 | 15 | include_directories(SYSTEM 16 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 17 | 18 | add_library(cpplspservice SHARED 19 | src/cpplspservice.cpp 20 | src/plugin.cpp) 21 | 22 | target_link_libraries(cpplspservice 23 | cppservice 24 | lspservice 25 | util 26 | ${THRIFT_LIBTHRIFT_LIBRARIES}) 27 | 28 | install(TARGETS cpplspservice DESTINATION ${INSTALL_SERVICE_DIR}) 29 | -------------------------------------------------------------------------------- /plugins/cpp_lsp/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 12 | extern "C" 13 | { 14 | boost::program_options::options_description getOptions() 15 | { 16 | boost::program_options::options_description description("LSP Plugin"); 17 | 18 | return description; 19 | } 20 | 21 | void registerPlugin( 22 | const cc::webserver::ServerContext& context_, 23 | cc::webserver::PluginHandler* pluginHandler_) 24 | { 25 | cc::webserver::registerPluginSimple( 26 | context_, 27 | pluginHandler_, 28 | CODECOMPASS_LSP_SERVICE_FACTORY_WITH_CFG(Cpp, lsp), 29 | "CppLspService"); 30 | } 31 | } 32 | #pragma clang diagnostic pop 33 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The C++ metrics plugin depends on the C++ plugin's components to be built. 2 | 3 | if ("${cpp_PLUGIN_DIR}" STREQUAL "") 4 | # Use SEND_ERROR here so a build file is not generated at the end. 5 | # CodeCompass might use a lot of plugins and produce a lengthy build, so 6 | # a warning at configure time would easily be missed by the users. 7 | message(SEND_ERROR 8 | "C++ Metrics plugin found without C++ plugin in the plugins directory.") 9 | endif() 10 | 11 | add_subdirectory(model) 12 | add_subdirectory(parser) 13 | add_subdirectory(service) 14 | add_subdirectory(test) 15 | 16 | #install_webplugin(webgui) 17 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${cpp_PLUGIN_DIR}/model/include) 4 | 5 | set(ODB_SOURCES 6 | include/model/cppastnodemetrics.h 7 | include/model/cppcohesionmetrics.h 8 | include/model/cppfilemetrics.h 9 | include/model/cpptypedependencymetrics.h) 10 | 11 | generate_odb_files("${ODB_SOURCES}" "cpp") 12 | 13 | add_odb_library(cppmetricsmodel ${ODB_CXX_SOURCES}) 14 | target_link_libraries(cppmetricsmodel cppmodel) 15 | 16 | install_sql() 17 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/model/include/model/cppfilemetrics.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_CPPFILEMETRICS_H 2 | #define CC_MODEL_CPPFILEMETRICS_H 3 | 4 | #include 5 | 6 | namespace cc 7 | { 8 | namespace model 9 | { 10 | 11 | #pragma db object 12 | struct CppFileMetrics 13 | { 14 | enum Type 15 | { 16 | EFFERENT_MODULE = 1, 17 | AFFERENT_MODULE = 2, 18 | RELATIONAL_COHESION_MODULE = 3 19 | }; 20 | 21 | #pragma db id auto 22 | std::uint64_t id; 23 | 24 | #pragma db not_null 25 | FileId file; 26 | 27 | #pragma db not_null 28 | Type type; 29 | 30 | #pragma db not_null 31 | double value; 32 | }; 33 | 34 | #pragma db view \ 35 | object(CppFileMetrics) \ 36 | object(File : CppFileMetrics::file == File::id) 37 | struct CppModuleMetricsForPathView 38 | { 39 | #pragma db column(CppFileMetrics::file) 40 | FileId fileId; 41 | 42 | #pragma db column(File::path) 43 | std::string path; 44 | 45 | #pragma db column(CppFileMetrics::type) 46 | CppFileMetrics::Type type; 47 | 48 | #pragma db column(CppFileMetrics::value) 49 | double value; 50 | }; 51 | 52 | #pragma db view \ 53 | object(CppFileMetrics) \ 54 | object(File : CppFileMetrics::file == File::id) \ 55 | query(distinct) 56 | struct CppModuleMetricsDistinctView 57 | { 58 | #pragma db column(CppFileMetrics::file) 59 | FileId fileId; 60 | }; 61 | 62 | } //model 63 | } //cc 64 | 65 | #endif //CC_MODEL_CPPFILEMETRICS_H 66 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/parser/include 6 | ${PROJECT_SOURCE_DIR}/plugins/cpp/model/include 7 | ${PROJECT_BINARY_DIR}/plugins/cpp/model/include 8 | ${PLUGIN_DIR}/model/include) 9 | 10 | add_library(cxxmetricsparser SHARED 11 | src/cppmetricsparser.cpp) 12 | 13 | target_link_libraries(cxxmetricsparser 14 | cppmetricsmodel 15 | model 16 | util 17 | ${Boost_LIBRARIES}) 18 | 19 | install(TARGETS cxxmetricsparser 20 | LIBRARY DESTINATION ${INSTALL_LIB_DIR} 21 | DESTINATION ${INSTALL_PARSER_DIR}) 22 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | namespace po = boost::program_options; 12 | 13 | po::options_description description("Cpp Metrics Plugin"); 14 | 15 | return description; 16 | } 17 | 18 | void registerPlugin( 19 | const cc::webserver::ServerContext& context_, 20 | cc::webserver::PluginHandler* pluginHandler_) 21 | { 22 | cc::webserver::registerPluginSimple( 23 | context_, 24 | pluginHandler_, 25 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(CppMetrics, cppmetrics), 26 | "CppMetricsService"); 27 | } 28 | } 29 | #pragma clang diagnostic pop 30 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(CppMetricsTestProject) 3 | 4 | add_library(CppMetricsTestProject STATIC 5 | functionmccabe.cpp 6 | typemccabe.cpp 7 | lackofcohesion.cpp 8 | bumpyroad.cpp 9 | afferentcoupling.cpp 10 | modulemetrics.cpp) 11 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_a/a1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_A1 2 | #define CC_CPP_MODULE_METRICS_TEST_A1 3 | 4 | #include "./a2.h" 5 | 6 | namespace CC_CPP_MODULE_METRICS_TEST 7 | { 8 | class A1 { 9 | A2 a2; 10 | }; 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_a/a2.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_A2 2 | #define CC_CPP_MODULE_METRICS_TEST_A2 3 | 4 | #include "../module_b/b1.h" 5 | 6 | namespace CC_CPP_MODULE_METRICS_TEST 7 | { 8 | class A2 { 9 | B1 b1; 10 | }; 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_b/b1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_B1 2 | #define CC_CPP_MODULE_METRICS_TEST_B1 3 | 4 | #include "./b2.h" 5 | 6 | namespace CC_CPP_MODULE_METRICS_TEST 7 | { 8 | class B1 { 9 | B2 b2; 10 | }; 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_b/b2.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_B2 2 | #define CC_CPP_MODULE_METRICS_TEST_B2 3 | 4 | namespace CC_CPP_MODULE_METRICS_TEST 5 | { 6 | class B2 {}; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_c/c1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_C1 2 | #define CC_CPP_MODULE_METRICS_TEST_C1 3 | 4 | #include "../module_b/b1.h" 5 | #include "./c2.h" 6 | 7 | namespace CC_CPP_MODULE_METRICS_TEST 8 | { 9 | class C1 { 10 | B1 b1; 11 | C2 c2; 12 | }; 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_c/c2.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_C2 2 | #define CC_CPP_MODULE_METRICS_TEST_C2 3 | 4 | #include "../module_a/a2.h" 5 | #include "../module_b/b1.h" 6 | 7 | namespace CC_CPP_MODULE_METRICS_TEST 8 | { 9 | class C2 { 10 | A2 a2; 11 | B1 b1; 12 | }; 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/module_d/d1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_MODULE_METRICS_TEST_D1 2 | #define CC_CPP_MODULE_METRICS_TEST_D1 3 | 4 | #include "../module_c/c1.h" 5 | #include "../module_c/c2.h" 6 | 7 | namespace CC_CPP_MODULE_METRICS_TEST 8 | { 9 | class D1 { 10 | C1 c1; 11 | C2 c2; 12 | }; 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/modulemetrics.cpp: -------------------------------------------------------------------------------- 1 | #include "./module_a/a1.h" 2 | #include "./module_a/a2.h" 3 | #include "./module_b/b1.h" 4 | #include "./module_b/b2.h" 5 | #include "./module_c/c1.h" 6 | #include "./module_c/c2.h" 7 | #include "./module_d/d1.h" 8 | 9 | #include "./rc_module_a/a1.h" 10 | #include "./rc_module_a/a2.h" 11 | #include "./rc_module_a/a3.h" 12 | #include "./rc_module_b/b1.h" 13 | #include "./rc_module_c/c1.h" 14 | #include "./rc_module_c/c2.h" 15 | #include "./rc_module_c/c3.h" 16 | #include "./rc_module_c/c4.h" 17 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_a/a1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_A1 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_A1 3 | 4 | #include "./a2.h" 5 | #include "./a3.h" 6 | 7 | namespace CC_CPP_RC_MODULE_METRICS_TEST 8 | { 9 | class A1 { 10 | A2 a2; 11 | A3 a3; 12 | }; 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_a/a2.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_A2 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_A2 3 | 4 | #include "./a3.h" 5 | 6 | namespace CC_CPP_RC_MODULE_METRICS_TEST 7 | { 8 | class A2 { 9 | A3 a3; 10 | }; 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_a/a3.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_A3 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_A3 3 | 4 | namespace CC_CPP_RC_MODULE_METRICS_TEST 5 | { 6 | class A3 {}; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_b/b1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_B1 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_B1 3 | 4 | namespace CC_CPP_RC_MODULE_METRICS_TEST 5 | { 6 | class B1 {}; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_c/c1.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_C1 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_C1 3 | 4 | #include "../rc_module_a/a1.h" 5 | #include "../rc_module_a/a2.h" 6 | #include "../rc_module_a/a3.h" 7 | 8 | namespace CC_CPP_RC_MODULE_METRICS_TEST 9 | { 10 | class C1 { 11 | A1 a1; 12 | A2 a2; 13 | A3 a3; 14 | }; 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_c/c2.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_C2 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_C2 3 | 4 | #include "./c1.h" 5 | 6 | namespace CC_CPP_RC_MODULE_METRICS_TEST 7 | { 8 | class C2 { 9 | C1 c1; 10 | }; 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_c/c3.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_C3 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_C3 3 | 4 | namespace CC_CPP_RC_MODULE_METRICS_TEST 5 | { 6 | class C3 {}; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/parser/rc_module_c/c4.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_CPP_RC_MODULE_METRICS_TEST_C4 2 | #define CC_CPP_RC_MODULE_METRICS_TEST_C4 3 | 4 | namespace CC_CPP_RC_MODULE_METRICS_TEST 5 | { 6 | class C4 {}; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/sources/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(CppMetricsTestProject) 3 | 4 | add_library(CppMetricsTestProject STATIC 5 | functionmccabe.cpp 6 | typemccabe.cpp 7 | lackofcohesion.cpp 8 | bumpyroad.cpp) 9 | -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/src/cppmetricsservicetest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | using namespace cc; 8 | using namespace service::cppmetrics; 9 | 10 | extern char* dbConnectionString; 11 | 12 | class CppMetricsServiceTest : public ::testing::Test 13 | { 14 | public: 15 | CppMetricsServiceTest() : 16 | _db(util::connectDatabase(dbConnectionString)), 17 | _transaction(_db), 18 | _cppservice(new CppMetricsServiceHandler( 19 | _db, 20 | std::make_shared(""), 21 | webserver::ServerContext(std::string(), 22 | boost::program_options::variables_map()))) 23 | { 24 | 25 | } 26 | 27 | protected: 28 | std::shared_ptr _db; 29 | util::OdbTransaction _transaction; 30 | std::shared_ptr _cppservice; 31 | }; -------------------------------------------------------------------------------- /plugins/cpp_metrics/test/src/cppmetricstest.cpp: -------------------------------------------------------------------------------- 1 | #define GTEST_HAS_TR1_TUPLE 1 2 | #define GTEST_USE_OWN_TR1_TUPLE 0 3 | 4 | #include 5 | 6 | #include 7 | 8 | const char* dbConnectionString; 9 | 10 | int main(int argc, char** argv) 11 | { 12 | dbConnectionString = argv[3]; 13 | if (strcmp(dbConnectionString, "") == 0) 14 | { 15 | GTEST_LOG_(FATAL) << "No test database connection given."; 16 | return 1; 17 | } 18 | 19 | GTEST_LOG_(INFO) << "Testing C++ metrics plugin started..."; 20 | GTEST_LOG_(INFO) << "Executing build command: " << argv[1]; 21 | system(argv[1]); 22 | 23 | GTEST_LOG_(INFO) << "Executing parser command: " << argv[2]; 24 | system(argv[2]); 25 | 26 | GTEST_LOG_(INFO) << "Using database for tests: " << dbConnectionString; 27 | ::testing::InitGoogleTest(&argc, argv); 28 | return RUN_ALL_TESTS(); 29 | } 30 | -------------------------------------------------------------------------------- /plugins/cpp_reparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The C++ reparser plugin depends on the C++ plugin's components to be built. 2 | 3 | if ("${cpp_PLUGIN_DIR}" STREQUAL "") 4 | # Use SEND_ERROR here so a build file is not generated at the end. 5 | # CodeCompass might use a lot of plugins and produce a lengthy build, so 6 | # a warning at configure time would easily be missed by the users. 7 | message(SEND_ERROR 8 | "C++ Reparse plugin found without C++ plugin in the plugins directory.") 9 | endif() 10 | 11 | add_subdirectory(service) 12 | 13 | install_webplugin(webgui) 14 | -------------------------------------------------------------------------------- /plugins/cpp_reparse/service/src/databasefilesystem.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_SERVICE_CPPREPARSESERVICE_DATABASEFILESYSTEM_H 2 | #define CC_SERVICE_CPPREPARSESERVICE_DATABASEFILESYSTEM_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace cc 13 | { 14 | namespace service 15 | { 16 | namespace reparse 17 | { 18 | 19 | /** 20 | * A Clang Virtual File System implementation that retrieves file information 21 | * and contents from CodeCompass' database. 22 | */ 23 | class DatabaseFileSystem : public llvm::vfs::FileSystem 24 | { 25 | public: 26 | DatabaseFileSystem(std::shared_ptr db_); 27 | 28 | virtual ~DatabaseFileSystem() = default; 29 | 30 | llvm::ErrorOr status(const llvm::Twine& path_) override; 31 | 32 | llvm::ErrorOr> 33 | openFileForRead(const llvm::Twine& path_) override; 34 | 35 | llvm::vfs::directory_iterator 36 | dir_begin(const llvm::Twine& dir_, std::error_code& ec_) override; 37 | 38 | llvm::ErrorOr getCurrentWorkingDirectory() const override; 39 | 40 | std::error_code setCurrentWorkingDirectory(const llvm::Twine& path_) override; 41 | 42 | private: 43 | std::shared_ptr _db; 44 | util::OdbTransaction _transaction; 45 | 46 | std::string _currentWorkingDirectory; 47 | }; 48 | 49 | } //namespace reparse 50 | } //namespace service 51 | } //namespace cc 52 | 53 | #endif // CC_SERVICE_CPPREPARSESERVICE_DATABASEFILESYSTEM_H 54 | 55 | -------------------------------------------------------------------------------- /plugins/cpp_reparse/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | namespace po = boost::program_options; 12 | 13 | boost::program_options::options_description description( 14 | "C++ Reparse Plugin"); 15 | 16 | description.add_options() 17 | ("disable-cpp-reparse", po::value()->default_value(false), 18 | "Turn off the reparse capabilities on the started server, even though " 19 | "the plugin is loaded."); 20 | 21 | description.add_options() 22 | ("ast-cache-limit", po::value()->default_value(10), 23 | "The maximum number of reparsed syntax trees that should be cached in " 24 | "memory."); 25 | 26 | return description; 27 | } 28 | 29 | void registerPlugin( 30 | const cc::webserver::ServerContext& context_, 31 | cc::webserver::PluginHandler* pluginHandler_) 32 | { 33 | cc::webserver::registerPluginSimple( 34 | context_, 35 | pluginHandler_, 36 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(CppReparse, language), 37 | "CppReparseService"); 38 | } 39 | } 40 | #pragma clang diagnostic pop 41 | -------------------------------------------------------------------------------- /plugins/cpp_reparse/webgui/js/cppReparseMenu.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'dojo/topic', 3 | 'dijit/Menu', 4 | 'dijit/MenuItem', 5 | 'dijit/PopupMenuItem', 6 | 'codecompass/model', 7 | 'codecompass/viewHandler'], 8 | function (topic, Menu, MenuItem, PopupMenuItem, model, viewHandler) { 9 | 10 | model.addService('cppreparseservice', 'CppReparseService', 11 | CppReparseServiceClient); 12 | 13 | if (!model.cppreparseservice.isEnabled()) 14 | // Don't create the menus if the server can't reparse. 15 | return; 16 | 17 | //--- Reparse menu for source codes ---// 18 | var nodeMenu = { 19 | id : 'cppreparse-node', 20 | render : function (nodeInfo, fileInfo) { 21 | if (fileInfo.type !== "CPP") 22 | return; 23 | 24 | var submenu = new Menu(); 25 | 26 | submenu.addChild(new MenuItem({ 27 | label : 'Show AST HTML', 28 | onClick : function () { 29 | topic.publish('codecompass/cppreparsenode', { 30 | fileInfo : fileInfo, 31 | nodeInfo : nodeInfo 32 | }); 33 | } 34 | })); 35 | 36 | return new PopupMenuItem({ 37 | label : 'C++', 38 | popup : submenu 39 | }); 40 | } 41 | }; 42 | 43 | viewHandler.registerModule(nodeMenu, { 44 | type : viewHandler.moduleType.TextContextMenu, 45 | priority : 10 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /plugins/dummy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(parser) 2 | #add_subdirectory(test) 3 | add_subdirectory(service) 4 | -------------------------------------------------------------------------------- /plugins/dummy/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/parser/include) 6 | 7 | add_library(dummyparser SHARED 8 | src/dummyparser.cpp) 9 | 10 | target_compile_options(dummyparser PUBLIC -Wno-unknown-pragmas) 11 | 12 | install(TARGETS dummyparser DESTINATION ${INSTALL_PARSER_DIR}) 13 | -------------------------------------------------------------------------------- /plugins/dummy/parser/include/dummyparser/dummyparser.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_DUMMYPARSER_H 2 | #define CC_PARSER_DUMMYPARSER_H 3 | 4 | #include 5 | #include 6 | 7 | namespace cc 8 | { 9 | namespace parser 10 | { 11 | 12 | class DummyParser : public AbstractParser 13 | { 14 | public: 15 | DummyParser(ParserContext& ctx_); 16 | virtual ~DummyParser(); 17 | virtual bool parse() override; 18 | private: 19 | bool accept(const std::string& path_); 20 | }; 21 | 22 | } // parser 23 | } // cc 24 | 25 | #endif // CC_PLUGINS_PARSER_DUMMYPARSER_H 26 | -------------------------------------------------------------------------------- /plugins/dummy/scripts/client.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | sys.path.append('gen-py') 4 | sys.path.append('thrift-0.9.3/lib/py/build/lib.linux-x86_64-2.7') 5 | 6 | from thrift import Thrift 7 | from thrift.transport import THttpClient 8 | from thrift.protocol import TJSONProtocol 9 | 10 | from dummy import DummyService 11 | 12 | #--- Server information ---# 13 | 14 | host = 'md-mtas2.tsp.eth.ericsson.se' 15 | port = 8080 16 | workspace = 'proba' 17 | 18 | #--- Create client objects ---# 19 | 20 | def create_client(service, service_name): 21 | '''This function initializes the Thrift client and returns the client objects 22 | to the API.''' 23 | 24 | path = '/' + workspace + '/' + service_name 25 | 26 | transport = THttpClient.THttpClient(host, port, path) 27 | protocol = TJSONProtocol.TJSONProtocol(transport) 28 | 29 | return service.Client(protocol) 30 | 31 | dummyservice = create_client(DummyService, 'DummyService') 32 | 33 | #--- Do the job ---# 34 | 35 | def main(): 36 | print dummyservice.getDummyString() 37 | 38 | if __name__ == "__main__": 39 | main() 40 | -------------------------------------------------------------------------------- /plugins/dummy/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/webserver/include) 6 | 7 | include_directories(SYSTEM 8 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 9 | 10 | add_custom_command( 11 | OUTPUT 12 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.cpp 13 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.h 14 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 15 | COMMAND 16 | ${THRIFT_EXECUTABLE} --gen cpp 17 | -o ${CMAKE_CURRENT_BINARY_DIR} 18 | ${CMAKE_CURRENT_SOURCE_DIR}/dummy.thrift 19 | DEPENDS 20 | ${CMAKE_CURRENT_SOURCE_DIR}/dummy.thrift 21 | COMMENT 22 | "Generating Thrift for dummy.thrift") 23 | 24 | add_library(dummythrift STATIC 25 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/DummyService.cpp) 26 | 27 | target_compile_options(dummythrift PUBLIC -fPIC) 28 | 29 | add_library(dummyservice SHARED 30 | src/dummyservice.cpp 31 | src/plugin.cpp) 32 | 33 | target_compile_options(dummyservice PUBLIC -Wno-unknown-pragmas) 34 | 35 | target_link_libraries(dummyservice 36 | util 37 | ${THRIFT_LIBTHRIFT_LIBRARIES} 38 | ${ODB_LIBRARIES} 39 | dummythrift) 40 | 41 | install(TARGETS dummyservice DESTINATION ${INSTALL_SERVICE_DIR}) 42 | -------------------------------------------------------------------------------- /plugins/dummy/service/dummy.thrift: -------------------------------------------------------------------------------- 1 | namespace cpp cc.service.dummy 2 | namespace java cc.service.dummy 3 | 4 | service DummyService 5 | { 6 | string getDummyString() 7 | } -------------------------------------------------------------------------------- /plugins/dummy/service/include/service/dummyservice.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_SERVICE_DUMMY_DUMMYSSERVICE_H 2 | #define CC_SERVICE_DUMMY_DUMMYSSERVICE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace cc 16 | { 17 | namespace service 18 | { 19 | namespace dummy 20 | { 21 | 22 | class DummyServiceHandler : virtual public DummyServiceIf 23 | { 24 | public: 25 | DummyServiceHandler( 26 | std::shared_ptr db_, 27 | std::shared_ptr datadir_, 28 | const cc::webserver::ServerContext& context_); 29 | 30 | void getDummyString(std::string& str_); 31 | 32 | private: 33 | std::shared_ptr _db; 34 | util::OdbTransaction _transaction; 35 | 36 | const boost::program_options::variables_map& _config; 37 | }; 38 | 39 | } // dummy 40 | } // service 41 | } // cc 42 | 43 | #endif // CC_SERVICE_DUMMY_DUMMYSSERVICE_H 44 | -------------------------------------------------------------------------------- /plugins/dummy/service/src/dummyservice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cc 5 | { 6 | namespace service 7 | { 8 | namespace dummy 9 | { 10 | 11 | DummyServiceHandler::DummyServiceHandler( 12 | std::shared_ptr db_, 13 | std::shared_ptr /*datadir_*/, 14 | const cc::webserver::ServerContext& context_) 15 | : _db(db_), _transaction(db_), _config(context_.options) 16 | { 17 | } 18 | 19 | void DummyServiceHandler::getDummyString(std::string& str_) 20 | { 21 | str_ = _config["dummy-result"].as(); 22 | } 23 | 24 | } // dummy 25 | } // service 26 | } // cc 27 | -------------------------------------------------------------------------------- /plugins/dummy/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | /* These two methods are used by the plugin manager to allow dynamic loading 6 | of CodeCompass Service plugins. Clang (>= version 6.0) gives a warning that 7 | these C-linkage specified methods return types that are not proper from a 8 | C code. 9 | 10 | These codes are NOT to be called from any C code. The C linkage is used to 11 | turn off the name mangling so that the dynamic loader can easily find the 12 | symbol table needed to set the plugin up. 13 | */ 14 | // When writing a plugin, please do NOT copy this notice to your code. 15 | #pragma clang diagnostic push 16 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 17 | extern "C" 18 | { 19 | boost::program_options::options_description getOptions() 20 | { 21 | namespace po = boost::program_options; 22 | 23 | po::options_description description("Dummy Plugin"); 24 | 25 | description.add_options() 26 | ("dummy-result", po::value()->default_value("Dummy result"), 27 | "This value will be returned by the dummy service."); 28 | 29 | return description; 30 | } 31 | 32 | void registerPlugin( 33 | const cc::webserver::ServerContext& context_, 34 | cc::webserver::PluginHandler* pluginHandler_) 35 | { 36 | cc::webserver::registerPluginSimple( 37 | context_, 38 | pluginHandler_, 39 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(Dummy, dummy), 40 | "DummyService"); 41 | } 42 | } 43 | #pragma clang diagnostic pop 44 | -------------------------------------------------------------------------------- /plugins/dummy/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dummytest 2 | src/dummyparsertest.cpp 3 | src/dummyservicetest.cpp) 4 | 5 | target_link_libraries(dummytest ${GTEST_BOTH_LIBRARIES} pthread) 6 | 7 | # Add a test to the project to be run by ctest 8 | add_test(allDummyTest dummytest) -------------------------------------------------------------------------------- /plugins/dummy/test/src/dummyparsertest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class DummyParserTest : public ::testing::Test 4 | { 5 | protected: 6 | /** 7 | * Prepare the objects for each test 8 | */ 9 | virtual void SetUp() override 10 | { 11 | } 12 | 13 | /** 14 | * Release any resources you allocated in SetUp() 15 | */ 16 | virtual void TearDown() override 17 | { 18 | } 19 | }; 20 | 21 | TEST_F(DummyParserTest, simpleDummyParserTest) 22 | { 23 | ASSERT_EQ(1,1); 24 | } 25 | 26 | TEST_F(DummyParserTest, simpleDummyParserTest2) 27 | { 28 | ASSERT_TRUE(true); 29 | } 30 | -------------------------------------------------------------------------------- /plugins/dummy/test/src/dummyservicetest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class DummyServiceTest : public ::testing::Test 4 | { 5 | protected: 6 | /** 7 | * Prepare the objects for each test 8 | */ 9 | virtual void SetUp() override 10 | { 11 | } 12 | 13 | /** 14 | * Release any resources you allocated in SetUp() 15 | */ 16 | virtual void TearDown() override 17 | { 18 | } 19 | }; 20 | 21 | TEST_F(DummyServiceTest, simpleDummyServiceTest) 22 | { 23 | EXPECT_EQ(7,7); 24 | } 25 | -------------------------------------------------------------------------------- /plugins/git/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(LibGit2 REQUIRED) 2 | 3 | add_subdirectory(parser) 4 | add_subdirectory(service) 5 | 6 | install_webplugin(webgui) -------------------------------------------------------------------------------- /plugins/git/FindLibGit2.cmake: -------------------------------------------------------------------------------- 1 | # https://raw.githubusercontent.com/libgit2/libgit2-backends/master/CMake/FindLibgit2.cmake 2 | # - Try to find the libgit2 library 3 | # Once done this will define 4 | # 5 | # LIBGIT2_FOUND - System has libgit2 6 | # LIBGIT2_INCLUDE_DIR - The libgit2 include directory 7 | # LIBGIT2_LIBRARIES - The libraries needed to use libgit2 8 | # LIBGIT2_DEFINITIONS - Compiler switches required for using libgit2 9 | 10 | 11 | # use pkg-config to get the directories and then use these values 12 | # in the FIND_PATH() and FIND_LIBRARY() calls 13 | #FIND_PACKAGE(PkgConfig) 14 | #PKG_SEARCH_MODULE(PC_LIBGIT2 libgit2) 15 | 16 | SET(LIBGIT2_DEFINITIONS ${PC_LIBGIT2_CFLAGS_OTHER}) 17 | 18 | FIND_PATH(LIBGIT2_INCLUDE_DIR NAMES git2.h 19 | HINTS 20 | ${PC_LIBGIT2_INCLUDEDIR} 21 | ${PC_LIBGIT2_INCLUDE_DIRS} 22 | ) 23 | 24 | FIND_LIBRARY(LIBGIT2_LIBRARIES NAMES git2 25 | HINTS 26 | ${PC_LIBGIT2_LIBDIR} 27 | ${PC_LIBGIT2_LIBRARY_DIRS} 28 | ) 29 | 30 | 31 | INCLUDE(FindPackageHandleStandardArgs) 32 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibGit2 DEFAULT_MSG LIBGIT2_LIBRARIES LIBGIT2_INCLUDE_DIR) 33 | 34 | MARK_AS_ADVANCED(LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES) -------------------------------------------------------------------------------- /plugins/git/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/util/include 4 | ${PROJECT_SOURCE_DIR}/parser/include) 5 | 6 | add_library(gitparser SHARED 7 | src/gitparser.cpp) 8 | 9 | target_compile_options(gitparser PUBLIC -Wno-unknown-pragmas) 10 | 11 | target_link_libraries(gitparser 12 | util 13 | git2 14 | ssl) 15 | 16 | install(TARGETS gitparser DESTINATION ${INSTALL_PARSER_DIR}) 17 | -------------------------------------------------------------------------------- /plugins/git/parser/include/gitparser/gitparser.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_GITPARSER_H 2 | #define CC_PARSER_GITPARSER_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace cc 10 | { 11 | namespace parser 12 | { 13 | 14 | class GitParser : public AbstractParser 15 | { 16 | public: 17 | GitParser(ParserContext& ctx_); 18 | virtual ~GitParser(); 19 | virtual bool parse() override; 20 | private: 21 | static int getSubmodulePaths(git_submodule *sm, const char *smName, void *payload); 22 | util::DirIterCallback getParserCallback(); 23 | }; 24 | 25 | } // parser 26 | } // cc 27 | 28 | #endif //CC_PARSER_GITPARSER_H 29 | -------------------------------------------------------------------------------- /plugins/git/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | namespace po = boost::program_options; 12 | po::options_description description("Git Plugin"); 13 | return description; 14 | } 15 | 16 | void registerPlugin( 17 | const cc::webserver::ServerContext& context_, 18 | cc::webserver::PluginHandler* pluginHandler_) 19 | { 20 | cc::webserver::registerPluginSimple( 21 | context_, 22 | pluginHandler_, 23 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(Git, git), 24 | "GitService"); 25 | } 26 | } 27 | #pragma clang diagnostic pop 28 | -------------------------------------------------------------------------------- /plugins/metrics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(model) 2 | add_subdirectory(parser) 3 | add_subdirectory(service) 4 | 5 | install_webplugin(webgui) -------------------------------------------------------------------------------- /plugins/metrics/model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(ODB_SOURCES 2 | include/model/metrics.h) 3 | 4 | generate_odb_files("${ODB_SOURCES}") 5 | 6 | add_odb_library(metricsmodel ${ODB_CXX_SOURCES}) 7 | add_dependencies(metricsmodel model) 8 | 9 | install_sql() 10 | -------------------------------------------------------------------------------- /plugins/metrics/model/include/model/metrics.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_MODEL_METRICS_H 2 | #define CC_MODEL_METRICS_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace cc 13 | { 14 | namespace model 15 | { 16 | 17 | #pragma db object 18 | struct Metrics 19 | { 20 | enum Type 21 | { 22 | ORIGINAL_LOC = 1, 23 | NONBLANK_LOC = 2, 24 | CODE_LOC = 3, 25 | MCCABE = 4 26 | }; 27 | 28 | #pragma db id auto 29 | std::uint64_t id; 30 | 31 | #pragma db not_null 32 | FileId file; 33 | 34 | #pragma db not_null 35 | unsigned metric; 36 | 37 | #pragma db not_null 38 | Type type; 39 | }; 40 | 41 | #pragma db view object(Metrics) query(distinct) 42 | struct MetricsFileIdView 43 | { 44 | FileId file; 45 | }; 46 | 47 | } //model 48 | } //cc 49 | 50 | #endif // CC_MODEL_METRICS_H 51 | -------------------------------------------------------------------------------- /plugins/metrics/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/parser/include 6 | ${PLUGIN_DIR}/model/include) 7 | 8 | add_library(metricsparser SHARED 9 | src/metricsparser.cpp) 10 | 11 | target_link_libraries(metricsparser 12 | metricsmodel 13 | util 14 | ${Boost_LIBRARIES}) 15 | 16 | install(TARGETS metricsparser 17 | LIBRARY DESTINATION ${INSTALL_LIB_DIR} 18 | DESTINATION ${INSTALL_PARSER_DIR}) 19 | -------------------------------------------------------------------------------- /plugins/metrics/service/metrics.thrift: -------------------------------------------------------------------------------- 1 | include "project/common.thrift" 2 | include "project/project.thrift" 3 | 4 | namespace cpp cc.service.metrics 5 | namespace java cc.service.metrics 6 | 7 | struct LocInfo 8 | { 9 | 1:string fileType, 10 | 2:i32 originalLines, 11 | 3:i32 nonblankLines, 12 | 4:i32 codeLines 13 | } 14 | 15 | enum MetricsType 16 | { 17 | OriginalLoc = 1, 18 | NonblankLoc = 2, 19 | CodeLoc = 3, 20 | McCabe = 4 21 | } 22 | 23 | struct MetricsTypeName 24 | { 25 | 1:MetricsType type, 26 | 2:string name 27 | } 28 | 29 | service MetricsService 30 | { 31 | /** 32 | * This function returns a JSON string which represents the file hierarcy with 33 | * the given file in the root. Every JSON object belongs to a directory or a 34 | * file. Such an object contains the required metrics given in metricsTypes 35 | * parameter. The result collects only those files of which the file type is 36 | * contained by fileTypeFilter. 37 | */ 38 | string getMetrics( 39 | 1:common.FileId fileId, 40 | 2:list fileTypeFilter, 41 | 3:MetricsType metricsType) 42 | 43 | /** 44 | * This function returns the names of metrics. 45 | */ 46 | list getMetricsTypeNames() 47 | } 48 | -------------------------------------------------------------------------------- /plugins/metrics/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | return boost::program_options::options_description("Metrics Plugin"); 12 | } 13 | 14 | void registerPlugin( 15 | const cc::webserver::ServerContext& context_, 16 | cc::webserver::PluginHandler* pluginHandler_) 17 | { 18 | cc::webserver::registerPluginSimple( 19 | context_, 20 | pluginHandler_, 21 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(Metrics, metrics), 22 | "MetricsService"); 23 | } 24 | } 25 | #pragma clang diagnostic pop 26 | -------------------------------------------------------------------------------- /plugins/metrics/webgui/images/metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/metrics/webgui/images/metrics.png -------------------------------------------------------------------------------- /plugins/metrics/webgui/userguide/userguide.md: -------------------------------------------------------------------------------- 1 | \section userguide_metrics Metrics 2 | Code metrics is an analysing tool. It helps to identify the complexity of our code. 3 | We can access it by right clicking on a directory/file at the filemanager. 4 | 5 | \subsection userguide_metrics_settings Settings 6 | Here we can set file type filter (the default is all), size and color 7 | dimension of diagram. 8 | 9 | \subsection userguide_metrics_diagram Diagram 10 | Metrics diagram shows directories/files in rectangles. The fill color goes from 11 | light green to blue. If it's light green than color dimension is zero, else color 12 | is representing the setted color dimension size(Original Lines Of Code etc.). 13 | The size of a rectangle also has a meaning: the bigger a rectangle is, the 14 | larger of it's selected metric is. 15 | 16 | ![Metrics](images/metrics.png) -------------------------------------------------------------------------------- /plugins/search/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(common) 2 | add_subdirectory(indexer) 3 | add_subdirectory(parser) 4 | add_subdirectory(service) 5 | 6 | install_webplugin(webgui) 7 | install(DIRECTORY 8 | lib/java/ 9 | DESTINATION "${INSTALL_JAVA_LIB_DIR}") 10 | -------------------------------------------------------------------------------- /plugins/search/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_JAVA_INCLUDE_PATH 2 | ${PROJECT_SOURCE_DIR}/lib/java/* 3 | ${PLUGIN_DIR}/lib/java/*) 4 | 5 | add_jar(searchcommonjava 6 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/tags/Tag.java 7 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/tags/Tags.java 8 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/LineInformations.java 9 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/Location.java 10 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/SourceTextAnalyzer.java 11 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/analysis/SourceTextTokenizer.java 12 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/FileLoggerInitializer.java 13 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/IndexFields.java 14 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/SuggestionDatabase.java 15 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/NFSFriendlyLockFactory.java 16 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/config/UnknownArgumentException.java 17 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/config/InvalidValueException.java 18 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/config/CommonOptions.java 19 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/config/LogConfigurator.java 20 | ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/search/common/ipc/IPCProcessor.java 21 | OUTPUT_NAME searchcommon) 22 | 23 | install_jar(searchcommonjava "${INSTALL_JAVA_LIB_DIR}") 24 | -------------------------------------------------------------------------------- /plugins/search/common/src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/analysis/SourceTextAnalyzer.java: -------------------------------------------------------------------------------- 1 | package cc.search.analysis; 2 | 3 | import java.io.Reader; 4 | import org.apache.lucene.analysis.Analyzer; 5 | import org.apache.lucene.analysis.TokenStream; 6 | import org.apache.lucene.analysis.core.LowerCaseFilter; 7 | import org.apache.lucene.util.Version; 8 | 9 | /** 10 | * Analyzer for source text. 11 | */ 12 | public class SourceTextAnalyzer extends Analyzer { 13 | @Override 14 | protected TokenStreamComponents createComponents(String f, Reader reader_) { 15 | final SourceTextTokenizer tokenizer = new SourceTextTokenizer(reader_); 16 | // Convert tokens to lower-case 17 | TokenStream tokStream = new LowerCaseFilter(Version.LUCENE_4_9, tokenizer); 18 | return new TokenStreamComponents(tokenizer, tokStream); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/analysis/SourceTextTokenizer.java: -------------------------------------------------------------------------------- 1 | package cc.search.analysis; 2 | 3 | import java.io.Reader; 4 | import org.apache.lucene.analysis.util.CharTokenizer; 5 | import org.apache.lucene.util.AttributeFactory; 6 | import org.apache.lucene.util.Version; 7 | 8 | /** 9 | * Tokenizer for source files. 10 | */ 11 | class SourceTextTokenizer extends CharTokenizer { 12 | /** 13 | * @param input_ input. 14 | */ 15 | SourceTextTokenizer(Reader input_) { 16 | super(Version.LUCENE_4_9, input_); 17 | } 18 | 19 | /** 20 | * @param factory_ attribute factory. 21 | * @param input_ input. 22 | */ 23 | SourceTextTokenizer(AttributeFactory factory_, Reader input_) { 24 | super(Version.LUCENE_4_9, factory_, input_); 25 | } 26 | 27 | @Override 28 | protected boolean isTokenChar(int i) { 29 | if (Character.isWhitespace(i)) { 30 | return false; 31 | } 32 | 33 | int type = Character.getType(i); 34 | switch (type) { 35 | case Character.UPPERCASE_LETTER: 36 | case Character.LOWERCASE_LETTER: 37 | case Character.TITLECASE_LETTER: 38 | case Character.MODIFIER_LETTER: 39 | case Character.OTHER_LETTER: 40 | case Character.DECIMAL_DIGIT_NUMBER: 41 | case Character.CONNECTOR_PUNCTUATION: 42 | return true; 43 | default: 44 | return '#' == i; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/common/FileLoggerInitializer.java: -------------------------------------------------------------------------------- 1 | package cc.search.common; 2 | 3 | import cc.search.common.config.CommonOptions; 4 | 5 | import java.util.logging.Level; 6 | import java.util.logging.Logger; 7 | import java.util.logging.FileHandler; 8 | import java.util.logging.SimpleFormatter; 9 | 10 | /** 11 | * Adds file to logging when needed 12 | */ 13 | public class FileLoggerInitializer { 14 | public static void addFileOutput(CommonOptions options_, Logger log_, String pluginName_) { 15 | String filePathField = options_.logFilePath + pluginName_ + ".log"; 16 | if (!options_.logFilePath.isEmpty()) { 17 | try { 18 | FileHandler fileHandler = new FileHandler(filePathField, false); 19 | SimpleFormatter formatter = new SimpleFormatter(); 20 | fileHandler.setFormatter(formatter); 21 | log_.addHandler(fileHandler); 22 | log_.info("Logging started to file: " + filePathField); 23 | } catch (Exception ex) { 24 | log_.log(Level.WARNING, "Could not add logs to file: " + filePathField, ex); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/common/config/InvalidValueException.java: -------------------------------------------------------------------------------- 1 | package cc.search.common.config; 2 | 3 | public class InvalidValueException extends Exception { 4 | public InvalidValueException(String message_) { 5 | super(message_); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/common/config/LogConfigurator.java: -------------------------------------------------------------------------------- 1 | package cc.search.common.config; 2 | 3 | import java.io.ByteArrayInputStream; 4 | import java.io.IOException; 5 | import java.util.logging.Level; 6 | import java.util.logging.LogManager; 7 | import java.util.logging.Logger; 8 | 9 | /** 10 | * This class configures the java.util.logging.LogManager. 11 | */ 12 | public class LogConfigurator { 13 | /** 14 | * Configures the logging options based on JVM arguments. 15 | */ 16 | public LogConfigurator() { 17 | final LogManager logManager = LogManager.getLogManager(); 18 | 19 | try { 20 | String config = createConfig(); 21 | 22 | ByteArrayInputStream cfgStream = new ByteArrayInputStream( 23 | config.getBytes()); 24 | 25 | logManager.readConfiguration(cfgStream); 26 | 27 | } catch (IOException | SecurityException ex) { 28 | Logger.getGlobal().log(Level.SEVERE, 29 | "Failed to configure custom log propeties!", ex); 30 | } 31 | } 32 | 33 | /** 34 | * Creates a configuration in LogManager config format. 35 | * 36 | * @return log configuration. 37 | */ 38 | private static String createConfig() { 39 | String logLevel = System.getProperty("cc.search.logLevel"); 40 | if (logLevel == null) { 41 | logLevel = Level.INFO.getName(); 42 | } 43 | 44 | return 45 | "handlers = java.util.logging.ConsoleHandler\n" + 46 | "cc.search.level = " + logLevel + "\n" + 47 | "java.util.logging.ConsoleHandler.level = ALL\n"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /plugins/search/common/src/cc/search/common/config/UnknownArgumentException.java: -------------------------------------------------------------------------------- 1 | package cc.search.common.config; 2 | 3 | public class UnknownArgumentException extends Exception { 4 | public UnknownArgumentException(String arg_) { 5 | super("Unknown argument: " + arg_); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plugins/search/indexer/indexer-java/src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: cc.search.indexer.Indexer 3 | -------------------------------------------------------------------------------- /plugins/search/indexer/indexer-java/src/cc/search/analysis/MonoTokenizer.java: -------------------------------------------------------------------------------- 1 | package cc.search.analysis; 2 | 3 | import java.io.Reader; 4 | import org.apache.lucene.analysis.util.CharTokenizer; 5 | import org.apache.lucene.util.AttributeFactory; 6 | import org.apache.lucene.util.Version; 7 | 8 | /** 9 | * Creates one token from the whole text. 10 | */ 11 | final class MonoTokenizer extends CharTokenizer { 12 | /** 13 | * @param reader_ input. 14 | */ 15 | public MonoTokenizer(Reader reader_) { 16 | super(Version.LUCENE_4_9, reader_); 17 | } 18 | /** 19 | * @param factory_ attribute factory. 20 | * @param reader_ input. 21 | */ 22 | public MonoTokenizer(AttributeFactory factory_, Reader reader_) { 23 | super(Version.LUCENE_4_9, factory_, reader_); 24 | } 25 | 26 | @Override 27 | protected boolean isTokenChar(int i) { 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /plugins/search/indexer/indexer-java/src/cc/search/analysis/tags/TagGenerator.java: -------------------------------------------------------------------------------- 1 | package cc.search.analysis.tags; 2 | 3 | import cc.search.indexer.Context; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Tag generator interface. 8 | */ 9 | public interface TagGenerator extends AutoCloseable { 10 | /** 11 | * Generate tags for the given file. 12 | * 13 | * @param tags_ object for storing tags. 14 | * @param context_ the context. 15 | * @throws java.io.IOException 16 | */ 17 | public void generate(Tags tags_, Context context_) throws IOException; 18 | } 19 | -------------------------------------------------------------------------------- /plugins/search/indexer/indexer-java/src/cc/search/indexer/IndexerTask.java: -------------------------------------------------------------------------------- 1 | package cc.search.indexer; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | /** 6 | * Async indexer task. 7 | */ 8 | public class IndexerTask implements Callable { 9 | /** 10 | * The wrapped indexer. 11 | */ 12 | private final AbstractIndexer _indexer; 13 | 14 | /** 15 | * @param indexer_ an indexer. 16 | */ 17 | public IndexerTask(AbstractIndexer indexer_) { 18 | _indexer = indexer_; 19 | } 20 | 21 | @Override 22 | public Boolean call() throws Exception { 23 | return _indexer.index(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-analyzers-common-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-analyzers-common-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-core-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-core-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-highlighter-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-highlighter-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-memory-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-memory-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-misc-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-misc-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-queries-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-queries-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-queryparser-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-queryparser-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/lucene-suggest-4.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/lucene-suggest-4.9.0.jar -------------------------------------------------------------------------------- /plugins/search/lib/java/simplemagic-1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/lib/java/simplemagic-1.6.jar -------------------------------------------------------------------------------- /plugins/search/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/parser/include 6 | ${CMAKE_BINARY_DIR}/model/include 7 | ${PLUGIN_BINARY_DIR}/indexer/gen-cpp 8 | ${PLUGIN_DIR}/indexer/include) 9 | 10 | include_directories(SYSTEM 11 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 12 | 13 | add_library(searchparser SHARED src/searchparser.cpp) 14 | target_link_libraries(searchparser 15 | util 16 | magic 17 | indexerservice) 18 | 19 | target_compile_options(searchparser PUBLIC -Wno-unknown-pragmas) 20 | 21 | install(TARGETS searchparser DESTINATION ${INSTALL_PARSER_DIR}) 22 | -------------------------------------------------------------------------------- /plugins/search/parser/include/searchparser/searchparser.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_PARSER_SEARCHPARSER_H 2 | #define CC_PARSER_SEARCHPARSER_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace cc 12 | { 13 | namespace parser 14 | { 15 | 16 | class IndexerProcess; 17 | 18 | class SearchParser : public AbstractParser 19 | { 20 | public: 21 | SearchParser(ParserContext& ctx_); 22 | virtual ~SearchParser(); 23 | 24 | virtual bool parse() override; 25 | 26 | private: 27 | void postParse(); 28 | util::DirIterCallback getParserCallback(const std::string& path_); 29 | bool shouldHandle(const std::string& path_); 30 | 31 | private: 32 | /** 33 | * Java index process. 34 | */ 35 | std::unique_ptr _indexProcess; 36 | 37 | /** 38 | * libmagic handler for mime types. 39 | */ 40 | ::magic_t _fileMagic; 41 | 42 | /** 43 | * Directory of search database. 44 | */ 45 | std::string _searchDatabase; 46 | 47 | /** 48 | * Directories which have to be skipped during the parse. 49 | */ 50 | std::vector _skipDirectories; 51 | }; 52 | 53 | } // parser 54 | } // cc 55 | 56 | #endif //CC_PARSER_SEARCHPARSER_H 57 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/cc/search/analysis/query/MatchCollector.java: -------------------------------------------------------------------------------- 1 | package cc.search.analysis.query; 2 | 3 | /** 4 | * Collector interface for query matches. 5 | * 6 | * @author Alex Gábor Ispánovics 7 | */ 8 | public interface MatchCollector { 9 | /** 10 | * Informations (position and score) about a match. 11 | */ 12 | public static class MatchInfo { 13 | /** 14 | * The score of this match. 15 | */ 16 | public final float score; 17 | /** 18 | * Start offset for the match. 19 | */ 20 | public final int startOffset; 21 | /** 22 | * End offset for the match. 23 | */ 24 | public final int endOffset; 25 | /** 26 | * @param score_ @see MatchInfo#score 27 | * @param startOffset_ @see MatchInfo#startOffset 28 | * @param endOffset_ @see MatchInfo#endOffset 29 | */ 30 | MatchInfo(float score_, int startOffset_, int endOffset_) { 31 | score = score_; 32 | startOffset = startOffset_; 33 | endOffset = endOffset_; 34 | } 35 | } 36 | /** 37 | * Collect a match. 38 | * 39 | * @param docId_ high level document id (base offset already added to it). 40 | * @param info_ match informations. 41 | */ 42 | public void collectMatch(int docId_, MatchInfo info_); 43 | } 44 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/cc/search/match/matcher/ResultMatcher.java: -------------------------------------------------------------------------------- 1 | package cc.search.match.matcher; 2 | 3 | import cc.service.search.LineMatch; 4 | import java.io.IOException; 5 | import java.util.List; 6 | 7 | /** 8 | * Interface for matching lines in a search result. 9 | */ 10 | public interface ResultMatcher extends AutoCloseable { 11 | /** 12 | * Creates a list of line matches (based on context). 13 | * 14 | * @return matches. 15 | * @throws IOException 16 | */ 17 | public List match() throws IOException; 18 | } 19 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/cc/search/match/matcher/ResultMatcherFactory.java: -------------------------------------------------------------------------------- 1 | package cc.search.match.matcher; 2 | 3 | import cc.search.match.Context; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Factory interface for ResultMatcher. 8 | */ 9 | public interface ResultMatcherFactory extends AutoCloseable { 10 | /** 11 | * Creates a ResultMatcher. This method have to be thread safe. 12 | * 13 | * @param context_ matching context. 14 | * @return a ResultMatcher or null if not applicable by the context. 15 | * @throws IOException 16 | */ 17 | public ResultMatcher create(Context context_) throws IOException; 18 | } 19 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/cc/search/match/matcher/SourceLineMatcherFactory.java: -------------------------------------------------------------------------------- 1 | package cc.search.match.matcher; 2 | 3 | import cc.search.common.IndexFields; 4 | import cc.search.match.Context; 5 | import cc.search.match.QueryContext; 6 | import java.io.IOException; 7 | import org.apache.lucene.search.Query; 8 | 9 | /** 10 | * ResultMatcherFactory for SourceLineMatcher. 11 | */ 12 | class SourceLineMatcherFactory implements ResultMatcherFactory { 13 | @Override 14 | public ResultMatcher create(Context context_) throws IOException { 15 | final Query query = context_.query.get(QueryContext.QueryType.Text); 16 | if (query == null) { 17 | return null; 18 | } else { 19 | return OffsetBasedLineMatcher.fromTermVectorField(context_, query, 20 | IndexFields.contentField); 21 | } 22 | } 23 | 24 | @Override 25 | public void close() { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /plugins/search/service/search-java/src/cc/search/service/app/service/ServiceAppOptions.java: -------------------------------------------------------------------------------- 1 | package cc.search.service.app.service; 2 | 3 | import cc.search.common.config.CommonOptions; 4 | import cc.search.common.config.InvalidValueException; 5 | import cc.search.common.config.UnknownArgumentException; 6 | import java.util.ArrayList; 7 | import java.util.Arrays; 8 | 9 | /** 10 | * Command line options for the service application. 11 | */ 12 | final class ServiceAppOptions extends CommonOptions { 13 | 14 | /** 15 | * Builds an instance from command line arguments. 16 | * 17 | * @param args_ command line arguments. 18 | * @return an Options instance. 19 | */ 20 | public ServiceAppOptions(String[] args_) 21 | throws InvalidValueException, UnknownArgumentException { 22 | 23 | ArrayList args = new ArrayList<>(Arrays.asList(args_)); 24 | setFromCommandLineArguments(args); 25 | 26 | validate(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /plugins/search/service/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #pragma clang diagnostic push 5 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 6 | extern "C" 7 | { 8 | boost::program_options::options_description getOptions() 9 | { 10 | boost::program_options::options_description description("Search Plugin"); 11 | return description; 12 | } 13 | 14 | void registerPlugin( 15 | const cc::webserver::ServerContext& context_, 16 | cc::webserver::PluginHandler* pluginHandler_) 17 | { 18 | cc::webserver::registerPluginSimple( 19 | context_, 20 | pluginHandler_, 21 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(Search, search), 22 | "SearchService"); 23 | } 24 | } 25 | #pragma clang diagnostic pop 26 | -------------------------------------------------------------------------------- /plugins/search/webgui/css/search.css: -------------------------------------------------------------------------------- 1 | #searchfields{ 2 | padding: 5px 0px 0px 300px; 3 | } 4 | 5 | .cc-search-group{ 6 | width: 640px; 7 | padding-bottom: 3px; 8 | } 9 | 10 | #cc-filefilter-box, 11 | #cc-dirfilter-box{ 12 | /* width: 500px; */ 13 | /* margin-right: 10px; */ 14 | display: inline-block; 15 | } 16 | 17 | #cc-filefilter-box, 18 | #cc-dirfilter-box{ 19 | width: 320px; 20 | } 21 | 22 | #widget_cc-search-filefilter, 23 | #widget_cc-search-dirfilter{ 24 | width: 92%; 25 | } 26 | 27 | /* #widget_cc-search{ */ 28 | /* width: 300px; */ 29 | /* } */ 30 | 31 | #cc-search{ 32 | display: inline-block; 33 | margin-left: 5px; 34 | } 35 | 36 | #widget_cc-search-filter{ 37 | padding-left: 70px; 38 | width: 418px; 39 | } 40 | 41 | #cc-search > .dijitDropDownButton{ 42 | position: absolute; 43 | } 44 | 45 | 46 | #searchfields .icon-search{ 47 | font-size: large; 48 | color: #335181; 49 | } 50 | 51 | #cc-search .dijitDropDownButton .dijitButtonNode{ 52 | border: 0px; 53 | padding: 0px; 54 | background-color: inherit; 55 | webkit-box-shadow: unset; 56 | -moz-box-shadow: unset; 57 | box-shadow: unset; 58 | background-color: #dbd6d6; 59 | background-image: none; 60 | } 61 | 62 | .cc-search-help{ 63 | font-family:'CodeCompass',Sans-Serif; 64 | color: #335181; 65 | vertical-align: bottom; 66 | cursor: pointer; 67 | padding: 2px; 68 | } 69 | 70 | .cc-search-help:after{ 71 | content: '\e009'; 72 | } -------------------------------------------------------------------------------- /plugins/search/webgui/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/plugins/search/webgui/images/search.png -------------------------------------------------------------------------------- /scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES 2 | setldlogenv.sh 3 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ 4 | GROUP_EXECUTE GROUP_READ 5 | WORLD_EXECUTE WORLD_READ 6 | DESTINATION "share/codecompass") 7 | 8 | install(FILES 9 | CodeCompass_logger 10 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ 11 | GROUP_EXECUTE GROUP_READ 12 | WORLD_EXECUTE WORLD_READ 13 | DESTINATION ${INSTALL_BIN_DIR}) 14 | -------------------------------------------------------------------------------- /scripts/CodeCompass_logger: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ $# -ne 2 ]; then 4 | echo "Usage: $0 \"\"" >&2 5 | exit 1 6 | fi 7 | 8 | binDir=$(dirname $0) 9 | jsonFile=$1 10 | shift 11 | 12 | if [ -f $jsonFile ]; then 13 | echo "The compilation database already exists!" >&2 14 | exit 1 15 | fi 16 | 17 | export LDLOGGER_HOME=$binDir 18 | 19 | source $binDir/../share/codecompass/setldlogenv.sh $jsonFile; \ 20 | bash -c "$@" 21 | 22 | if [ ! -f $jsonFile ]; then 23 | echo "Failed to log the build commands!" >&2 24 | exit 1 25 | elif [ $(wc -c <$jsonFile) -le 5 ]; then 26 | echo "Failed to log the build commands: the build log is empty!" >&2 27 | exit 1 28 | fi 29 | -------------------------------------------------------------------------------- /scripts/remover.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILES=$(ls *.js) 4 | 5 | for FILE in $FILES 6 | do 7 | if [ -f "$FILE" ] 8 | then 9 | sed -i -e "/if (typeof Int64 === 'undefined' && typeof require === 'function') {/,+2 d" "$FILE" 10 | fi 11 | done 12 | -------------------------------------------------------------------------------- /service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(authentication) 2 | add_subdirectory(language) 3 | add_subdirectory(lsp) 4 | add_subdirectory(plugin) 5 | add_subdirectory(project) 6 | add_subdirectory(workspace) 7 | -------------------------------------------------------------------------------- /service/authentication/include/authenticationservice/authenticationservice.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_SERVICE_AUTHENTICATION_AUTHENTICATIONSERVICE_H 2 | #define CC_SERVICE_AUTHENTICATION_AUTHENTICATIONSERVICE_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace cc 14 | { 15 | namespace service 16 | { 17 | namespace authentication 18 | { 19 | 20 | class AuthenticationServiceHandler : virtual public AuthenticationServiceIf 21 | { 22 | public: 23 | AuthenticationServiceHandler(const cc::webserver::ServerContext& ctx_); 24 | 25 | bool isRequiringAuthentication() override; 26 | 27 | bool isCurrentSessionValid() override; 28 | 29 | void getAuthPrompt(std::string& ret_) override; 30 | 31 | void loginUsernamePassword(std::string& ret_, 32 | const std::string& username_, 33 | const std::string& password_) override; 34 | 35 | void logout(std::string& ret_) override; 36 | 37 | void getLoggedInUser(std::string& ret_) override; 38 | 39 | private: 40 | cc::webserver::SessionManagerAccess _sessionManager; 41 | }; 42 | 43 | } // namespace authentication 44 | } // namespace service 45 | } // namespace cc 46 | 47 | #endif // CC_SERVICE_AUTHENTICATION_AUTHENTICATIONSERVICE_H 48 | -------------------------------------------------------------------------------- /service/authentication/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 13 | extern "C" 14 | { 15 | boost::program_options::options_description getOptions() 16 | { 17 | boost::program_options::options_description description( 18 | "Authentication Plugin"); 19 | 20 | return description; 21 | } 22 | 23 | void registerPlugin( 24 | const cc::webserver::ServerContext& context_, 25 | cc::webserver::PluginHandler* pluginHandler_) 26 | { 27 | std::shared_ptr handler( 28 | new cc::webserver::ThriftHandler< 29 | cc::service::authentication::AuthenticationServiceProcessor>( 30 | new cc::service::authentication::AuthenticationServiceHandler( 31 | context_))); 32 | 33 | pluginHandler_->registerImplementation("AuthenticationService", handler); 34 | } 35 | } 36 | #pragma clang diagnostic pop 37 | -------------------------------------------------------------------------------- /service/language/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${PROJECT_BINARY_DIR}/service/project/gen-cpp) 3 | 4 | include_directories(SYSTEM 5 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 6 | 7 | add_custom_command( 8 | OUTPUT 9 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/language_types.cpp 10 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/language_types.h 11 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/LanguageService.cpp 12 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/LanguageService.h 13 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 14 | ${CMAKE_CURRENT_BINARY_DIR}/gen-js 15 | COMMAND 16 | ${THRIFT_EXECUTABLE} --gen cpp --gen js 17 | -o ${CMAKE_CURRENT_BINARY_DIR} 18 | ${CMAKE_CURRENT_SOURCE_DIR}/language.thrift 19 | DEPENDS 20 | ${CMAKE_CURRENT_SOURCE_DIR}/language.thrift 21 | COMMENT 22 | "Generating Thrift for language.thrift") 23 | 24 | add_library(languagethrift STATIC 25 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/language_types.cpp 26 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/LanguageService.cpp) 27 | 28 | target_compile_options(languagethrift PUBLIC -fPIC) 29 | 30 | add_dependencies(languagethrift projectthrift) 31 | install_js_thrift() 32 | -------------------------------------------------------------------------------- /service/lsp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(include) 2 | 3 | add_library(lspservice STATIC 4 | src/lspservice.cpp 5 | src/lsp_types.cpp) 6 | 7 | target_compile_options(lspservice PUBLIC -fPIC) 8 | 9 | target_link_libraries(lspservice 10 | ${Boost_LIBRARIES}) 11 | -------------------------------------------------------------------------------- /service/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 4 | ${PROJECT_SOURCE_DIR}/webserver/include 5 | ${PROJECT_SOURCE_DIR}/util/include) 6 | 7 | include_directories(SYSTEM 8 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 9 | 10 | add_custom_command( 11 | OUTPUT 12 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/PluginService.cpp 13 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/PluginService.h 14 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 15 | ${CMAKE_CURRENT_BINARY_DIR}/gen-js 16 | COMMAND 17 | ${THRIFT_EXECUTABLE} --gen cpp --gen js 18 | -o ${CMAKE_CURRENT_BINARY_DIR} 19 | ${CMAKE_CURRENT_SOURCE_DIR}/plugin.thrift 20 | DEPENDS 21 | ${CMAKE_CURRENT_SOURCE_DIR}/plugin.thrift 22 | COMMENT 23 | "Generating Thrift for plugin.thrift") 24 | 25 | add_library(pluginthrift STATIC 26 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/PluginService.cpp) 27 | 28 | target_compile_options(pluginthrift PUBLIC -fPIC -Wno-unknown-pragmas) 29 | 30 | add_library(pluginservice SHARED 31 | src/pluginservice.cpp 32 | src/plugin.cpp) 33 | 34 | target_link_libraries(pluginservice 35 | util 36 | ${THRIFT_LIBTHRIFT_LIBRARIES} 37 | pluginthrift) 38 | 39 | install(TARGETS pluginservice DESTINATION ${INSTALL_SERVICE_DIR}) 40 | install_js_thrift() 41 | -------------------------------------------------------------------------------- /service/plugin/include/pluginservice/pluginservice.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_SERVICE_PLUGIN_PLUGINSERVICE_H 2 | #define CC_SERVICE_PLUGIN_PLUGINSERVICE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace cc 10 | { 11 | namespace service 12 | { 13 | namespace plugin 14 | { 15 | 16 | class PluginServiceHandler : virtual public PluginServiceIf 17 | { 18 | public: 19 | PluginServiceHandler( 20 | webserver::PluginHandler* pluginHandler_, 21 | const cc::webserver::ServerContext& context_); 22 | 23 | void getPlugins(std::vector& return_) override; 24 | 25 | void getThriftPlugins(std::vector & _return) override; 26 | 27 | void getWebPlugins(std::vector & _return) override; 28 | 29 | void getWebStylePlugins(std::vector & _return) override; 30 | 31 | private: 32 | webserver::PluginHandler* _pluginHandler; 33 | const boost::program_options::variables_map& _configuration; 34 | }; 35 | 36 | } // plugin 37 | } // service 38 | } // cc 39 | 40 | #endif // CC_SERVICE_PLUGIN_PLUGINSERVICE_H 41 | -------------------------------------------------------------------------------- /service/plugin/plugin.thrift: -------------------------------------------------------------------------------- 1 | namespace cpp cc.service.plugin 2 | 3 | service PluginService 4 | { 5 | /** 6 | * Returns a list of active plugins which are loaded from shared object 7 | */ 8 | list getPlugins() 9 | 10 | /** 11 | * Returns a list of generated Thrift javascript plugins from install web directory 12 | * 13 | * These JS files are generated by Thrift and NOT defined as Dojo modules. 14 | * Therefore they cannot be bundled into layers by the Dojo Build System and must be loaded separately. 15 | */ 16 | list getThriftPlugins() 17 | 18 | /** 19 | * Returns a list of custom javascript plugins from install web directory 20 | * 21 | * These JS files are defined as Dojo modules and can be bundled into layers by the Dojo Build System. 22 | */ 23 | list getWebPlugins() 24 | 25 | /** 26 | * Returns a list of css plugins from install web directory 27 | */ 28 | list getWebStylePlugins() 29 | } 30 | -------------------------------------------------------------------------------- /service/plugin/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #pragma clang diagnostic push 7 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 8 | extern "C" 9 | { 10 | boost::program_options::options_description getOptions() 11 | { 12 | boost::program_options::options_description description("Plugin Plugin"); 13 | 14 | return description; 15 | } 16 | 17 | void registerPlugin( 18 | const cc::webserver::ServerContext& context_, 19 | cc::webserver::PluginHandler* pluginHandler_) 20 | { 21 | std::shared_ptr handler( 22 | new cc::webserver::ThriftHandler( 23 | new cc::service::plugin::PluginServiceHandler(pluginHandler_, 24 | context_))); 25 | 26 | pluginHandler_->registerImplementation("PluginService", handler); 27 | } 28 | } 29 | #pragma clang diagnostic pop 30 | -------------------------------------------------------------------------------- /service/project/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #pragma clang diagnostic push 6 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 7 | extern "C" 8 | { 9 | boost::program_options::options_description getOptions() 10 | { 11 | boost::program_options::options_description description("Core Plugin"); 12 | 13 | return description; 14 | } 15 | 16 | void registerPlugin( 17 | const cc::webserver::ServerContext& context_, 18 | cc::webserver::PluginHandler* pluginHandler_) 19 | { 20 | cc::webserver::registerPluginSimple( 21 | context_, 22 | pluginHandler_, 23 | CODECOMPASS_SERVICE_FACTORY_WITH_CFG(Project, core), 24 | "ProjectService"); 25 | } 26 | } 27 | #pragma clang diagnostic pop 28 | -------------------------------------------------------------------------------- /service/workspace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 4 | ${PROJECT_SOURCE_DIR}/util/include 5 | ${PROJECT_SOURCE_DIR}/webserver/include) 6 | 7 | include_directories(SYSTEM 8 | ${THRIFT_LIBTHRIFT_INCLUDE_DIRS}) 9 | 10 | add_custom_command( 11 | OUTPUT 12 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/workspace_types.cpp 13 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/workspace_types.h 14 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/WorkspaceService.cpp 15 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/WorkspaceService.h 16 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp 17 | ${CMAKE_CURRENT_BINARY_DIR}/gen-js 18 | COMMAND 19 | ${THRIFT_EXECUTABLE} --gen cpp --gen js 20 | -o ${CMAKE_CURRENT_BINARY_DIR} 21 | ${CMAKE_CURRENT_SOURCE_DIR}/workspace.thrift 22 | DEPENDS 23 | ${CMAKE_CURRENT_SOURCE_DIR}/workspace.thrift 24 | COMMENT 25 | "Generating Thrift for workspace.thrift") 26 | 27 | add_library(workspacethrift STATIC 28 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/workspace_types.cpp 29 | ${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/WorkspaceService.cpp) 30 | 31 | target_compile_options(workspacethrift PUBLIC -fPIC -Wno-unknown-pragmas) 32 | 33 | add_library(workspaceservice SHARED 34 | src/workspaceservice.cpp 35 | src/plugin.cpp) 36 | 37 | target_link_libraries(workspaceservice 38 | util 39 | ${THRIFT_LIBTHRIFT_LIBRARIES} 40 | workspacethrift) 41 | 42 | install(TARGETS workspaceservice DESTINATION ${INSTALL_SERVICE_DIR}) 43 | install_js_thrift() 44 | -------------------------------------------------------------------------------- /service/workspace/include/workspaceservice/workspaceservice.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_SERVICE_WORKSPACE_WORKSPACESERVICE_H 2 | #define CC_SERVICE_WORKSPACE_WORKSPACESERVICE_H 3 | 4 | #include 5 | 6 | namespace cc 7 | { 8 | namespace service 9 | { 10 | namespace workspace 11 | { 12 | 13 | class WorkspaceServiceHandler : virtual public WorkspaceServiceIf 14 | { 15 | public: 16 | WorkspaceServiceHandler(const std::string& workspace_); 17 | 18 | void getWorkspaces(std::vector& _return) override; 19 | 20 | private: 21 | /** 22 | * This function defines an ordering between WorkspaceInfo objects by name. 23 | */ 24 | static bool workspaceInfoOrder(const WorkspaceInfo& left, const WorkspaceInfo& right); 25 | 26 | std::string _workspace; 27 | }; 28 | 29 | } // workspace 30 | } // service 31 | } // cc 32 | 33 | #endif // CC_SERVICE_WORKSPACE_WORKSPACESERVICE_H 34 | -------------------------------------------------------------------------------- /service/workspace/src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #pragma clang diagnostic push 9 | #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" 10 | extern "C" 11 | { 12 | boost::program_options::options_description getOptions() 13 | { 14 | boost::program_options::options_description description("Workspace Plugin"); 15 | 16 | return description; 17 | } 18 | 19 | void registerPlugin( 20 | const cc::webserver::ServerContext& context_, 21 | cc::webserver::PluginHandler* pluginHandler_) 22 | { 23 | std::shared_ptr handler( 24 | new cc::webserver::ThriftHandler( 25 | new cc::service::workspace::WorkspaceServiceHandler( 26 | context_.options["workspace"].as()))); 27 | 28 | pluginHandler_->registerImplementation("WorkspaceService", handler); 29 | } 30 | } 31 | #pragma clang diagnostic pop 32 | -------------------------------------------------------------------------------- /service/workspace/src/workspaceservice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace cc 5 | { 6 | namespace service 7 | { 8 | namespace workspace 9 | { 10 | 11 | WorkspaceServiceHandler::WorkspaceServiceHandler(const std::string& workspace_) 12 | : _workspace(workspace_) 13 | { 14 | } 15 | 16 | void WorkspaceServiceHandler::getWorkspaces(std::vector& return_) 17 | { 18 | namespace fs = boost::filesystem; 19 | 20 | for (fs::directory_iterator it(_workspace); 21 | it != fs::directory_iterator(); 22 | ++it) 23 | { 24 | if (!fs::is_directory(it->path())) 25 | // Ignore plain files in the workspace directory - projects are always 26 | // directories. 27 | continue; 28 | if (!fs::is_regular_file(fs::path{it->path()}.append("project_info.json"))) 29 | // Ignore directories that do not have a project information for them. 30 | // (cf. webserver/pluginhelper.h) 31 | continue; 32 | 33 | std::string filename = it->path().filename().native(); 34 | WorkspaceInfo info; 35 | info.id = filename; 36 | info.description = filename; 37 | 38 | return_.push_back(std::move(info)); 39 | } 40 | 41 | std::sort(return_.begin(), return_.end(), workspaceInfoOrder); 42 | } 43 | 44 | bool WorkspaceServiceHandler::workspaceInfoOrder( 45 | const WorkspaceInfo& left_, 46 | const WorkspaceInfo& right_) 47 | { 48 | return left_.id < right_.id; 49 | } 50 | 51 | } // workspace 52 | } // service 53 | } // cc 54 | -------------------------------------------------------------------------------- /service/workspace/workspace.thrift: -------------------------------------------------------------------------------- 1 | namespace cpp cc.service.workspace 2 | namespace java cc.service.workspace 3 | 4 | /** 5 | * Workspace description. 6 | */ 7 | struct WorkspaceInfo 8 | { 9 | 1:string id, 10 | 2:string description 11 | } 12 | 13 | /** 14 | * The workspace service. 15 | */ 16 | service WorkspaceService 17 | { 18 | /** 19 | * Returns a list of active workspaces 20 | */ 21 | list getWorkspaces() 22 | } 23 | -------------------------------------------------------------------------------- /util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${PROJECT_SOURCE_DIR}/util/include 3 | ${PROJECT_SOURCE_DIR}/model/include 4 | ${BOOST_INCLUDE_DIRS}) 5 | 6 | include_directories(SYSTEM 7 | ${ODB_INCLUDE_DIRS}) 8 | 9 | add_library(util SHARED 10 | src/dbutil.cpp 11 | src/dynamiclibrary.cpp 12 | src/filesystem.cpp 13 | src/graph.cpp 14 | src/legendbuilder.cpp 15 | src/logutil.cpp 16 | src/parserutil.cpp 17 | src/pipedprocess.cpp 18 | src/util.cpp) 19 | 20 | target_link_libraries(util 21 | model 22 | gvc 23 | ${Boost_LIBRARIES}) 24 | 25 | string(TOLOWER "${DATABASE}" _database) 26 | if (${_database} STREQUAL "sqlite") 27 | target_link_libraries(util 28 | sqlite3) 29 | endif() 30 | 31 | install(TARGETS util DESTINATION ${INSTALL_LIB_DIR}) 32 | -------------------------------------------------------------------------------- /util/include/util/dynamiclibrary.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_DYNAMICLIBRARY_H 2 | #define CC_UTIL_DYNAMICLIBRARY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifdef WIN32 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | namespace cc 16 | { 17 | namespace util 18 | { 19 | 20 | class DynamicLibrary 21 | { 22 | public: 23 | DynamicLibrary(void* handle_); 24 | DynamicLibrary(const std::string& path_); 25 | 26 | ~DynamicLibrary(); 27 | 28 | void* getSymbol(const std::string& name_) const; 29 | 30 | static std::string extension(); 31 | private: 32 | void* _handle; 33 | }; 34 | 35 | typedef std::shared_ptr DynamicLibraryPtr; 36 | 37 | } // util 38 | } // cc 39 | 40 | #endif /* CC_UTIL_DYNAMICLIBRARY_H */ 41 | -------------------------------------------------------------------------------- /util/include/util/filesystem.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_FILESYSTEM_H 2 | #define CC_UTIL_FILESYSTEM_H 3 | 4 | namespace cc 5 | { 6 | namespace util 7 | { 8 | 9 | /** 10 | * @brief Transform the shell-given path of a CodeCompass binary into the 11 | * absolute canonical path of CodeCompass' install root. 12 | * 13 | * @param path The path of the binary which was started, as given by the 14 | * executing shell. This should, in most cases be argv[0] of a main() method. 15 | * @return The installation folder of CodeCompass as a string. 16 | */ 17 | std::string binaryPathToInstallDir(const char* path); 18 | 19 | /** 20 | * @brief Find the directory where a CodeCompass binary is being run from. 21 | * @return The absolute path of the directory where the binary is located. 22 | */ 23 | std::string findCurrentExecutableDir(); 24 | 25 | /** 26 | * @brief Determines if the given path is rooted under 27 | * any of the given other paths. 28 | * 29 | * @param paths_ A list of canonical paths. 30 | * @param path_ A canonical path to match against the given paths. 31 | * @return True if any of the paths in paths_ is a prefix of path_, 32 | * otherwise false. 33 | */ 34 | bool isRootedUnderAnyOf( 35 | const std::vector& paths_, 36 | const std::string& path_); 37 | 38 | } // namespace util 39 | } // namespace cc 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /util/include/util/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_HASH_H 2 | #define CC_UTIL_HASH_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #if BOOST_VERSION >= 106800 /* 1.68.0 */ 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | namespace cc 16 | { 17 | namespace util 18 | { 19 | 20 | inline std::uint64_t fnvHash(const std::string& data_) 21 | { 22 | std::uint64_t hash = 14695981039346656037ULL; 23 | 24 | std::size_t len = data_.length(); 25 | for (std::size_t i = 0; i < len; ++i) 26 | { 27 | hash ^= static_cast(data_[i]); 28 | hash *= static_cast(1099511628211ULL); 29 | } 30 | 31 | return hash; 32 | } 33 | 34 | inline std::string sha1Hash(const std::string& data_) 35 | { 36 | using namespace boost::uuids::detail; 37 | 38 | sha1 hasher; 39 | unsigned int digest[5]; 40 | 41 | hasher.process_bytes(data_.c_str(), data_.size()); 42 | hasher.get_digest(digest); 43 | 44 | std::stringstream ss; 45 | ss.setf(std::ios::hex, std::ios::basefield); 46 | ss.width(8); 47 | ss.fill('0'); 48 | 49 | for (int i = 0; i < 5; ++i) 50 | ss << digest[i]; 51 | 52 | return ss.str(); 53 | } 54 | 55 | } // util 56 | } // cc 57 | 58 | #endif // CC_UTIL_HASH_H 59 | -------------------------------------------------------------------------------- /util/include/util/legendbuilder.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_LEGENDBUILDER_H 2 | #define CC_UTIL_LEGENDBUILDER_H 3 | 4 | #include 5 | #include 6 | #include "graph.h" 7 | 8 | namespace cc 9 | { 10 | namespace util 11 | { 12 | 13 | class LegendBuilder 14 | { 15 | public: 16 | LegendBuilder(const std::string& title_ = ""); 17 | 18 | std::string getOutput() const; 19 | 20 | void addNode( 21 | const std::string& label_, 22 | const std::vector>& attrs_, 23 | bool html_ = false); 24 | 25 | void addEdge( 26 | const std::string& label_, 27 | const std::vector>& attrs_, 28 | bool html_ = false); 29 | 30 | Graph::Subgraph addSubgraph(const std::string& label_, Graph::Node& hook_); 31 | 32 | void setNodeStyle( 33 | const Graph::Node& node_, 34 | const std::vector>& attrs_, 35 | bool html_ = false); 36 | 37 | void setEdgeStyle( 38 | const Graph::Edge& edge_, 39 | const std::vector>& attrs_, 40 | bool html_ = false); 41 | 42 | private: 43 | Graph::Node registerSubgraph(const Graph::Subgraph& sub_); 44 | 45 | Graph _graph; 46 | Graph::Node _root; 47 | }; 48 | 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /util/include/util/logutil.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_LOGUTIL_H 2 | #define CC_UTIL_LOGUTIL_H 3 | 4 | #include 5 | 6 | #define LOG(lvl) BOOST_LOG_TRIVIAL(lvl) 7 | 8 | namespace cc 9 | { 10 | namespace util 11 | { 12 | 13 | void initConsoleLogger(); 14 | 15 | std::string getLoggingBase(const std::string& path_, const std::string& name_); 16 | 17 | bool initFileLogger(const std::string& path_); 18 | 19 | boost::log::trivial::severity_level getSeverityLevel(); 20 | 21 | } // util 22 | } // cc 23 | 24 | #endif /* CC_UTIL_LOGUTIL_H */ 25 | -------------------------------------------------------------------------------- /util/include/util/parserutil.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_PARSEUTIL_H 2 | #define CC_UTIL_PARSEUTIL_H 3 | 4 | namespace cc 5 | { 6 | namespace util 7 | { 8 | 9 | /** 10 | * Callback function type for iterateDirectoryRecursive. 11 | * 12 | * The parameter is the full path of the current entity. 13 | * If the callback returns false, then the iteration stops. 14 | */ 15 | typedef std::function DirIterCallback; 16 | 17 | /** 18 | * Recursively iterate over the given directory. 19 | * @param path_ Directory or a regular file. 20 | * @param callback_ Callback function which will be called on each existing 21 | * path_. If this callback returns false then the files under the current 22 | * directory won't be iterated. 23 | * @return false if the callback_ returns false on the given path_. 24 | */ 25 | bool iterateDirectoryRecursive( 26 | const std::string& path_, 27 | DirIterCallback callback_); 28 | 29 | } // util 30 | } // cc 31 | 32 | #endif // CC_UTIL_PARSEUTIL_H 33 | -------------------------------------------------------------------------------- /util/include/util/scopedvalue.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_SCOPEDVALUE_H 2 | #define CC_UTIL_SCOPEDVALUE_H 3 | 4 | #include 5 | 6 | #define DECLARE_SCOPED_TYPE(type) \ 7 | private: \ 8 | type(const type&) = delete; \ 9 | type(type&&) = delete; \ 10 | type& operator=(const type&) = delete; \ 11 | type& operator=(type&&) = delete; \ 12 | 13 | 14 | namespace cc 15 | { 16 | namespace util 17 | { 18 | 19 | /** 20 | * @brief Scoped value manager. 21 | * 22 | * Temporarily stores the given value in a variable upon construction, 23 | * and restores its original value upon destruction. 24 | * 25 | * @tparam TValue The type of the variable and value to store. 26 | */ 27 | template 28 | class ScopedValue final 29 | { 30 | DECLARE_SCOPED_TYPE(ScopedValue) 31 | 32 | private: 33 | TValue& _storage; 34 | TValue _oldValue; 35 | 36 | public: 37 | ScopedValue(TValue& storage_, TValue&& newValue_) : 38 | _storage(storage_), 39 | _oldValue(std::move(_storage)) 40 | { 41 | _storage = std::forward(newValue_); 42 | } 43 | 44 | ~ScopedValue() 45 | { 46 | _storage = std::move(_oldValue); 47 | } 48 | }; 49 | 50 | } // util 51 | } // cc 52 | 53 | #endif // CC_UTIL_SCOPEDVALUE_H 54 | -------------------------------------------------------------------------------- /util/include/util/util.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_UTIL_H 2 | #define CC_UTIL_UTIL_H 3 | 4 | #include 5 | 6 | namespace cc 7 | { 8 | namespace util 9 | { 10 | 11 | /** 12 | * This function returns the string representation of the current time. 13 | */ 14 | std::string getCurrentDate(); 15 | 16 | /** 17 | * This function returns a range from the given text. The line and column 18 | * coordinates are counted from 1. 19 | */ 20 | std::string textRange( 21 | const std::string& text_, 22 | std::size_t startLine_, std::size_t startCol_, 23 | std::size_t endLine_, std::size_t endCol_); 24 | 25 | /** 26 | * This function escapes a string using HTML escape characters. 27 | * @param str_ String which will be escaped. 28 | * @return Escaped HTML sequence. 29 | */ 30 | std::string escapeHtml(const std::string& str_); 31 | 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /util/include/util/webserverutil.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_WEBSERVER_UTIL_H 2 | #define CC_WEBSERVER_UTIL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace cc 9 | { 10 | namespace util 11 | { 12 | 13 | class ServiceNotAvailException : public std::runtime_error 14 | { 15 | public: 16 | explicit ServiceNotAvailException(const std::string& msg_) 17 | : std::runtime_error(msg_) 18 | { 19 | } 20 | }; 21 | 22 | } 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /util/src/graphpimpl.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_UTIL_GRAPHPIMPL_H 2 | #define CC_UTIL_GRAPHPIMPL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace cc 11 | { 12 | namespace util 13 | { 14 | 15 | struct GraphPimpl 16 | { 17 | GraphPimpl(std::string name_ = "", 18 | bool directed_ = true, 19 | bool strict_ = false) 20 | { 21 | Agdesc_t type; 22 | 23 | if (strict_) 24 | if (directed_) type = Agstrictdirected; 25 | else type = Agstrictundirected; 26 | else 27 | if (directed_) type = Agdirected; 28 | else type = Agundirected; 29 | 30 | _gvc = gvContext(); 31 | _graph = agopen(const_cast(name_.c_str()), type, 0); 32 | } 33 | 34 | ~GraphPimpl() 35 | { 36 | agclose(_graph); 37 | gvFreeContext(_gvc); 38 | 39 | _graph = 0; 40 | _gvc = 0; 41 | } 42 | 43 | Agraph_t* _graph; 44 | GVC_t* _gvc; 45 | 46 | // These maps are needed, because it isn't possible to get an edge and 47 | // subgraph of the graph by name, using the own API of Graphviz. 48 | std::unordered_map _edgeMap; 49 | std::unordered_map _subgMap; 50 | 51 | private: 52 | GraphPimpl(const GraphPimpl&); 53 | GraphPimpl& operator=(const GraphPimpl&); 54 | }; 55 | 56 | } // util 57 | } // cc 58 | 59 | #endif // CC_UTIL_GRAPHPIMPL_H 60 | -------------------------------------------------------------------------------- /webgui-new/.env: -------------------------------------------------------------------------------- 1 | PUBLIC_URL= 2 | BACKEND_URL=http://localhost:8080 3 | DEVSERVER_PORT=3000 -------------------------------------------------------------------------------- /webgui-new/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "parser": "@typescript-eslint/parser", 7 | "parserOptions": { 8 | "ecmaFeatures": { 9 | "jsx": true 10 | }, 11 | "ecmaVersion": 2021, 12 | "sourceType": "module" 13 | }, 14 | "plugins": [ 15 | "@typescript-eslint", 16 | "react", 17 | "react-hooks" 18 | ], 19 | "extends": [ 20 | "next/core-web-vitals", 21 | "eslint:recommended", 22 | "plugin:@typescript-eslint/recommended", 23 | "plugin:react/recommended", 24 | "plugin:react-hooks/recommended" 25 | ], 26 | "globals": { 27 | "JSX": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /webgui-new/.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | .pnp 4 | .pnp.js 5 | 6 | # testing 7 | coverage 8 | 9 | # next.js 10 | .next/ 11 | out/ 12 | 13 | # production 14 | build 15 | 16 | # misc 17 | .DS_Store 18 | *.pem 19 | 20 | # debug 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | .pnpm-debug.log* 25 | 26 | # local env files 27 | .env*.local 28 | 29 | # vercel 30 | .vercel 31 | 32 | # typescript 33 | *.tsbuildinfo 34 | next-env.d.ts 35 | 36 | # thrift generated files 37 | generated/ 38 | 39 | # JetBrain IDEs 40 | .idea/ 41 | 42 | -------------------------------------------------------------------------------- /webgui-new/.nvmrc: -------------------------------------------------------------------------------- 1 | v18.17.0 -------------------------------------------------------------------------------- /webgui-new/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(DIRECTORY 2 | public src 3 | DESTINATION ${INSTALL_WEBROOT_REACT_DIR}/app 4 | USE_SOURCE_PERMISSIONS 5 | FILES_MATCHING PATTERN "[^.]*") 6 | 7 | install(FILES 8 | tsconfig.json 9 | next.config.js 10 | thrift-codegen.sh 11 | .env 12 | DESTINATION ${INSTALL_WEBROOT_REACT_DIR}/app) 13 | 14 | # Install React application 15 | install(CODE "set(CC_PACKAGE \"${CMAKE_CURRENT_SOURCE_DIR}/package.json\")") 16 | install(CODE "set(CC_PACKAGE_LOCK \"${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json\")") 17 | install(CODE "set(INSTALL_WEBROOT_DIR ${INSTALL_WEBROOT_DIR})") 18 | install(CODE "set(INSTALL_WEBROOT_REACT_DIR ${INSTALL_WEBROOT_REACT_DIR})") 19 | install(CODE "set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})") 20 | install(CODE "set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})") 21 | install(SCRIPT InstallReact.cmake) 22 | -------------------------------------------------------------------------------- /webgui-new/next.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-var-requires */ 2 | 3 | require('dotenv').config(); 4 | 5 | /** @type {import('next').NextConfig} */ 6 | const nextConfig = { 7 | output: 'export', 8 | reactStrictMode: true, 9 | modularizeImports: { 10 | '@mui/icons-material': { 11 | transform: '@mui/icons-material/{{member}}', 12 | }, 13 | }, 14 | trailingSlash: true, 15 | ...(process.env.NODE_ENV === 'production' && { 16 | assetPrefix: `${process.env.PUBLIC_URL || ''}/new`, 17 | basePath: `${process.env.PUBLIC_URL || ''}/new`, 18 | }), 19 | }; 20 | 21 | module.exports = nextConfig; 22 | -------------------------------------------------------------------------------- /webgui-new/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/favicon.ico -------------------------------------------------------------------------------- /webgui-new/public/images/cc_codebites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_codebites.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_diagrams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_diagrams.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_file_manager_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_file_manager_explorer.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_file_manager_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_file_manager_tree.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_header_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_header_settings.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_info_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_info_tree.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_metrics.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_overview.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_revcontrol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_revcontrol.png -------------------------------------------------------------------------------- /webgui-new/public/images/cc_search_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/cc_search_results.png -------------------------------------------------------------------------------- /webgui-new/public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui-new/public/images/logo.png -------------------------------------------------------------------------------- /webgui-new/src/components/codebites/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | 3 | export const DiagramOuterContainer = styled('div')({ 4 | padding: '10px', 5 | overflow: 'scroll', 6 | width: 'calc(100vw - 280px)', 7 | height: 'calc(100vh - 78px - 48px - 49px)', 8 | }); 9 | 10 | export const NodeOuterContainer = styled('div')(({ theme }) => ({ 11 | display: 'flex', 12 | flexDirection: 'column', 13 | alignItems: 'center', 14 | width: '500px', 15 | height: '349px', 16 | border: `1px solid ${theme.colors?.primary}`, 17 | cursor: 'pointer', 18 | })); 19 | 20 | export const NodeHeader = styled('div')(({ theme }) => ({ 21 | width: '100%', 22 | height: '30px', 23 | borderBottom: `1px solid ${theme.colors?.primary}`, 24 | display: 'flex', 25 | justifyContent: 'space-between', 26 | gap: '1rem', 27 | })); 28 | 29 | export const NodeTitle = styled('div')({ 30 | overflow: 'hidden', 31 | padding: '5px', 32 | fontSize: '0.85rem', 33 | textAlign: 'center', 34 | flexGrow: '1', 35 | }); 36 | -------------------------------------------------------------------------------- /webgui-new/src/components/codemirror-editor/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | display: 'grid', 5 | gridTemplateColumns: '400px 1fr', 6 | }); 7 | 8 | export const GitBlameContainer = styled('div')(({ theme }) => ({ 9 | display: 'flex', 10 | flexDirection: 'column', 11 | overflowY: 'scroll', 12 | height: '100%', 13 | maxHeight: 'calc(100vh - 78px - 48px - 49px)', 14 | paddingTop: '4px', 15 | borderRight: `1px solid ${theme.colors?.primary}`, 16 | })); 17 | 18 | export const GitBlameLine = styled('div')({ 19 | display: 'flex', 20 | alignItems: 'center', 21 | justifyContent: 'space-between', 22 | flexGrow: '1', 23 | gap: '5px', 24 | padding: '0 5px', 25 | height: '17.91px', 26 | fontSize: '0.75rem', 27 | }); 28 | -------------------------------------------------------------------------------- /webgui-new/src/components/credits/credits.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import * as SC from './styled-components'; 3 | import { useTranslation } from 'react-i18next'; 4 | 5 | export const Credits = (): JSX.Element => { 6 | const { t } = useTranslation(); 7 | 8 | return ( 9 | 10 | {t('credits.projectMembers.title')} 11 | {Array.from({ length: 10 }, (_, i) => i).map((n) => ( 12 | 13 |
{t(`credits.projectMembers.n${n + 1}.name`)}
14 |
{t(`credits.projectMembers.n${n + 1}.contribution`)}
15 |
16 | ))} 17 | {t('credits.thanks.title')} 18 |
{t('credits.thanks.text')}
19 | {t('credits.specialThanks.title')} 20 |
{t('credits.specialThanks.text')}
21 |
22 | ); 23 | }; 24 | -------------------------------------------------------------------------------- /webgui-new/src/components/credits/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | padding: '10px', 5 | }); 6 | 7 | export const ProjectMemberContainer = styled('div')({ 8 | display: 'flex', 9 | alignItems: 'center', 10 | gap: '3rem', 11 | marginBottom: '5px', 12 | 13 | '& > div:nth-of-type(1)': { 14 | width: '200px', 15 | }, 16 | }); 17 | 18 | export const StyledHeading2 = styled('h2')({ 19 | fontSize: '1.1rem', 20 | marginBottom: '10px', 21 | }); 22 | -------------------------------------------------------------------------------- /webgui-new/src/components/editor-context-menu/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { Box, styled } from '@mui/material'; 2 | 3 | export const AstNodeInfoHeader = styled('div')({ 4 | fontWeight: 'bold', 5 | }); 6 | 7 | export const ModalHeader = styled('div')({ 8 | display: 'flex', 9 | alignItems: 'center', 10 | justifyContent: 'space-between', 11 | width: '100%', 12 | }); 13 | 14 | export const ModalContent = styled('div')({ 15 | padding: '10px', 16 | width: '100%', 17 | overflow: 'scroll', 18 | }); 19 | 20 | export const ModalBox = styled(Box)({ 21 | position: 'absolute', 22 | top: '50%', 23 | left: '50%', 24 | transform: 'translate(-50%, -50%)', 25 | }); 26 | 27 | export const ModalContainer = styled('div')(({ theme }) => ({ 28 | display: 'flex', 29 | flexDirection: 'column', 30 | alignItems: 'center', 31 | gap: '1rem', 32 | padding: '10px', 33 | width: '80vw', 34 | height: '80vh', 35 | backgroundColor: theme.backgroundColors?.primary, 36 | })); 37 | -------------------------------------------------------------------------------- /webgui-new/src/components/header/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | import Logo from '@images/logo.png'; 3 | 4 | export const StyledHeader = styled('header')(({ theme }) => ({ 5 | display: 'grid', 6 | gridTemplateColumns: '280px 1fr', 7 | gridTemplateRows: '1fr', 8 | borderBottom: `1px solid ${theme.colors?.primary}`, 9 | minWidth: '1460px', 10 | })); 11 | 12 | export const HeaderLogo = styled('div')(({ theme }) => ({ 13 | height: '75px', 14 | backgroundImage: `url('${Logo.src}')`, 15 | backgroundRepeat: 'no-repeat', 16 | backgroundSize: '90%', 17 | backgroundPosition: 'center center', 18 | borderRight: `1px solid ${theme.colors?.primary}`, 19 | })); 20 | 21 | export const HeaderContent = styled('div')({ 22 | display: 'flex', 23 | justifyContent: 'space-between', 24 | alignItems: 'center', 25 | flexGrow: '1', 26 | padding: '10px 10px 10px 15px', 27 | }); 28 | 29 | export const SettingsContainer = styled('div')({ 30 | display: 'flex', 31 | gap: '1rem', 32 | }); 33 | -------------------------------------------------------------------------------- /webgui-new/src/components/info-tree/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { TreeView, TreeItem, treeItemClasses } from '@mui/lab'; 2 | import { alpha, styled } from '@mui/material'; 3 | 4 | export const StyledDiv = styled('div')({}); 5 | export const StyledSpan = styled('span')({}); 6 | 7 | export const OuterContainer = styled('div')({ 8 | padding: '10px', 9 | fontSize: '0.85rem', 10 | width: 'max-content', 11 | }); 12 | 13 | export const StyledTreeView = styled(TreeView)(({ theme }) => ({ 14 | color: theme.colors?.primary, 15 | backgroundColor: theme.backgroundColors?.primary, 16 | padding: '5px', 17 | fontSize: '0.85rem', 18 | })); 19 | 20 | export const StyledTreeItem = styled(TreeItem)(({ theme }) => ({ 21 | [`& .${treeItemClasses.group}`]: { 22 | marginLeft: '10px', 23 | borderLeft: `1px dashed ${alpha(theme.palette.text.primary, 0.4)}`, 24 | }, 25 | })); 26 | 27 | export const Label = styled('div')(({ theme }) => ({ 28 | display: 'flex', 29 | alignItems: 'center', 30 | gap: '0.5rem', 31 | marginLeft: '5px', 32 | paddingLeft: '20px', 33 | cursor: 'pointer', 34 | ':hover': { 35 | backgroundColor: alpha(theme.backgroundColors?.secondary as string, 0.3), 36 | }, 37 | })); 38 | -------------------------------------------------------------------------------- /webgui-new/src/components/metrics/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { Breadcrumbs, styled } from '@mui/material'; 2 | 3 | export const StyledDiv = styled('div')({}); 4 | 5 | export const StyledRect = styled('rect')({}); 6 | 7 | export const OuterContainer = styled('div')({ 8 | width: 'calc(100vw - 280px)', 9 | height: 'calc(100vh - 78px - 48px - 49px)', 10 | overflow: 'scroll', 11 | }); 12 | 13 | export const MetricsOptionsContainer = styled('div')({ 14 | display: 'flex', 15 | alignItems: 'center', 16 | gap: '1rem', 17 | padding: '10px', 18 | }); 19 | 20 | export const MetricsContainer = styled('div')({ 21 | overflow: 'scroll', 22 | padding: '10px', 23 | }); 24 | 25 | export const StyledBreadcrumbs = styled(Breadcrumbs)(({ theme }) => ({ 26 | padding: '5px', 27 | margin: '10px', 28 | border: `1px solid ${theme.colors?.primary}`, 29 | borderRadius: '5px', 30 | width: 'max-content', 31 | })); 32 | 33 | export const Placeholder = styled('div')({ 34 | padding: '10px', 35 | }); 36 | -------------------------------------------------------------------------------- /webgui-new/src/components/project-select/project-select.tsx: -------------------------------------------------------------------------------- 1 | import { Select, MenuItem, FormControl, InputLabel, SelectChangeEvent } from '@mui/material'; 2 | import { AppContext } from 'global-context/app-context'; 3 | import { useRouter } from 'next/router'; 4 | import React, { useContext } from 'react'; 5 | import { useTranslation } from 'react-i18next'; 6 | import { removeStore } from 'utils/store'; 7 | import { RouterQueryType } from 'utils/types'; 8 | 9 | export const ProjectSelect = (): JSX.Element => { 10 | const { t } = useTranslation(); 11 | const router = useRouter(); 12 | 13 | const appCtx = useContext(AppContext); 14 | 15 | const loadWorkspace = (e: SelectChangeEvent) => { 16 | removeStore([ 17 | 'storedSearchProps', 18 | 'storedSelectedSearchResult', 19 | 'storedExpandedFileTreeNodes', 20 | 'storedExpandedSearchFileNodes', 21 | 'storedExpandedSearchPathNodes', 22 | ]); 23 | router.push({ 24 | pathname: '/project', 25 | query: { 26 | workspaceId: e.target.value, 27 | } as RouterQueryType, 28 | }); 29 | }; 30 | 31 | return appCtx.workspaces.length ? ( 32 | 33 | {t('projectSelect')} 34 | 41 | 42 | ) : ( 43 | <> 44 | ); 45 | }; 46 | -------------------------------------------------------------------------------- /webgui-new/src/components/revision-control/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { TreeView, TreeItem, treeItemClasses } from '@mui/lab'; 2 | import { alpha, styled } from '@mui/material'; 3 | 4 | export const StyledDiv = styled('div')({}); 5 | 6 | export const OuterContainer = styled('div')({ 7 | padding: '10px', 8 | fontSize: '0.85rem', 9 | width: 'max-content', 10 | }); 11 | 12 | export const StyledTreeView = styled(TreeView)(({ theme }) => ({ 13 | color: theme.colors?.primary, 14 | backgroundColor: theme.backgroundColors?.primary, 15 | padding: '5px', 16 | fontSize: '0.85rem', 17 | })); 18 | 19 | export const StyledTreeItem = styled(TreeItem)(({ theme }) => ({ 20 | [`& .${treeItemClasses.group}`]: { 21 | marginLeft: '10px', 22 | borderLeft: `1px dashed ${alpha(theme.palette.text.primary, 0.4)}`, 23 | }, 24 | })); 25 | 26 | export const Label = styled('div')(({ theme }) => ({ 27 | display: 'flex', 28 | alignItems: 'center', 29 | gap: '0.5rem', 30 | marginLeft: '5px', 31 | paddingLeft: '20px', 32 | cursor: 'pointer', 33 | ':hover': { 34 | backgroundColor: alpha(theme.backgroundColors?.secondary as string, 0.3), 35 | }, 36 | })); 37 | 38 | export const Placeholder = styled('div')({ 39 | padding: '10px', 40 | }); 41 | -------------------------------------------------------------------------------- /webgui-new/src/components/search-results/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { TreeView, TreeItem, treeItemClasses } from '@mui/lab'; 2 | import { alpha, styled } from '@mui/material'; 3 | 4 | export const StyledDiv = styled('div')({}); 5 | 6 | export const IconLabel = styled('div')(({ theme }) => ({ 7 | display: 'flex', 8 | alignItems: 'center', 9 | gap: '5px', 10 | paddingLeft: '15px', 11 | cursor: 'pointer', 12 | ':hover': { 13 | backgroundColor: alpha(theme.backgroundColors?.secondary as string, 0.3), 14 | }, 15 | })); 16 | 17 | export const FileLine = styled('div')({ 18 | fontSize: '0.85rem', 19 | marginTop: '3px', 20 | }); 21 | 22 | export const PaginationContainer = styled('div')(({ theme }) => ({ 23 | display: 'flex', 24 | alignItems: 'center', 25 | justifyContent: 'space-between', 26 | gap: '15px', 27 | margin: '10px', 28 | height: '50px', 29 | borderBottom: `1px solid ${theme.colors?.primary}`, 30 | })); 31 | 32 | export const ResultsContainer = styled('div')({ 33 | height: 'calc(100vh - 81px - 70px - 4 * 48px)', 34 | overflow: 'scroll', 35 | }); 36 | 37 | export const StyledTreeView = styled(TreeView)(({ theme }) => ({ 38 | color: theme.colors?.primary, 39 | backgroundColor: theme.backgroundColors?.primary, 40 | fontSize: '0.85rem', 41 | })); 42 | 43 | export const StyledTreeItem = styled(TreeItem)(({ theme }) => ({ 44 | [`& .${treeItemClasses.group}`]: { 45 | marginLeft: '10px', 46 | borderLeft: `1px dashed ${alpha(theme.palette.text.primary, 0.4)}`, 47 | }, 48 | })); 49 | 50 | export const Placeholder = styled('div')({ 51 | padding: '10px', 52 | }); 53 | -------------------------------------------------------------------------------- /webgui-new/src/components/settings-menu/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { Menu, styled } from '@mui/material'; 2 | 3 | export const Container = styled('div')(({ theme }) => ({ 4 | padding: '10px', 5 | border: `1px solid ${theme.colors?.primary}`, 6 | color: theme.colors?.primary, 7 | backgroundColor: theme.backgroundColors?.primary, 8 | borderRadius: '5px', 9 | })); 10 | 11 | export const StyledMenu = styled(Menu)({ 12 | '& ul': { 13 | padding: '0', 14 | }, 15 | }); 16 | 17 | export const RadioWithInfo = styled('div')({ 18 | display: 'flex', 19 | alignItems: 'center', 20 | }); 21 | 22 | export const ExpressionSearchSettings = styled('div')({ 23 | display: 'flex', 24 | justifyContent: 'space-between', 25 | gap: '2rem', 26 | }); 27 | 28 | export const OtherLanguagesContainer = styled('div')(({ theme }) => ({ 29 | display: 'flex', 30 | alignItems: 'center', 31 | marginTop: '10px', 32 | paddingTop: '20px', 33 | borderTop: `1px solid ${theme.colors?.primary}`, 34 | })); 35 | -------------------------------------------------------------------------------- /webgui-new/src/components/user-guide/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | padding: '10px', 5 | width: 'calc(100vw - 280px)', 6 | height: 'calc(100vh - 78px - 48px)', 7 | overflow: 'scroll', 8 | }); 9 | 10 | export const StyledParagraph = styled('p')({ 11 | width: '60%', 12 | marginBottom: '5xp', 13 | }); 14 | 15 | export const StyledUl = styled('ul')({ 16 | listStyle: 'inside', 17 | marginLeft: '20px', 18 | }); 19 | 20 | export const StyledHeading1 = styled('h1')({ 21 | fontSize: '1.5rem', 22 | marginBottom: '20px', 23 | }); 24 | 25 | export const StyledHeading2 = styled('h2')({ 26 | fontSize: '1.2rem', 27 | margin: '10px 0', 28 | }); 29 | -------------------------------------------------------------------------------- /webgui-new/src/components/welcome/styled-components.tsx: -------------------------------------------------------------------------------- 1 | import { Box, styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | padding: '10px', 5 | width: 'calc(100vw - 280px)', 6 | height: 'calc(100vh - 78px - 48px)', 7 | overflow: 'scroll', 8 | }); 9 | 10 | export const StyledHeading1 = styled('h1')({ 11 | fontSize: '1.5rem', 12 | marginBottom: '20px', 13 | }); 14 | 15 | export const StyledHeading2 = styled('h2')({ 16 | fontSize: '1.2rem', 17 | margin: '10px 0', 18 | }); 19 | 20 | export const StyledHeading3 = styled('h3')({ 21 | fontSize: '1.1rem', 22 | margin: '10px 0', 23 | }); 24 | 25 | export const StyledUl = styled('ul')({ 26 | listStyle: 'inside', 27 | marginLeft: '20px', 28 | }); 29 | 30 | export const StyledParagraph = styled('p')({ 31 | marginBottom: '5xp', 32 | }); 33 | 34 | export const Container = styled('div')({ 35 | display: 'flex', 36 | gap: '2rem', 37 | margin: '100px 0', 38 | }); 39 | 40 | export const ImageContainer = styled('div')({ 41 | backgroundSize: 'cover', 42 | backgroundRepeat: 'no-repeat', 43 | backgroundPosition: 'center center', 44 | cursor: 'pointer', 45 | }); 46 | 47 | export const ModalBox = styled(Box)({ 48 | position: 'absolute', 49 | top: '50%', 50 | left: '50%', 51 | transform: 'translate(-50%, -50%)', 52 | }); 53 | 54 | export const FeatureDescription = styled('div')({ 55 | display: 'flex', 56 | flexDirection: 'column', 57 | width: '20%', 58 | }); 59 | -------------------------------------------------------------------------------- /webgui-new/src/enums/accordion-enum.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | import i18n from 'i18n/i18n'; 3 | 4 | export const AccordionLabel = { 5 | FILE_MANAGER: i18n.t('accordionMenu.fileManager'), 6 | SEARCH_RESULTS: i18n.t('accordionMenu.searchResults'), 7 | INFO_TREE: i18n.t('accordionMenu.infoTree'), 8 | REVISION_CONTROL_NAVIGATOR: i18n.t('accordionMenu.revisionControl'), 9 | }; 10 | -------------------------------------------------------------------------------- /webgui-new/src/enums/tab-enum.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | export enum TabName { 3 | WELCOME, 4 | CODE, 5 | METRICS, 6 | DIAGRAMS, 7 | GIT_DIFF, 8 | USER_GUIDE, 9 | CREDITS, 10 | } 11 | -------------------------------------------------------------------------------- /webgui-new/src/hooks/use-url-state.ts: -------------------------------------------------------------------------------- 1 | import { useState, useEffect, Dispatch, SetStateAction } from 'react'; 2 | import { useRouter } from 'next/router'; 3 | import { RouterQueryType } from 'utils/types'; 4 | 5 | export const useUrlState = ( 6 | key: keyof RouterQueryType, 7 | initialValue: string 8 | ): [string, Dispatch>] => { 9 | const router = useRouter(); 10 | const urlParam = router.query[key] as string | undefined; 11 | 12 | const [state, setState] = useState(() => { 13 | return urlParam ?? initialValue; 14 | }); 15 | 16 | useEffect(() => { 17 | setState(urlParam ?? initialValue); 18 | }, [urlParam, initialValue]); 19 | 20 | return [state, setState]; 21 | }; 22 | -------------------------------------------------------------------------------- /webgui-new/src/i18n/i18n.ts: -------------------------------------------------------------------------------- 1 | import i18n from 'i18next'; 2 | import { initReactI18next } from 'react-i18next'; 3 | 4 | const resources = { 5 | en: { 6 | translation: require('./locales/en.json'), 7 | }, 8 | }; 9 | 10 | i18n.use(initReactI18next).init({ 11 | resources, 12 | lng: 'en', 13 | fallbackLng: 'en', 14 | interpolation: { 15 | escapeValue: false, 16 | }, 17 | }); 18 | 19 | export default i18n; 20 | -------------------------------------------------------------------------------- /webgui-new/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import 'themes/globals.scss'; 2 | import type { AppProps } from 'next/app'; 3 | import { CssBaseline } from '@mui/material'; 4 | import { AppContextController } from 'global-context/app-context'; 5 | import { ThemeContextController } from 'global-context/theme-context'; 6 | import { I18nextProvider } from 'react-i18next'; 7 | import i18n from 'i18n/i18n'; 8 | import React from 'react'; 9 | import { CookieNotice } from 'components/cookie-notice/cookie-notice'; 10 | 11 | const App = ({ Component, pageProps }: AppProps): JSX.Element => { 12 | return ( 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ); 23 | }; 24 | 25 | export default App; 26 | -------------------------------------------------------------------------------- /webgui-new/src/server.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | import express from 'express'; 3 | import next from 'next'; 4 | import { createProxyMiddleware } from 'http-proxy-middleware'; 5 | 6 | dotenv.config({ path: '.env.local' }); 7 | dotenv.config(); 8 | 9 | const main = async () => { 10 | const app = express(); 11 | const port = parseInt(process.env.DEVSERVER_PORT as string); 12 | const nextApp = next({ dev: process.env.NODE_ENV !== 'production' }); 13 | 14 | const nextHandler = nextApp.getRequestHandler(); 15 | 16 | const proxyHandler = createProxyMiddleware({ 17 | target: process.env.BACKEND_URL, 18 | changeOrigin: true, 19 | pathFilter: ['**/*Service', '**/ga.txt'], 20 | pathRewrite: { 21 | '^/[^/]+/(.+Service)$': '/$1', 22 | '^/ga.txt' : '/ga.txt' 23 | }, 24 | }); 25 | 26 | app.use('/', proxyHandler); 27 | app.get('*', (req, res) => nextHandler(req, res)); 28 | 29 | await nextApp.prepare(); 30 | 31 | app.listen(port, () => console.log(`> Ready on localhost:${port}`)); 32 | }; 33 | 34 | main(); 35 | -------------------------------------------------------------------------------- /webgui-new/src/service/config.ts: -------------------------------------------------------------------------------- 1 | type ConfigType = { 2 | webserver_host: string; 3 | webserver_port: number; 4 | webserver_https: boolean; 5 | webserver_path: string; 6 | }; 7 | 8 | export let config: ConfigType | undefined = undefined; 9 | 10 | export const createConfig = (props: ConfigType) => { 11 | config = { 12 | webserver_host: props.webserver_host, 13 | webserver_port: props.webserver_port, 14 | webserver_https: props.webserver_https, 15 | webserver_path: props.webserver_path, 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /webgui-new/src/service/cpp-reparse-service.ts: -------------------------------------------------------------------------------- 1 | import thrift from 'thrift'; 2 | import { CppReparseService } from '@thrift-generated'; 3 | import { config } from './config'; 4 | import { toast } from 'react-toastify'; 5 | 6 | let client: CppReparseService.Client | undefined; 7 | export const createCppReparseClient = (workspace: string) => { 8 | if (!config) return; 9 | const connection = thrift.createXHRConnection(config.webserver_host, config.webserver_port, { 10 | transport: thrift.TBufferedTransport, 11 | protocol: thrift.TJSONProtocol, 12 | https: config.webserver_https, 13 | path: `${config.webserver_path}/${workspace}/CppReparseService`, 14 | }); 15 | client = thrift.createXHRClient(CppReparseService, connection); 16 | return client; 17 | }; 18 | 19 | export const getAsHTML = async (fileId: string) => { 20 | if (!client) { 21 | return ''; 22 | } 23 | try { 24 | return await client.getAsHTML(fileId); 25 | } catch (e) { 26 | toast.error('Could not get AST HTML.'); 27 | console.error(e); 28 | return ''; 29 | } 30 | }; 31 | 32 | export const getAsHTMLForNode = async (nodeId: string) => { 33 | if (!client) { 34 | return ''; 35 | } 36 | try { 37 | return await client.getAsHTMLForNode(nodeId); 38 | } catch (e) { 39 | toast.error('Could not get AST HTML for this node.'); 40 | console.error(e); 41 | return ''; 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /webgui-new/src/service/metrics-service.ts: -------------------------------------------------------------------------------- 1 | import thrift from 'thrift'; 2 | import { MetricsService, MetricsType } from '@thrift-generated'; 3 | import { config } from './config'; 4 | import { toast } from 'react-toastify'; 5 | 6 | let client: MetricsService.Client | undefined; 7 | export const createMetricsClient = (workspace: string) => { 8 | if (!config) return; 9 | const connection = thrift.createXHRConnection(config.webserver_host, config.webserver_port, { 10 | transport: thrift.TBufferedTransport, 11 | protocol: thrift.TJSONProtocol, 12 | https: config.webserver_https, 13 | path: `${config.webserver_path}/${workspace}/MetricsService`, 14 | }); 15 | client = thrift.createXHRClient(MetricsService, connection); 16 | return client; 17 | }; 18 | 19 | export const getMetricsTypeNames = async () => { 20 | if (!client) { 21 | return []; 22 | } 23 | try { 24 | return await client.getMetricsTypeNames(); 25 | } catch (e) { 26 | console.error(e); 27 | return []; 28 | } 29 | }; 30 | 31 | export const getMetrics = async (fileId: string, fileTypeFilter: string[], metricsType: MetricsType) => { 32 | if (!client) { 33 | return ''; 34 | } 35 | try { 36 | return await client.getMetrics(fileId, fileTypeFilter, metricsType); 37 | } catch (e) { 38 | toast.error('Could not display metrics.'); 39 | console.error(e); 40 | return ''; 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /webgui-new/src/service/workspace-service.ts: -------------------------------------------------------------------------------- 1 | import thrift from 'thrift'; 2 | import { WorkspaceService } from '@thrift-generated'; 3 | import { config } from './config'; 4 | 5 | let client: WorkspaceService.Client | undefined; 6 | export const createWorkspaceClient = () => { 7 | if (!config) return; 8 | const connection = thrift.createXHRConnection(config.webserver_host, config.webserver_port, { 9 | transport: thrift.TBufferedTransport, 10 | protocol: thrift.TJSONProtocol, 11 | https: config.webserver_https, 12 | path: `${config.webserver_path}/WorkspaceService`, 13 | }); 14 | client = thrift.createXHRClient(WorkspaceService, connection); 15 | return client; 16 | }; 17 | 18 | export const getWorkspaces = async () => { 19 | if (!client) { 20 | return []; 21 | } 22 | try { 23 | return await client.getWorkspaces(); 24 | } catch (e) { 25 | console.error(e); 26 | return []; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /webgui-new/src/themes/globals.scss: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | padding: 0; 4 | margin: 0; 5 | } 6 | -------------------------------------------------------------------------------- /webgui-new/src/themes/index-styles.tsx: -------------------------------------------------------------------------------- 1 | import { styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | display: 'flex', 5 | justifyContent: 'center', 6 | alignItems: 'center', 7 | marginTop: '150px', 8 | }); 9 | 10 | export const InnerContainer = styled('div')({ 11 | display: 'flex', 12 | flexDirection: 'column', 13 | justifyContent: 'center', 14 | alignItems: 'center', 15 | }); 16 | 17 | export const Title = styled('div')({ 18 | fontSize: '1.2rem', 19 | marginBottom: '10px', 20 | }); 21 | -------------------------------------------------------------------------------- /webgui-new/src/themes/project-styles.tsx: -------------------------------------------------------------------------------- 1 | import { Tab, Tabs, styled } from '@mui/material'; 2 | 3 | export const OuterContainer = styled('div')({ 4 | display: 'grid', 5 | gridTemplateColumns: '1fr', 6 | gridTemplateRows: '76px 1fr', 7 | height: '100vh', 8 | }); 9 | 10 | export const InnerContainer = styled('div')({ 11 | display: 'grid', 12 | gridTemplateColumns: '280px 1fr', 13 | gridTemplateRows: '1fr', 14 | }); 15 | 16 | export const StyledTabs = styled(Tabs)(({ theme }) => ({ 17 | borderBottom: `1px solid ${theme.colors?.primary}`, 18 | })); 19 | 20 | export const StyledTab = styled(Tab)({ 21 | textTransform: 'none', 22 | }); 23 | -------------------------------------------------------------------------------- /webgui-new/src/utils/analytics.ts: -------------------------------------------------------------------------------- 1 | import ReactGA from 'react-ga4'; 2 | 3 | type EventType = { 4 | event_action: string; 5 | event_category: string; 6 | event_label?: string; 7 | }; 8 | 9 | export const sendGAEvent = ({ 10 | event_action, 11 | event_category, 12 | event_label = 'undefined', 13 | }: EventType) => { 14 | if (!ReactGA.isInitialized) { 15 | return; 16 | } 17 | // We have to use this signature to prevent ReactGA from making the starting letters automatically uppercase. 18 | ReactGA.event(event_action, { event_category, event_label }); 19 | }; 20 | -------------------------------------------------------------------------------- /webgui-new/src/utils/types.ts: -------------------------------------------------------------------------------- 1 | import { FileInfo } from '@thrift-generated'; 2 | 3 | export type RouterQueryType = { 4 | workspaceId?: string; 5 | projectFileId?: string; 6 | editorSelection?: string; 7 | metricsGenId?: string; 8 | diagramGenId?: string; 9 | diagramTypeId?: string; 10 | diagramType?: string; 11 | languageNodeId?: string; 12 | gitRepoId?: string; 13 | gitBranch?: string; 14 | gitCommitId?: string; 15 | activeAccordion?: string; 16 | activeTab?: string; 17 | treeViewOption?: string; 18 | }; 19 | 20 | export type TreeNode = { 21 | info: FileInfo; 22 | children?: TreeNode[]; 23 | }; 24 | 25 | export type FileNode = { 26 | [key: string]: { 27 | expandedNodes: string[]; 28 | }; 29 | }; 30 | 31 | export type SearchProps = { 32 | initialQuery: string; 33 | fileSearch: boolean; 34 | type: number; 35 | query: string; 36 | fileFilter: string; 37 | dirFilter: string; 38 | start: number; 39 | size: number; 40 | }; 41 | -------------------------------------------------------------------------------- /webgui-new/thrift-codegen.sh: -------------------------------------------------------------------------------- 1 | THRIFT_SOURCE="../" 2 | 3 | while [[ $# -gt 0 ]]; do 4 | case "$1" in 5 | --thrift-source) 6 | THRIFT_SOURCE="$2" 7 | shift 2 8 | ;; 9 | *) 10 | echo "Unknown option: $1" 11 | exit 1 12 | ;; 13 | esac 14 | done 15 | 16 | rm -rf ./generated 17 | rm -rf ./thrift 18 | 19 | mkdir -p thrift 20 | 21 | for file in $(find "$THRIFT_SOURCE/service/" -type f -name '*.thrift'); do 22 | filename=$(basename "$file") 23 | echo "Installing $filename" 24 | if [ ! -f "./thrift/$filename" ]; then 25 | cp "$file" "./thrift/" 26 | fi 27 | done 28 | 29 | for file in $(find "$THRIFT_SOURCE/plugins/" -type f -name '*.thrift'); do 30 | filename=$(basename "$file") 31 | echo "Installing $filename" 32 | if [ ! -f "./thrift/$filename" ]; then 33 | cp "$file" "./thrift/" 34 | fi 35 | done 36 | 37 | # Fix include paths 38 | for file in $(find ./thrift -type f -name '*.thrift'); do 39 | sed -i 's/include "\(.*\)\/\([^\/]*\)"/include "\2"/g' "$file" 40 | done 41 | 42 | npm run thrift-ts 43 | mv codegen generated 44 | rm -rf ./thrift 45 | 46 | for file in $(find ./generated -type f -name '*.ts'); do 47 | sed -i 's/import Int64 = require("node-int64");/import Int64 from "node-int64";/' "$file" 48 | done 49 | 50 | # Resolve conflicting import in SearchService.ts 51 | sed -i 's/import \* as SearchResult from "\.\/SearchResult";/import \* as SearchRes from "\.\/SearchResult";/g' ./generated/SearchService.ts 52 | sed -i 's/SearchResult\.SearchResult/SearchRes.SearchResult/g' ./generated/SearchService.ts 53 | 54 | -------------------------------------------------------------------------------- /webgui-new/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true, 17 | "baseUrl": "src", 18 | "paths": { 19 | "@thrift-generated": ["../generated/index.ts"], 20 | "@images/*": ["../public/images/*"] 21 | } 22 | }, 23 | "ts-node": { 24 | "transpileOnly": true, 25 | "compilerOptions": { 26 | "module": "commonjs" 27 | } 28 | }, 29 | "include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"], 30 | "exclude": ["node_modules"] 31 | } 32 | -------------------------------------------------------------------------------- /webgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(userguide) 2 | 3 | install(DIRECTORY 4 | images scripts style fonts 5 | DESTINATION ${INSTALL_WEBROOT_DIR} 6 | USE_SOURCE_PERMISSIONS 7 | FILES_MATCHING PATTERN "[^.]*") 8 | 9 | install(FILES 10 | login.html 11 | index.html 12 | startpage.html 13 | credits.html 14 | DESTINATION ${INSTALL_WEBROOT_DIR}) 15 | 16 | # Install npm packages 17 | install(CODE "set(CC_PACKAGE \"${CMAKE_CURRENT_SOURCE_DIR}/package.json\")") 18 | install(CODE "set(CC_PROFILE \"${CMAKE_CURRENT_SOURCE_DIR}/codecompass.profile.js.in\")") 19 | install(CODE "set(INSTALL_SCRIPTS_DIR \"${INSTALL_WEBROOT_DIR}/scripts/\")") 20 | install(CODE "set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})") 21 | install(CODE "set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})") 22 | install(SCRIPT InstallGUI.cmake) 23 | -------------------------------------------------------------------------------- /webgui/credits.html: -------------------------------------------------------------------------------- 1 |

Credits

2 | 3 |

Project Members

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Zoltán Borók-NagyC++ plugin
Tibor BrunnerParser & Service infrastructure, C++ plugin, Metrics plugin, Web GUI, Diagrams
Máté CserépParser infrastructure, C++ plugin, CodeBites, Diagrams
Tamás CsériGit plugin
Márton CsordásBuild system, Parser & Service infrastructure, Web GUI
Anett FeketeC++ plugin
Gábor Alex IspánovicsC++ plugin, Search plugin
Zoltán PorkolábProject owner, C++ expert
Richárd SzalayC++ plugin, Webserver
16 | 17 |

Thanks for Support

18 | 19 | Thanks for MTAS and MiniLink for support! 20 | 21 |

Special Thanks

22 | 23 | Special thanks to the Coffee Machine! -------------------------------------------------------------------------------- /webgui/fonts/codecompass.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/fonts/codecompass.eot -------------------------------------------------------------------------------- /webgui/fonts/codecompass.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/fonts/codecompass.ttf -------------------------------------------------------------------------------- /webgui/fonts/codecompass.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/fonts/codecompass.woff -------------------------------------------------------------------------------- /webgui/fonts/codecompass.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/fonts/codecompass.woff2 -------------------------------------------------------------------------------- /webgui/images/bugstep_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/bugstep_icon.png -------------------------------------------------------------------------------- /webgui/images/codebites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/codebites.png -------------------------------------------------------------------------------- /webgui/images/earhart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/earhart.png -------------------------------------------------------------------------------- /webgui/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/favicon.ico -------------------------------------------------------------------------------- /webgui/images/filemanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/filemanager.png -------------------------------------------------------------------------------- /webgui/images/git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/git.png -------------------------------------------------------------------------------- /webgui/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/home.png -------------------------------------------------------------------------------- /webgui/images/infotree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/infotree.png -------------------------------------------------------------------------------- /webgui/images/infotree_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/infotree_functions.png -------------------------------------------------------------------------------- /webgui/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/loading.gif -------------------------------------------------------------------------------- /webgui/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/logo.png -------------------------------------------------------------------------------- /webgui/images/textmodule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ericsson/CodeCompass/0f8606494b43e8fc9cc3eae57e22f81cbe3123c4/webgui/images/textmodule.png -------------------------------------------------------------------------------- /webgui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeCompass", 3 | "version": "1.0.0", 4 | "author": "Ericsson", 5 | "license": "BSD-2-Clause", 6 | "description": "CodeCompass webgui", 7 | "dependencies": { 8 | "dojo" : "^1.11.2", 9 | "dijit" : "^1.11.2", 10 | "dojox" : "^1.11.2", 11 | "dojo-util" : "^1.11.2", 12 | "d3" : "^3.5.6", 13 | "codemirror" : "^5.19.0", 14 | "jquery.fancytree" : "^2.19.0", 15 | "svg-pan-zoom" : "^3.6.1", 16 | "marked" : "^4.0.10", 17 | "jsplumb" : "^2.2.1", 18 | "jquery" : "^3.1.1", 19 | "js-cookie" : "^2.2.1" 20 | }, 21 | "repository" : { 22 | "type" : "git", 23 | "url" : "https://github.com/Ericsson/CodeCompass" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /webgui/scripts/codecompass/keypressHandler.js: -------------------------------------------------------------------------------- 1 | define([], 2 | function () { 3 | var registrations = []; 4 | 5 | document.onkeydown = function (event) { 6 | registrations.forEach(function (p) { 7 | if (p.check(event)) { 8 | event.preventDefault(); 9 | p.callback(); 10 | return false; 11 | } 12 | }); 13 | }; 14 | 15 | /** 16 | * By this function one can registrate for key press events on the page 17 | * (e.g. ctrl-f). 18 | * @param {Function} check A predicate which gets the key press event as 19 | * parameter and returns true if the callback function shoud be invoked on 20 | * the event. 21 | * @param {Function} callback A callback function to run when the event 22 | * occurs. 23 | */ 24 | return function (check, callback) { 25 | registrations.push({ check : check, callback : callback }); 26 | }; 27 | }); -------------------------------------------------------------------------------- /webgui/scripts/codecompass/view/component/HtmlTree.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'dojo/_base/declare', 3 | 'dijit/Tree'], 4 | function (declare, Tree) { 5 | var HtmlTreeNode = declare(Tree._TreeNode, { 6 | _setLabelAttr : { node : "labelNode", type : "innerHTML" } 7 | }); 8 | 9 | return declare(Tree, { 10 | _createTreeNode : function (args) { 11 | return new HtmlTreeNode(args); 12 | } 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /webgui/scripts/codecompass/view/component/TooltipTreeMixin.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'dojo/_base/declare', 3 | 'dijit/Tooltip'], 4 | function (declare, Tooltip) { 5 | return declare(null, { 6 | _onNodeMouseEnter : function (node, evt) { 7 | Tooltip.show(node.item.name, node.labelNode, ['above']); 8 | }, 9 | 10 | _onNodeMouseLeave : function (node, evt) { 11 | Tooltip.hide(node.labelNode); 12 | } 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /webgui/scripts/codecompass/view/text.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'codecompass/viewHandler', 3 | 'codecompass/view/component/Text'], 4 | function (viewHandler, Text) { 5 | 6 | viewHandler.registerModule(new Text({ id : 'text' }), { 7 | type : viewHandler.moduleType.Center 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /webgui/scripts/ga.js: -------------------------------------------------------------------------------- 1 | window.gtag = null; 2 | $(document).ready(function() { 3 | $.ajax({ 4 | url: 'ga.txt', 5 | dataType: 'text', 6 | success: function (gaId) { 7 | $.getScript('https://www.googletagmanager.com/gtag/js?id=' + gaId) 8 | .done(function (script, textStatus){ 9 | console.log('Google Analytics enabled: ' + gaId); 10 | 11 | window.dataLayer = window.dataLayer || []; 12 | 13 | window.gtag = function() { 14 | dataLayer.push(arguments); 15 | } 16 | 17 | window.gtag('js', new Date()); 18 | window.gtag('config', gaId); 19 | }) 20 | .fail(function (jqxhr, settings, exception) { 21 | console.log('Failed to connect to Google Tag Manager. Google ' + 22 | 'Analytics will not be enabled.'); 23 | }); 24 | }, 25 | statusCode: { 26 | 404: function () { 27 | console.log('Google Analytics disabled.'); 28 | } 29 | } 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /webgui/scripts/login/MessagePane.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'dojo/_base/declare', 3 | 'dojo/dom-attr', 4 | 'dojo/dom-class', 5 | 'dojo/dom-construct', 6 | 'dijit/layout/ContentPane'], 7 | function (declare, domAttr, domClass, domConstruct, ContentPane) { 8 | 9 | return declare(ContentPane, { 10 | show: function (heading, errorMsg) { 11 | domClass.remove(this.containerNode, 'hide'); 12 | 13 | domAttr.set(this._heading, 'innerHTML', heading); 14 | domAttr.set(this._errorText, 'innerHTML', errorMsg); 15 | }, 16 | 17 | hide: function () { 18 | domClass.add(this.containerNode, 'hide'); 19 | }, 20 | 21 | postCreate: function () { 22 | this.inherited(arguments); 23 | 24 | this._heading = domConstruct.create('span', { 25 | class: 'heading' 26 | }, this.containerNode); 27 | 28 | this._errorText = domConstruct.create('span', null, this.containerNode); 29 | } 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /webgui/userguide/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES 2 | header.html 3 | footer.html 4 | Doxyfile 5 | DESTINATION ${INSTALL_WEBROOT_DIR}/userguide) 6 | 7 | install(CODE "set(INSTALL_USERGUIDE_DIR \"${INSTALL_WEBROOT_DIR}/userguide\")") 8 | get_property(_userguides GLOBAL PROPERTY USERGUIDES) 9 | install(CODE "set(USERGUIDES \"${_userguides}\")") 10 | install(SCRIPT InstallUserguide.cmake) 11 | 12 | install_webplugin(webgui) 13 | -------------------------------------------------------------------------------- /webgui/userguide/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = "CodeCompass" 2 | PROJECT_BRIEF = "Source-code navigator for programmers" 3 | OUTPUT_DIRECTORY = "doc" 4 | INPUT = 5 | FILE_PATTERNS = *.md 6 | RECURSIVE = NO 7 | INPUT_FILTER = 8 | SEARCHENGINE = NO 9 | HTML_HEADER = header.html 10 | HTML_FOOTER = footer.html 11 | DISABLE_INDEX = YES 12 | GENERATE_LATEX = NO -------------------------------------------------------------------------------- /webgui/userguide/InstallUserguide.cmake: -------------------------------------------------------------------------------- 1 | message("Install userguide...") 2 | 3 | file(WRITE ${INSTALL_USERGUIDE_DIR}/userguide.md "") 4 | foreach(_userguide ${USERGUIDES}) 5 | execute_process( 6 | COMMAND cat ${_userguide} 7 | OUTPUT_VARIABLE _content 8 | WORKING_DIRECTORY ${INSTALL_USERGUIDE_DIR}) 9 | file(APPEND ${INSTALL_USERGUIDE_DIR}/userguide.md ${_content}) 10 | endforeach(_userguide) 11 | 12 | execute_process( 13 | COMMAND doxygen 14 | WORKING_DIRECTORY ${INSTALL_USERGUIDE_DIR}) 15 | 16 | message("Install userguide has been finished.") -------------------------------------------------------------------------------- /webgui/userguide/footer.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webgui/userguide/header.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /webgui/userguide/webgui/js/userguide.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'dijit/layout/ContentPane', 3 | 'codecompass/viewHandler'], 4 | function (ContentPane, viewHandler) { 5 | 6 | var infoPage = new ContentPane({ 7 | id : 'userguide', 8 | href : 'userguide/doc/html/userguide.html', 9 | title : 'User Guide' 10 | }); 11 | 12 | viewHandler.registerModule(infoPage, { 13 | type : viewHandler.moduleType.InfoPage 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /webserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(authenticators) 2 | 3 | add_executable(CodeCompass_webserver 4 | src/webserver.cpp 5 | src/authentication.cpp 6 | src/mainrequesthandler.cpp 7 | src/session.cpp 8 | src/sessionmanager.cpp 9 | src/threadedmongoose.cpp) 10 | 11 | set_target_properties(CodeCompass_webserver 12 | PROPERTIES ENABLE_EXPORTS 1) 13 | 14 | add_library(mongoose STATIC src/mongoose.c ) 15 | target_compile_definitions(mongoose PRIVATE -DNS_ENABLE_SSL) 16 | target_include_directories(mongoose PUBLIC include) 17 | target_compile_options(mongoose PUBLIC -fPIC) 18 | target_link_libraries(mongoose PRIVATE ssl) 19 | 20 | target_include_directories(CodeCompass_webserver PUBLIC 21 | include 22 | ${PROJECT_SOURCE_DIR}/model/include 23 | ${PROJECT_SOURCE_DIR}/util/include) 24 | 25 | target_link_libraries(CodeCompass_webserver 26 | util 27 | mongoose 28 | ${Boost_LIBRARIES} 29 | ${ODB_LIBRARIES} 30 | pthread 31 | dl) 32 | 33 | install(TARGETS CodeCompass_webserver 34 | RUNTIME DESTINATION ${INSTALL_BIN_DIR} 35 | LIBRARY DESTINATION ${INSTALL_LIB_DIR}) 36 | -------------------------------------------------------------------------------- /webserver/authenticators/ldap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(OpenLdap REQUIRED) 2 | 3 | include_directories( 4 | include 5 | ${PROJECT_SOURCE_DIR}/util/include 6 | ${PROJECT_SOURCE_DIR}/webserver/include 7 | ${PROJECT_SOURCE_DIR}/webserver/authenticators/ldap/ldap-cpp/ 8 | ${OPENLDAP_INCLUDE_DIR}) 9 | 10 | add_library(ldapauth SHARED 11 | src/plugin.cpp 12 | ldap-cpp/cldap_entry.cpp 13 | ldap-cpp/cldap_mod.cpp 14 | ldap-cpp/cldap_server.cpp) 15 | 16 | target_compile_options(ldapauth PUBLIC -Wno-unknown-pragmas) 17 | 18 | target_link_libraries(ldapauth 19 | ${OPENLDAP_LIBRARIES} 20 | util) 21 | 22 | install(TARGETS ldapauth DESTINATION ${INSTALL_AUTH_DIR}) 23 | -------------------------------------------------------------------------------- /webserver/authenticators/plain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | include 3 | ${PROJECT_SOURCE_DIR}/util/include 4 | ${PROJECT_SOURCE_DIR}/webserver/include) 5 | 6 | add_library(plainauth SHARED 7 | src/plugin.cpp) 8 | 9 | target_compile_options(plainauth PUBLIC -Wno-unknown-pragmas) 10 | 11 | target_link_libraries(plainauth 12 | util) 13 | 14 | install(TARGETS plainauth DESTINATION ${INSTALL_AUTH_DIR}) 15 | -------------------------------------------------------------------------------- /webserver/include/webserver/requesthandler.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_WEBSERVER_PLUGIN_H 2 | #define CC_WEBSERVER_PLUGIN_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "pluginhandler.h" 11 | #include "mongoose.h" 12 | 13 | namespace cc 14 | { 15 | namespace webserver 16 | { 17 | 18 | class RequestHandler 19 | { 20 | public: 21 | virtual std::string key() const = 0; 22 | virtual int beginRequest(struct mg_connection*) = 0; 23 | virtual ~RequestHandler() = default; 24 | }; 25 | 26 | } // webserver 27 | } // cc 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /webserver/src/mainrequesthandler.h: -------------------------------------------------------------------------------- 1 | #ifndef CC_WEBSERVER_MAINREQUESTHANDLER_H 2 | #define CC_WEBSERVER_MAINREQUESTHANDLER_H 3 | 4 | #include 5 | #include 6 | 7 | namespace cc 8 | { 9 | namespace webserver 10 | { 11 | 12 | class Session; 13 | class SessionManager; 14 | 15 | class MainRequestHandler 16 | { 17 | public: 18 | SessionManager* sessionManager; 19 | PluginHandler pluginHandler; 20 | std::map dataDir; 21 | std::string gaTrackingIdPath; 22 | 23 | int operator()(struct mg_connection* conn_, enum mg_event ev_); 24 | 25 | private: 26 | int begin_request_handler(struct mg_connection* conn_); 27 | std::string getDocDirByURI(std::string uri_); 28 | 29 | // Detail template - implementation in the .cpp only. 30 | template 31 | auto executeWithSessionContext(cc::webserver::Session* sess_, F func); 32 | }; 33 | 34 | } // webserver 35 | } // cc 36 | 37 | #endif // CC_WEBSERVER_MAINREQUESTHANDLER_H 38 | -------------------------------------------------------------------------------- /webserver/src/threadedmongoose.cpp: -------------------------------------------------------------------------------- 1 | #include "threadedmongoose.h" 2 | 3 | namespace cc 4 | { 5 | namespace webserver 6 | { 7 | 8 | SignalChanger::SignalChanger(int signum_, SignalHandler newHandler_) 9 | { 10 | _origSignum = signum_; 11 | _origHandler = signal(signum_, newHandler_); 12 | } 13 | 14 | SignalChanger::~SignalChanger() 15 | { 16 | signal(_origSignum, _origHandler); 17 | } 18 | 19 | volatile int ThreadedMongoose::exitFlag = 0; 20 | 21 | const unsigned ThreadedMongoose::DEFAULT_MAX_THREAD; 22 | 23 | ThreadedMongoose::Handler ThreadedMongoose::handler; 24 | 25 | ThreadedMongoose::ThreadedMongoose(int numThreads_) : _numThreads(numThreads_) 26 | { 27 | } 28 | 29 | void ThreadedMongoose::setOption( 30 | const std::string& optName_, 31 | const std::string& value_) 32 | { 33 | _options[optName_] = value_; 34 | } 35 | 36 | std::string ThreadedMongoose::getOption(const std::string& optName_) 37 | { 38 | return _options[optName_]; 39 | } 40 | 41 | void ThreadedMongoose::run(Handler handler_) 42 | { 43 | run((void*)0, handler_); 44 | } 45 | 46 | void ThreadedMongoose::signalHandler(int sigNum_) 47 | { 48 | ThreadedMongoose::exitFlag = sigNum_; 49 | } 50 | 51 | void* ThreadedMongoose::serve(void* server_) 52 | { 53 | while (!exitFlag) 54 | { 55 | mg_poll_server((mg_server*)server_, 1000); 56 | } 57 | 58 | return nullptr; 59 | } 60 | 61 | int ThreadedMongoose::delegater(mg_connection *conn_, enum mg_event ev_) 62 | { 63 | if (handler) 64 | { 65 | return handler(conn_, ev_); 66 | } 67 | 68 | return MG_FALSE; 69 | } 70 | 71 | } // webserver 72 | } // cc 73 | --------------------------------------------------------------------------------