Skip to content

Commit

Permalink
WIP: Kotlin 1.5 with necessary dokka upgrade (#2055)
Browse files Browse the repository at this point in the history
* Upgrade mvn publish pluging; fix dokka setup for change

* Attempt to get dokkaGfm to work properly - OOM/Metaspace problem, see: Kotlin/dokka#1405

* Upgrade to Kotlin 1.5

* Upgrade to kotlin 1.5; fix misk-admin config; use --no-daemon --> still OOM/Metaspace :(

* Do Dokka tasks in separate daemons and separate modules; reduce memeory required

* Remove non-existent dir call

* Only do the publish docs when building master
  • Loading branch information
chris-ryan-square committed Jul 20, 2021
1 parent b55518a commit 406f79b
Show file tree
Hide file tree
Showing 67 changed files with 125 additions and 450 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/Publish-Website.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build docs site (& deploy if on master to gh-pages)
name: Build docs site & deploy to gh-pages (master only)

on:
pull_request:
push:
branches:
- master
Expand Down
71 changes: 69 additions & 2 deletions .github/workflows/prepare_mkdocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,74 @@
set -ex

# Generate the API docs
./gradlew dokka
# Restore the following command when this issue is fixed: https://github.com/cashapp/misk/issues/2056
#./gradlew --no-daemon dokkaGfm

preserve_index() {
echo "" >> docs/0.x/tmpindex.md
cat docs/0.x/index.md >> docs/0.x/tmpindex.md
}

./gradlew --no-daemon misk:dokkaGfm ; mv docs/0.x/index.md docs/0.x/tmpindex.md
./gradlew --no-daemon misk-actions:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-admin:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-aws:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-aws-dynamodb:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-aws-dynamodb-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-aws2-dynamodb:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-aws2-dynamodb-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-core:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-cron:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-crypto:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-datadog:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-eventrouter:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-events:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-events-core:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-events-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-feature:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-feature-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-gcp:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-gcp-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-grpc-reflect:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-grpc-tests:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-hibernate:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-hibernate-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-inject:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-jdbc:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-jdbc-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-jobqueue:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-jobqueue-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-jooq:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-launchdarkly:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-launchdarkly-core:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-metrics:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-metrics-digester:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-metrics-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-policy:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-policy-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-prometheus:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-redis:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-service:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-slack:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-transactional-jobqueue:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-warmup:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-zookeeper:dokkaGfm ; preserve_index
./gradlew --no-daemon misk-zookeeper-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-aws-environment:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-client:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-config:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-containers-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-deployment:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-deployment-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-feature:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-feature-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-logging:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-logging-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-resource-loader:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-resource-loader-testing:dokkaGfm ; preserve_index
./gradlew --no-daemon wisp-ssl:dokkaGfm ; preserve_index
mv docs/0.x/tmpindex.md docs/0.x/index.md

# Dokka filenames like `-http-url/index.md` don't work well with MkDocs <title> tags.
# Assign metadata to the file's first Markdown heading.
Expand All @@ -36,4 +103,4 @@ cat README.md | grep -v 'project website' > docs/index.md
cp CHANGELOG.md docs/changelog.md
cp CONTRIBUTING.md docs/contributing.md
cp RELEASING.md docs/releasing.md
cp RELEASING-MANUAL.md docs/releasing-manual.md
cp RELEASING-MANUAL.md docs/releasing-manual.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lib
dist
.hash
hooks.gradle
*.hprof

**/site/
docs/0.x/*
Expand Down
48 changes: 32 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
}

dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.0")
classpath(Dependencies.kotlinAllOpenPlugin)
classpath(Dependencies.kotlinGradlePlugin)
classpath(Dependencies.kotlinNoArgPlugin)
Expand All @@ -24,13 +25,13 @@ buildscript {
val testShardNonHibernate by tasks.creating() {
group = "Continuous integration"
description = "Runs all tests that don't depend on misk-hibernate. " +
"This target is intended for manually sharding tests to make CI faster."
"This target is intended for manually sharding tests to make CI faster."
}

val testShardHibernate by tasks.creating() {
group = "Continuous integration"
description = "Runs all tests that depend on misk-hibernate. " +
"This target is intended for manually sharding tests to make CI faster."
"This target is intended for manually sharding tests to make CI faster."
}

subprojects {
Expand All @@ -55,15 +56,15 @@ subprojects {
jvmTarget = "1.8"

// TODO(alec): Enable again once Environment enum is deleted
allWarningsAsErrors = false
allWarningsAsErrors = false
}
}
val compileTestKotlin by tasks.getting(KotlinCompile::class) {
kotlinOptions {
jvmTarget = "1.8"

// TODO(alec): Enable again once Environment enum is deleted
allWarningsAsErrors = false
allWarningsAsErrors = false
}
}

Expand All @@ -81,16 +82,6 @@ subprojects {
add("api", enforcedPlatform(Dependencies.nettyBom))
}

// We have to set the dokka configuration after evaluation since the com.vanniktech.maven.publish
// plugin overwrites our dokka configuration on projects where it's applied.
afterEvaluate {
val dokka by tasks.getting(DokkaTask::class) {
reportUndocumented = false
skipDeprecated = true
jdkVersion = 8
}
}

tasks.withType<Test> {
useJUnitPlatform()
testLogging {
Expand All @@ -105,7 +96,16 @@ subprojects {

val testTask = tasks.findByName("test")
if (testTask != null) {
if (listOf("misk-aws","misk-events","misk-jobqueue","misk-jobqueue-testing","misk-jdbc","misk-jdbc-testing","misk-hibernate","misk-hibernate-testing").contains(name)) {
if (listOf(
"misk-aws",
"misk-events",
"misk-jobqueue",
"misk-jobqueue-testing",
"misk-jdbc",
"misk-jdbc-testing",
"misk-hibernate",
"misk-hibernate-testing"
).contains(name)) {
testShardHibernate.dependsOn(testTask)
} else {
testShardNonHibernate.dependsOn(testTask)
Expand All @@ -120,7 +120,23 @@ subprojects {
// https://github.com/square/okio/issues/647
configurations.all {
if (name.contains("kapt") || name.contains("wire") || name.contains("proto") || name.contains("Proto")) {
attributes.attribute(Usage.USAGE_ATTRIBUTE, this@subprojects.objects.named(Usage::class, Usage.JAVA_RUNTIME))
attributes.attribute(
Usage.USAGE_ATTRIBUTE,
this@subprojects.objects.named(Usage::class, Usage.JAVA_RUNTIME)
)
}
}


tasks.withType<DokkaTask>().configureEach {
outputDirectory.set(file("$rootDir/docs/0.x"))
dokkaSourceSets {
configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
}
}
}

}
18 changes: 9 additions & 9 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ object Dependencies {
val junitEngine = "org.junit.jupiter:junit-jupiter-engine:5.7.2"
val junitGradlePlugin = "org.junit.platform:junit-platform-gradle-plugin:1.2.0"
val junitParams = "org.junit.jupiter:junit-jupiter-params:5.7.2"
val kotlinAllOpenPlugin = "org.jetbrains.kotlin:kotlin-allopen:1.4.32"
val kotlinBom = "org.jetbrains.kotlin:kotlin-bom:1.4.32"
val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
val kotlinNoArgPlugin = "org.jetbrains.kotlin:kotlin-noarg:1.4.32"
val kotlinReflection = "org.jetbrains.kotlin:kotlin-reflect:1.4.32"
val kotlinAllOpenPlugin = "org.jetbrains.kotlin:kotlin-allopen:1.5.21"
val kotlinBom = "org.jetbrains.kotlin:kotlin-bom:1.5.21"
val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
val kotlinNoArgPlugin = "org.jetbrains.kotlin:kotlin-noarg:1.5.21"
val kotlinReflection = "org.jetbrains.kotlin:kotlin-reflect:1.5.21"
val kotlinRetry = "com.michael-bull.kotlin-retry:kotlin-retry:1.0.8"
val kotlinStdLibJdk8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32"
val kotlinTest = "org.jetbrains.kotlin:kotlin-test:1.4.32"
val kotlinxCoroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3"
val kotlinStdLibJdk8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21"
val kotlinTest = "org.jetbrains.kotlin:kotlin-test:1.5.21"
val kotlinxCoroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"
val kubernetesClient = "io.kubernetes:client-java:1.0.0"
val launchDarkly = "com.launchdarkly:launchdarkly-java-server-sdk:5.3.0"
val logbackClassic = "ch.qos.logback:logback-classic:1.2.3"
val loggingApi = "io.github.microutils:kotlin-logging:2.0.10"
val mavenPublishGradlePlugin = "com.vanniktech:gradle-maven-publish-plugin:0.9.0"
val mavenPublishGradlePlugin = "com.vanniktech:gradle-maven-publish-plugin:0.17.0"
val mockitoCore = "org.mockito:mockito-core:3.11.2"
val moshiAdapters = "com.squareup.moshi:moshi-adapters:1.12.0"
val moshiCore = "com.squareup.moshi:moshi:1.12.0"
Expand Down
11 changes: 7 additions & 4 deletions gradle-mvn-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ apply plugin: "com.vanniktech.maven.publish"
mavenPublish {
releaseSigningEnabled = !getGpgKey().isEmpty()

targets {
installArchives {
releaseRepositoryUrl = file("${rootProject.buildDir}/localMaven").toURI().toString()
snapshotRepositoryUrl = file("${rootProject.buildDir}/localMaven").toURI().toString()
publishing {
repositories {
maven {
//releaseRepositoryUrl = file("${rootProject.buildDir}/localMaven").toURI().toString()
// snapshotRepositoryUrl = file("${rootProject.buildDir}/localMaven").toURI().toString()
url = "${rootProject.buildDir}/localMaven"
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

org.gradle.jvmargs=-XX:MaxMetaspaceSize=4g -XX:MaxHeapSize=4g -Xmx4g -Xms2000m
7 changes: 0 additions & 7 deletions misk-actions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,4 @@ dependencies {
testImplementation(Dependencies.kotlinTest)
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@ dependencies {
testImplementation(Dependencies.wireRuntime)
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-aws-dynamodb-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,4 @@ dependencies {
testImplementation(Dependencies.awaitility)
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-aws-dynamodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,4 @@ dependencies {
implementation(project(":misk-service"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-aws/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,4 @@ dependencies {
testImplementation(project(":misk-feature-testing"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-aws2-dynamodb-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,4 @@ dependencies {
testImplementation(Dependencies.junitParams)
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-aws2-dynamodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,4 @@ dependencies {
implementation(project(":misk-service"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,4 @@ dependencies {
testImplementation(project(":wisp-logging-testing"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-cron/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,4 @@ dependencies {
testImplementation(project(":misk-testing"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-crypto/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,4 @@ dependencies {
testImplementation(project(":misk-testing"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-datadog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@ dependencies {
api(project(":wisp-logging"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")
7 changes: 0 additions & 7 deletions misk-eventrouter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@ dependencies {
testImplementation(project(":misk-testing"))
}

afterEvaluate {
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
}
}

apply(from = "$rootDir/gradle-mvn-publish.gradle")

0 comments on commit 406f79b

Please sign in to comment.