0

I have in my gradle various buildConfigFields and I would like to generate the JavaDoc for one of those in the BuildConfig class.
I already have a comment in gradle

buildConfigField 'Integer', 'BACKGROUND_COUNTDOWN', '30 * 60 * 1000 - 10000' // 29 minutes, 50 seconds, the remaining 10 seconds are countdown shown in the foreground

I would like to have that comment written in JavaDoc above the corresponding constant in BuildConfig

/**
* 29 minutes, 50 seconds, the remaining 10 seconds are countdown shown in the foreground
*/
public static final Integer STOP_ALARM_BACKGROUND_COUNTDOWN = 30 * 60 * 1000 - 10000;

this way, when another programmer does Ctrl + Q on that constant, whenever they find it in the code, they see the comment as documentation, without having to go look it up in the gradle file.

enter image description here

Is such a thing even possible?

Cliff Burton
  • 3,414
  • 20
  • 33
  • 47

1 Answers1

0

As per the official docs there seems to have a field called comment. It doesn't specify if it's a //-style comment or a javadoc-style comment; you might give that a try

Some random IT boy
  • 7,569
  • 2
  • 21
  • 47
  • how am I supposed to use that `comment`? I've tried `buildConfigField 'Integer', 'BACKGROUND_COUNTDOWN', '30 * 60 * 1000 - 10000', '"bananana"'` but it gives `Could not find method BuildConfigField() for arguments [Integer, BACKGROUND_COUNTDOWN, 30 * 60 * 1000 - 10000, "bananana"]` – Cliff Burton Nov 23 '22 at 11:11
  • I've made tens of attempts at including that `comment` in my gradle but not a single one worked – Cliff Burton Nov 23 '22 at 11:25
  • You'd need to use the available public constructor and pass the third argument with something meaningful [as these guys are doing in reddit](https://www.reddit.com/r/androiddev/comments/pf5ze2/buildgradle_adding_buildconfig_field_dynamically/) – Some random IT boy Nov 23 '22 at 11:32