├── .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 |
4 |
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 | 
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 | 
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 | 
--------------------------------------------------------------------------------
/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 | 
--------------------------------------------------------------------------------
/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