2

First of all, this is not a duplicate question. This question is inspired by the comment on this post.

I know how to do Javadoc comments in Android Studio. And I am able to link java files using @link like this:

{@link FileName#methodName()} some text to display

but I am not able to figure out a way to link build.gradle file in the comments. The reason why I need this that we are storing buildConfigField in the Gradle file like this:

 buildTypes.each {
    it.buildConfigField('int', 'LANGUAGE_VERSION', "3")
}

I was commenting on the file that makes sure to upgrade this version number every time whenever there is something changed in the file. And while writing down java comments on the file I faced this situation. Is there a way to link the file?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60

1 Answers1

0

You can Try giving the absolute path to your build.gradle in your javadoc comments by using HTML link tag

/**
 *  <a href="./path to build.gradle/build.gradle">Link</a>  
 */

What Oracle Description says about including files in Javadoc:

Miscellaneous Unprocessed Files

You can also include in your source any miscellaneous files that you want the Javadoc tool to copy to the destination directory. These typically includes graphic files, example Java source (.java) and class (.class) files, and self-standing HTML files whose content would overwhelm the documentation comment of a normal Java source file. To include unprocessed files, put them in a directory called doc-files which can be a subdirectory of any package directory that contains source files. You can have one such subdirectory for each package. You might include images, example code, source files, .class files, applets and HTML files. For example, if you want to include the image of a button button.gif in the java.awt.Button class documentation, you place that file in the /home/user/src/java/awt/doc-files/ directory. Notice the doc-files directory should not be located at /home/user/src/java/doc-files because java is not a package -- that is, it does not directly contain any source files.

All links to these unprocessed files must be hard-coded, because the Javadoc tool does not look at the files -- it simply copies the directory and all its contents to the destination. For example, the link in the Button.java doc comment might look like:

/**
 * This button looks like this:
 * <img src="doc-files/Button.gif">
 */ 
AsthaUndefined
  • 1,111
  • 1
  • 11
  • 24