-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix docs #347
Conversation
@@ -132,7 +132,7 @@ jobs: | |||
- android/restore-build-cache | |||
- run: | |||
name: Dokka | |||
command: ./gradlew dokka | |||
command: ./gradlew dokkaHtmlMultiModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new command for generating stuff in a modularized setup
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.10.0" | ||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.32" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the reason the docs look so much nicer now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see they have fixed that horrible layout haha
apply plugin: 'org.jetbrains.dokka' | ||
|
||
tasks.dokkaHtmlMultiModule.configure { | ||
outputDirectory.set(file("docs")) | ||
includes.from("README.md") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the parent config
docs/index.html
Outdated
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="refresh" content="0; url=purchases/index.html" /> | ||
</head> | ||
<body> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this should have been versioned in the first place, but not looking to change that right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I created this docs/index.html
to redirect to purchases/index.html
. This was so accessing https://sdk.revenuecat.com/android/
would redirect to https://sdk.revenuecat.com/android/purchases/index.html
. Dokka was creating the files in purchases
because their multi module support was horrible. I think we can un-version it now because dokka is creating an index.html where we want it to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh interesting, makes sense. I'll kill it then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public/build.gradle
Outdated
dokkaSourceSets { | ||
configureEach { | ||
reportUndocumented.set(true) | ||
includeNonPublic.set(false) | ||
skipDeprecated.set(true) | ||
|
||
externalDocumentationLink { | ||
url.set(uri("https://developer.android.com/reference/package-list").toURL()) | ||
} | ||
sourceLink { | ||
localDirectory.set(file("src/main/java")) | ||
remoteUrl.set(uri("https://github.com/revenuecat/purchases-android/blob/master/public/src/main/java").toURL()) | ||
remoteLineSuffix.set("#L") | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be done in each package that has at least one public type
@@ -31,55 +32,23 @@ dependencies { | |||
testImplementation 'org.assertj:assertj-core:3.13.2' | |||
} | |||
|
|||
apply plugin: 'com.vanniktech.maven.publish' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was the original problem: we still had dokka set up for the purchases
module, but a lot of stuff lives in public
now
skipDeprecated = true | ||
// Allows linking to documentation of the project's dependencies (generated with Javadoc or Dokka) | ||
// Repeat for multiple links | ||
externalDocumentationLink { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we confirm the trailing slash is not required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually never got this to work. Does this work in the new version? I was looking for an example but I can't find it. I think we don't have any public link to the billing client anymore and everything is in the google
module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to remove it, I kept it around for the sake of having everything that we had before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I would keep it the same it was before
} | ||
|
||
tasks.dokkaHtmlPartial.configure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to pull the common configuration stuff out somehow, but i'm also not great at gradle...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be extracted to a file like library.gradle
and call it dokka.gradle
. Then apply the file doing:
apply from: "$rootProject.projectDir/dokka.gradle"
But there's one thing that changes: the source directory. It is src/main/java
for public
and src/main/kotlin
for purchases
. I am not sure how to change that part in each of the modules. Maybe setting just that part in the module's gradle inherits everything from the dokka.gradle
and changes that part for the module. Something like:
apply from: "$rootProject.projectDir/dokka.gradle"
...
dokkaSourceSets {
configureEach {
sourceLink {
localDirectory.set(file("src/main/java"))
remoteUrl.set(uri("https://github.com/revenuecat/purchases-android/blob/main/public/src/main/java").toURL())
}
}
}
We should move everything to src/main/kotlin
although not a priority at all.
As an example. I found the arrow
project does it this way https://github.com/arrow-kt/arrow/blob/ee319ace7df8dd05001406b3727aa3ed90188e07/arrow-libs/gradle/apidoc-creation.gradle
They have a apidoc-creation.gradle
, and they do " ${relativeProjectPath('src/main/kotlin')}"
to figure out the relative path of the source files. Then they apply the gradle file in each of the modules https://github.com/arrow-kt/arrow/blob/2569ece084a0ace0a77c0ed126b452babe69d52b/arrow-libs/core/arrow-annotations/build.gradle#L7. They have a gradle property https://github.com/arrow-kt/arrow/blob/main/arrow-libs/gradle.properties#L80 pointing to that file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I think that's the intent of the dokkaHtmlPartial
clauses.
I started by trying to have as much stuff in a single file as possible but kept running into issues, so I ended up going with this path for the sake of not spending too much time on this.
I can give it another shot if you think it's important to do now, otherwise we can add it to the backlog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's important to do right now 🙂
our docs for purchases-android were pretty broken. They only pointed to the
Purchases
type, didn't include much information in general or correctly link to the source code.I believe this was broken during our modularization project, since we shuffled a lot of stuff around but didn't update the dokka configuration.
This updates dokka to the latest version (as of writing), updates the format, and uses the Multi-Module setup from dokka so that we can link stuff nicely even if it's separated into packages.
I've already published the new version, you can see it in action in https://sdk.revenuecat.com/android/index.html.
Also, I absolutely suck at gradle, please point out if there are better ways to do things.