2

I'm building an automatic documentation generator for our SDK

I want to include this script in our build process and CI, and so want it to be able to be run when a specific gradle task is executed

For Android, I'm starting off with Javadoc and converting it from there. I'm fairly happy with what's coming out right now, although when I run from command line I am unable to get a set of docs that are aware of the Android Sources.

This is my current command:

"/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/javadoc" 
-public 
-splitindex 
-use 
-version 
-sourcepath ./src/main/java 
-classpath "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin" 
-bootclasspath /Users/user/Library/Android/sdk/platforms/android-28/android.jar 
-d $JAVADOC_DEST_DIR 
-subpackages . 
&> "${OUTPUT_LOGS_DEST}/log1-javadoc.sh"

This does generate the javadoc for my SDK, however I get hundreds of these:

Loading source files for package <mypackage>...
Constructing Javadoc information...
./src/main/java/<mypackage>/AnExample.java:3: error: package android.support.v7.app does not exist
import android.support.v7.app.AppCompatCallback;
                             ^

As you can see I only supply the -bootclasspath /Users/user/Library/Android/sdk/platforms/android-28/android.jar how do I specify other references to other things like the support library?

Update 1

I think basically I need to do something like was suggested in the answer to this question

So I would run the gradle task, then include the output/generated classpath as a param for the subsequent task that starts the docs generation process

This means I can meet my original requirement of running this after/from some gradle task. Realistically though it's not what I wanted - as I want to be able to run the docs generation at any time.. so perhaps I need to build some gradle into my generation tasks

Saik Caskey
  • 500
  • 4
  • 18

0 Answers0