Git Product home page Git Product logo

sourcetrailcsharpindexer's Introduction

This project attempts to create Sourcetrail-Databases from C# source code.
It is an offspring to my first project in the area of code-analysis, SourcetrailDotnetIndexer.

It uses the Roslyn compiler to parse the source and gather symbol-information.
It uses SourcetrailDB for writing the Sourcetrail-database.
For convenience, the native DLL for SourcetrailDB is already included, so you don't have to build it yourself.
Note, the native DLL is a x64 DLL so in your project settings, you have to specify x64 as the target platform as well.


Note, this project is in a very early and experimental state.
It probably contains bugs, so please be aware.

Contributors welcome !

As i'm only able to work on this project in my spare time, anyone who is able to contribute is welcome to do so !
If you have already worked with Roslyn, please check out the code and report any bugs you find or tell me how this tool can be made more efficient.

Building

Open the .sln in VisualStudio and build.
Make sure, you set the target-platform to x64 ! (because of the native SourcetrailDB.dll)

Usage

The following command-line arguments are supported:

  • -i Input-File/Path
    Specifies the full path of a file or a folder to index
    If the argument refers to a folder, all *.cs-files in this folder and all sub-folders will be included
    may be specified multiple times
  • -o OutputFilename
    Full path and filename of the generated Sourcetrail-database
  • -r AssemblyPathOrFileName
    Specifies the path to a reference-assembly (used for type-resolution)
    If the argument refers to a folder, all assemblies in this folder will be referenced
    may be specified multiple times
  • -fp Framework-Path
    Specifies the path to the .net-framework, your application is based on
    By default, the indexer attempts to use the .net5 assemblies
  • -ox (OmitExternals)
    Specifies, that types from referenced assemblies should be omitted from the generated database

Examples:

  • Creating a database for the indexer itself
    Assuming, the sources are stored in C:\code\SourcetrailCSharpIndexer\SourcetrailCSharpIndexer
    The indexer is run from the output-folder (e.g. \bin\Debug\net5.0)

    SourcetrailCSharpIndexer -i C:\code\SourcetrailCSharpIndexer\SourcetrailCSharpIndexer -o CSharpIndexer.srctrldb -ox

    This generates the files CSharpIndexer.srctrldb and CSharpIndexer.srctrlprj in the current directory.
    The file CSharpIndexer.srctrlprj is the one you open in Sourcetrail (via the Open Project command)

    If you open the database in Sourcetrail, you will notice that there are several errors reported in the database.
    This is because we did not reference the assemblies, that are required to actually compile and build the project.
    To add these assemblies, we build the project once in VisualStudio and then reference the assemblies from the output-folder.

  • Extending the first example with referenced assemblies

    SourcetrailCSharpIndexer -i C:\code\SourcetrailCSharpIndexer\SourcetrailCSharpIndexer -o CSharpIndexer.srctrldb -ox -r C:\code\SourcetrailCSharpIndexer\SourcetrailCSharpIndexer\bin\Debug\net5.0

    If you re-open the database in Sourcetrail, the errors should be gone.

Screenshots

After executing the second example, open the database in Sourcetrail, select the class Program and inside that class the method Main
You should see something like this:
Screenshot1

sourcetrailcsharpindexer's People

Contributors

packdat avatar

Stargazers

 avatar  avatar Tinymonk Steven avatar  avatar  avatar  avatar  avatar Kevin Gliewe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.