orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
514 stars 53 forks source link

Create javadoc from commandline #240

Closed guichazan closed 5 years ago

guichazan commented 5 years ago

Hi!

This seems to be a great tool, but is it possible to generate the javadocs with Orchid from the command line? I saw the javadocs wiki but it seems to be incomplete.

thanks and keep up the good work!

guich

cjbrooks12 commented 5 years ago

Orchid doesn't create the traditional Javadocs that you're used to, but rather hooks into it, gets its raw data, and makes its own website using that data. An example of what it might look like is Orchid's own code docs. Those ones are Kotlindocs, but the Javadocs will look nearly the same.

Orchid is easiest to use with Gradle, but you can use its CLI directly if you set it up using the kscript method outlined here. Then you can use the CLI to generate a website with Javadocs just the same as if building with Gradle, there's no difference between the two.

guichazan commented 5 years ago

Hi,

I decided to use gradle. So i created a build.gradle with this:

plugins {
    id "com.eden.orchidPlugin" version "0.16.1"
}

repositories {
    jcenter()
    maven { url "https://kotlin.bintray.com/kotlinx" }
    maven { url 'https://jitpack.io' }
}

dependencies {
    orchidRuntime 'io.github.javaeden.orchid:OrchidAll:0.16.1'
    orchidRuntime 'io.github.javaeden.orchid:OrchidJavadoc:0.16.4'
}

orchid {

    // The following properties are optional
    version = "1.0.13"
    baseUrl = "http://javadoc.ueeze.com"                         // a baseUrl prepended to all generated links. Defaults to '/'
    srcDir  = "javadoc"      // defaults to 'src/orchid/resources'
    destDir = "javadoc_orchid" // defaults to 'build/docs/orchid'
    runTask = "build"                   // specify a task to run with 'gradle orchidRun'
}

When i run it with > gradlew orchidRun, i get:

Flag values:

-absDefaultVersion: eng-NASB -adminTheme: Default -baseUrl: http://javadoc.ueeze.com -defaultTemplateExtension: peb -dest: G:\ueeze\doc\javadoc_orchid -dryDeploy: false -environment: debug -githubToken: [HIDDEN] -logLevel: VERBOSE -port: 8080 -src: G:\ueeze\doc\javadoc -task: build -theme: Default -version: 1.0.13

...

Build Complete Generated 2 pages in 5s

But i have 750 pages under the javadoc folder

I also tried to add the OrchidEditorial, so i added: orchidRuntime 'io.github.javaeden.orchid:OrchidEditorial:0.16.1' and theme "OrchidEditorial"

then Orchid says that the theme "theme-OrchidEditorial" could not be found.

Thanks in advance

 guich
cjbrooks12 commented 5 years ago

Orchid's Javadoc generation is totally separate from Gradle's, and you'll need to tell Orchid the Java sources you want to be documented in your config.yml file, which is separate from the srcDir set in Gradle.

# config.yml
...
javadoc:
  sourceDirs: 
    - '../../main/java' # a relative path from your `srcDir` to the directory containing Java file

For using the Editorial theme, the name is just Editorial (not OrchidEditorial)


// build.gradle
...
orchid {
    ...
    theme = "Editorial"
}
guichazan commented 5 years ago

Hi!

Created a single config.yml with this:

javadoc: sourceDirs:

If i add the theme="Editorial", i get an error:

java.exe'' finished with non-zero exit value -1073740940

If i run without the theme, i get the same 2 pages generated.

If i change the srcDir to "../core/src" i still get only 2 pages generated.

cjbrooks12 commented 5 years ago

Do you have this project pushed to a repo that I might look at and try to figure out what's going on?

guichazan commented 5 years ago

Not yet, but once i release it i will send to you.

thanks for your help!

elR1co commented 5 years ago

Hi,

this project looks very cool ! Thanks a lot for the work done !

By the way, do you support @link tags in javadoc ? When I generate it, I have '{@link MyClass}' as output instead of having a link.

Thanks by advance.

cjbrooks12 commented 5 years ago

@elR1co that looks like a bug, I've opened a new issue to track it #251