DEV Community

Discussion on: How To Document A Kotlin Project

Collapse
 
javaherisaber profile image
Mahdi Javaheri

Hi
really nice and clean approach
I'm trying to use your plugin to document my code in Android Studio IDE
my project contains 3 modules
module1
module2
module3
I created new module "docs" to add orchid sources
I followed your instruction but it's not generating any dokka docs

Collapse
 
cjbrooks12 profile image
Casey Brooks

Hi Mahdi, thanks for trying Orchid out! There are a few things you could check:

  1. Are the sourceDirs paths set up correctly? On the command-line, in the folder containing your config.yml file, try running ls on each path you set up in kotlindoc.sourceDirs and make sure it lists files and folders in the root of your Kotlin code being documented. Note that the path given in this tutorial assumes the module being documented is named app, so be sure to change that to module1, module2, etc. to match your modules.
  2. Is the plugin and everything else set up correctly? Are you getting any error messages when you run Orchid?
  3. Which version of Orchid are you using? The most recent version is currently 0.16.10, so you could try updating to that version and see how it runs.

If none of those work, please reach out on the Gitter Chat and I can work with you a bit more quickly to help you get this problem resolved.

Collapse
 
javaherisaber profile image
Mahdi Javaheri • Edited

I'm using version 0.16.10 on a Windows machine running Android Studio 3.4
This is my directory tree

and this is my config.yml

theme:
  menu:
    - type: 'kotlindocPackages'
    - type: 'kotlindocClasses'
  kotlindoc:
    sourceDirs:
      - "./../../../../module1/src/main/java"
    pages:
      extraCss:
        - 'assets/css/orchidKotlindoc.scss'
      menu:
        - type: "kotlindocClassLinks"
          includeItems: true

All of the other parts like wiki and pages are working but dokka is not generating any docs
there isn't any error and ALL PACKAGES or ALL CLASSES are linked to localhost:8080

i've tried these sourceDirs to see if i'm not pointing to an empty dir or maybe this is not how we get to a directory on Windows
"./../../../../module1/src/main/java/com/example/app"
"../../../../module1/src/main/java/com/example/app"
"../../../../module1/src/main/java"
".\\..\\..\\..\\..\\module1\\src\\main\\java\\com\\example\\app"
".\\..\\..\\..\\..\\module1\\src\\main\\java"
"..\\..\\..\\..\\module1\\src\\main\\java\\com\\example\\app"
"..\\..\\..\\..\\module1\\src\\main\\java"

is there anything else required to be added in gradle dependencies?
i mean do i need to add dokka library to module1 separately? or it is included as dokka-commandLine in orchid?

I've joined Gitter chat, i hope we'll figure it out soon
thanks for the instruction

Thread Thread
 
cjbrooks12 profile image
Casey Brooks

It seems like you've got it set up correctly. Since you have the kotlindocPackages and kotlindocClasses being created and there are no errors, the plugin should be installed correctly. And the file paths also look correct, it should be able to use either forward or back-slashes for the path.

Try running ./gradlew clean :docs:orchidServe instead of ./gradlew :docs:orchidServe as listed in the tutorial. The clean task will get rid of cached outputs which may be causing this issue.

Thread Thread
 
javaherisaber profile image
Mahdi Javaheri • Edited

kotlindoc component was mistakenly placed under "menu" component
thank you for your guide
i really appreciate your efforts on this library
it's a clean and robust way to have all of the documents in one place