Coder Social home page Coder Social logo

ramyromel / javadocapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from i-al-istannen/javadocapi

1.0 0.0 0.0 178 KB

Builds a slightly more convenient model of java source code to power a discord javadoc bot.

License: MIT License

Java 100.00%

javadocapi's Introduction

JavadocApi

JavadocApi can index source code (as a ZIP or in the file system) and generate a SQLite database containing every exported class, field and method along with a structural JSON representation of its Javadoc.

This project also contains a small fuzzy query-engine that can look up data from multiple databases and fuzzy match it against user queries. This works entirely by issuing SQLite commands, so RAM usage is kept quite low in production.

Demo

Indexing a project

JavadocApi needs a json configuration as input that describes the project you want to index. A few sample configurations can be found in src/main/resources. The format of the config is roughly this:

{
  // The path to write the database to
  "outputPath": "target/Jdk-Index.db",
  // All paths to the project source code. If the project consists of multiple
  // src folders, you can list them here
  "resourcePaths": ["/usr/lib/jvm/java-17-openjdk/lib/src.zip"],
  // The packages to include in the database. `"*"` can be used as a wildcard
  // to include *all* packages.
  "allowedPackages": [
    "java.applet",
    "java.awt"
  ]
}

You can then simply run java -jar JavadocApi.jar <path to config>

Having fun with the classpath

Sometimes knowing the classpath is quite convenient as it allows for better resolution of link targets. JavadocApi understands (simple) maven and gradle build files and uses them to build its classpath dynamically. The inner workings are a bit scary, but it basically translates your gradle or maven file into a simplified pom.xml and then asks maven to download and resolve all needed dependencies.

To enable this feature, you need to set the mavenHome and buildFiles keys:

{
  "outputPath": "target/JDA-Index.db",
  "resourcePaths": ["/home/i_al_istannen/.temp/Indizes/JDA.zip"],
  "allowedPackages": [
    "*"
  ],
  // All gradle/pom files you want JavadocApi to inspect
  "buildFiles": ["/home/i_al_istannen/.temp/Indizes/JDA/build.gradle.kts"],
  // Path to your maven home
  "mavenHome": "/opt/maven"
}

javadocapi's People

Contributors

i-al-istannen avatar sirywell avatar

Stargazers

 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.