Skip to content

Commit cbe1d0c

Browse files
committed
Added more usage guidelines
1 parent caed35d commit cbe1d0c

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ it doesn't work with the popups in common IDE's and isn't as searchable.
77
Gist makes source embedding trivial since you can embed a single sample in multiple methods/classes and manage the sample
88
itself in a centeral location.
99

10-
With this tool you can get JavaDoc that looks like this: https://www.codenameone.com/javadoc/com/codename1/location/LocationManager.html
10+
Which makes it look like this: https://www.codenameone.com/javadoc/com/codename1/location/LocationManager.html
1111

1212
With JavaScript enabled you see this:
1313

@@ -17,9 +17,22 @@ Without JavaScript (or in IDE/search engine) you will see this:
1717

1818
![Without JavaScript](without-javascript-gist.png)
1919

20+
Those screenshots were generated by this javadoc, notice that all the source comes from [this gist](https://gist.github.com/codenameone/b0fa5280bde905a8f0cd):
2021

21-
The JavaDoc source embed tool allows you to use gist embeds directly in your javadoc without any change! When you
22-
generate JavaDoc it queries github for the gist contents and embeds it as a `<noscript>`
22+
```java
23+
/**
24+
* <p>The LocationManager is the main entry to retrieveLocation or to bind a LocationListener, important: in
25+
* order to use location on iOS you will need to define the build argument ios.locationUsageDescription.
26+
* This build argument should be used to describe to Apple &amp; the users why you need to use the location
27+
* functionality.</p>
28+
*
29+
* <p>Usage:</p>
30+
* <script src="https://gist.github.com/codenameone/b0fa5280bde905a8f0cd.js"></script>
31+
*/
32+
public abstract class LocationManager {
33+
```
34+
35+
When you generate JavaDoc it queries github for the gist contents and embeds it as a `<noscript>`
2336
alternative right into the code. This means IDE code completion will "just work" as it will have a sensible fallback.
2437

2538
Just pass the source directory and an output directory to the jar file and then generate the javadoc based on the output
@@ -35,6 +48,8 @@ java -jar JavaDocSourceEmbed-1.0-SNAPSHOT.jar pathToSrcDir/src build/tempJavaSou
3548
javadoc -protected -d dist/javadoc -windowtitle "Codename One API" build/tempJavaSources
3649
```
3750

51+
IMPORTANT: notice that we use a temporary directory to generate the source and don't generate to the original directory. The reason for that is simple. If you change the gist or add additional gists in the future youd want them to be updated.
52+
3853
Or using ant you can do something like:
3954
4055
```xml

0 commit comments

Comments
 (0)