Skip to content

Commit

Permalink
Merge pull request #135 from tKe/ktor3-inplace
Browse files Browse the repository at this point in the history
Update suspendapp-ktor to support ktor 3 and arrow 2
  • Loading branch information
serras authored Jan 21, 2025
2 parents 45fc6ee + 2a13d4d commit 207bad1
Show file tree
Hide file tree
Showing 102 changed files with 6,434 additions and 1,605 deletions.
76 changes: 33 additions & 43 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@file:OptIn(ExperimentalWasmDsl::class)

import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.net.URI

plugins {
alias(libs.plugins.kotlin.multiplatform)
Expand All @@ -24,12 +27,16 @@ kotlin {
// We set up custom targets rather than use Arrow Gradle Config for Kotlin,
// Since we don't support all targets but only subset where having this behavior makes sense.
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
}
}
js(IR) {
js {
nodejs()
}
wasmJs {
nodejs()
d8()
}

linuxArm64()
Expand All @@ -39,56 +46,39 @@ kotlin {
macosX64()

sourceSets {
val commonMain by getting {
applyDefaultHierarchyTemplate()

commonMain {
dependencies {
api(libs.coroutines)
}
}

val jvmMain by getting
val jsMain by getting
val mingwX64Main by getting
val linuxX64Main by getting
val macosArm64Main by getting
val macosX64Main by getting
val linuxArm64Main by getting

create("nativeMain") {
dependsOn(commonMain)
linuxX64Main.dependsOn(this)
macosArm64Main.dependsOn(this)
macosX64Main.dependsOn(this)
mingwX64Main.dependsOn(this)
linuxArm64Main.dependsOn(this)
}
}
}

tasks {
withType<DokkaTask>().configureEach {
dokka {
dokkaPublications.html {
outputDirectory.set(rootDir.resolve("docs"))
moduleName.set("suspendapp")
dokkaSourceSets {
named("commonMain") {
includes.from("README.md")
perPackageOption {
matchingRegex.set(".*\\.unsafe.*")
suppress.set(true)
}
externalDocumentationLink("https://kotlinlang.org/api/kotlinx.coroutines/")
sourceLink {
localDirectory.set(file("src/commonMain/kotlin"))
remoteUrl.set(uri("https://github.com/arrow-kt/suspendapp/tree/main/src/commonMain/kotlin").toURL())
remoteLineSuffix.set("#L")
}
}
moduleName.set("suspendapp")
dokkaSourceSets {
named("commonMain") {
includes.from("README.md")
perPackageOption {
matchingRegex.set(".*\\.unsafe.*")
suppress.set(true)
}
// externalDocumentationLink("https://kotlinlang.org/api/kotlinx.coroutines/")
sourceLink {
localDirectory.set(file("src/commonMain/kotlin"))
remoteUrl.set(URI("https://github.com/arrow-kt/suspendapp/tree/main/src/commonMain/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
}

withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}

tasks {
register<Delete>("cleanDocs") {
val folder = file("docs").also { it.mkdir() }
val docsContent = folder.listFiles().filter { it != folder }
Expand Down
2 changes: 1 addition & 1 deletion docs/images/anchor-copy-button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/images/arrow_down.svg

This file was deleted.

2 changes: 1 addition & 1 deletion docs/images/copy-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/copy-successful-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/footer-go-to-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/go-to-top-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion docs/images/logo-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions docs/images/theme-toggle.svg

This file was deleted.

187 changes: 132 additions & 55 deletions docs/index.html

Large diffs are not rendered by default.

43 changes: 33 additions & 10 deletions docs/navigation.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
<div class="sideMenuPart" id="suspendapp-nav-submenu" pageId="suspendapp::////PointingToDeclaration//703050856">
<div class="overview"><span class="navButton" onclick="document.getElementById(&quot;suspendapp-nav-submenu&quot;).classList.toggle(&quot;hidden&quot;);"><span class="navButtonContent"></span></span><a href="index.html"><span><span>suspendapp</span></span></a></div>
<div class="sideMenuPart" id="suspendapp-nav-submenu-0" pageId="suspendapp::arrow.continuations////PointingToDeclaration//788909594">
<div class="overview"><span class="navButton" onclick="document.getElementById(&quot;suspendapp-nav-submenu-0&quot;).classList.toggle(&quot;hidden&quot;);"><span class="navButtonContent"></span></span><a href="suspendapp/arrow.continuations/index.html"><span>arrow.</span><wbr></wbr><span><span>continuations</span></span></a></div>
<div class="sideMenuPart" id="suspendapp-nav-submenu-0-0" pageId="suspendapp::arrow.continuations//SuspendApp/#kotlin.coroutines.CoroutineContext#kotlin.time.Duration#kotlin.coroutines.SuspendFunction1[kotlinx.coroutines.CoroutineScope,kotlin.Unit]/PointingToDeclaration//788909594">
<div class="overview"><a href="suspendapp/arrow.continuations/-suspend-app.html"><span class="nav-link-grid"><span class="nav-link-child nav-icon function"></span><span class="nav-link-child"><span>Suspend</span><wbr></wbr><span><span>App()</span></span></span></span></a></div>
<div class="toc--part" id="suspendapp-nav-submenu" pageId="suspendapp::////PointingToDeclaration//210890768" data-nesting-level="0">
<div class="toc--row"><button class="toc--button" onclick="document.getElementById(&quot;suspendapp-nav-submenu&quot;).classList.toggle(&quot;toc--part_hidden&quot;);"></button><a href="index.html" class="toc--link"><span><span>suspendapp</span></span></a></div>
<div class="toc--part" id="suspendapp-nav-submenu-0" pageId="suspendapp::arrow.continuations////PointingToDeclaration//210890768" data-nesting-level="1">
<div class="toc--row"><button class="toc--button" onclick="document.getElementById(&quot;suspendapp-nav-submenu-0&quot;).classList.toggle(&quot;toc--part_hidden&quot;);"></button><a href="suspendapp/arrow.continuations/index.html" class="toc--link"><span>arrow.</span><wbr></wbr><span><span>continuations</span></span></a></div>
<div class="toc--part" id="suspendapp-nav-submenu-0-0" pageId="suspendapp::arrow.continuations/JsProcess///PointingToDeclaration//-649084563" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/[js]-js-process/index.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon object"></span><span><span>[js]Js</span><wbr></wbr><span><span>Process</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-1" pageId="suspendapp::arrow.continuations/JsProcess///PointingToDeclaration//1382690738" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/[wasm-js]-js-process/index.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon object"></span><span><span>[wasm</span><wbr></wbr><span>Js]Js</span><wbr></wbr><span><span>Process</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-2" pageId="suspendapp::arrow.continuations//jsExit/#kotlin.Int/PointingToDeclaration//1382690738" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/js-exit.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon function"></span><span><span>js</span><wbr></wbr><span><span>Exit()</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-3" pageId="suspendapp::arrow.continuations/JvmProcess///PointingToDeclaration//2112555339" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/-jvm-process/index.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon object"></span><span><span>Jvm</span><wbr></wbr><span><span>Process</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-4" pageId="suspendapp::arrow.continuations/Process///PointingToDeclaration//1558683979" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/-process/index.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon interface-kt"></span><span><span><span>Process</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-5" pageId="suspendapp::arrow.continuations//process/#/PointingToDeclaration//210890768" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/process.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon function"></span><span><span><span>process()</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-6" pageId="suspendapp::arrow.continuations//processOn/#kotlin.Function0[kotlin.js.Promise[kotlin.js.JsAny?]]/PointingToDeclaration//1382690738" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/process-on.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon function"></span><span><span>process</span><wbr></wbr><span><span>On()</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-7" pageId="suspendapp::arrow.continuations//SIGINFO/#/PointingToDeclaration//-1186620981" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/-s-i-g-i-n-f-o.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon val"></span><span><span><span>SIGINFO</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-8" pageId="suspendapp::arrow.continuations//SIGUSR1/#/PointingToDeclaration//-1186620981" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/-s-i-g-u-s-r1.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon val"></span><span><span><span>SIGUSR1</span></span></span></span></a></div>
</div>
<div class="toc--part" id="suspendapp-nav-submenu-0-9" pageId="suspendapp::arrow.continuations//SuspendApp/#kotlin.coroutines.CoroutineContext#kotlin.Function1[kotlin.Throwable,kotlin.Unit]#kotlin.time.Duration#arrow.continuations.Process#kotlin.coroutines.SuspendFunction1[kotlinx.coroutines.CoroutineScope,kotlin.Unit]/PointingToDeclaration//1558683979" data-nesting-level="2">
<div class="toc--row"><a href="suspendapp/arrow.continuations/-suspend-app.html" class="toc--link"><span class="toc--link-grid"><span class="toc--icon function"></span><span><span>Suspend</span><wbr></wbr><span><span>App()</span></span></span></span></a></div>
</div>
</div>
<div class="sideMenuPart" id="suspendapp-nav-submenu-1" pageId="suspendapp::arrow.continuations.unsafe////PointingToDeclaration//337714522">
<div class="overview"><a href="suspendapp/arrow.continuations.unsafe.html"><span>arrow.</span><wbr></wbr><span>continuations.</span><wbr></wbr><span>unsafe</span></a></div>
</div>
</div>

4 changes: 4 additions & 0 deletions docs/scripts/clipboard.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

window.addEventListener('load', () => {
document.querySelectorAll('span.copy-icon').forEach(element => {
element.addEventListener('click', (el) => copyElementsContentToClipboard(element));
Expand Down
31 changes: 20 additions & 11 deletions docs/scripts/main.js

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions docs/scripts/navigation-loader.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

navigationPageText = fetch(pathToRoot + "navigation.html").then(response => response.text())

displayNavigationFromPage = () => {
navigationPageText.then(data => {
document.getElementById("sideMenu").innerHTML = data;
}).then(() => {
document.querySelectorAll(".overview > a").forEach(link => {
document.querySelectorAll(".toc--row > a").forEach(link => {
link.setAttribute("href", pathToRoot + link.getAttribute("href"));
})
}).then(() => {
document.querySelectorAll(".sideMenuPart").forEach(nav => {
if (!nav.classList.contains("hidden"))
nav.classList.add("hidden")
document.querySelectorAll(".toc--part").forEach(nav => {
if (!nav.classList.contains("toc--part_hidden"))
nav.classList.add("toc--part_hidden")
})
}).then(() => {
revealNavigationForCurrentPage()
Expand All @@ -29,14 +33,14 @@ displayNavigationFromPage = () => {

revealNavigationForCurrentPage = () => {
let pageId = document.getElementById("content").attributes["pageIds"].value.toString();
let parts = document.querySelectorAll(".sideMenuPart");
let parts = document.querySelectorAll(".toc--part");
let found = 0;
do {
parts.forEach(part => {
if (part.attributes['pageId'].value.indexOf(pageId) !== -1 && found === 0) {
found = 1;
if (part.classList.contains("hidden")) {
part.classList.remove("hidden");
if (part.classList.contains("toc--part_hidden")) {
part.classList.remove("toc--part_hidden");
part.setAttribute('data-active', "");
}
revealParents(part)
Expand All @@ -46,25 +50,25 @@ revealNavigationForCurrentPage = () => {
} while (pageId.indexOf("/") !== -1 && found === 0)
};
revealParents = (part) => {
if (part.classList.contains("sideMenuPart")) {
if (part.classList.contains("hidden"))
part.classList.remove("hidden");
if (part.classList.contains("toc--part")) {
if (part.classList.contains("toc--part_hidden"))
part.classList.remove("toc--part_hidden");
revealParents(part.parentNode)
}
};

scrollNavigationToSelectedElement = () => {
let selectedElement = document.querySelector('div.sideMenuPart[data-active]')
let selectedElement = document.querySelector('div.toc--part[data-active]')
if (selectedElement == null) { // nothing selected, probably just the main page opened
return
}

let hasIcon = selectedElement.querySelectorAll(":scope > div.overview span.nav-icon").length > 0
let hasIcon = selectedElement.querySelectorAll(":scope > div.toc--row span.toc--icon").length > 0

// for instance enums also have children and are expandable, but are not package/module elements
// for an instance enums also have children and are expandable but are not package/module elements
let isPackageElement = selectedElement.children.length > 1 && !hasIcon
if (isPackageElement) {
// if package is selected or linked, it makes sense to align it to top
// if a package is selected or linked, it makes sense to align it to top
// so that you can see all the members it contains
selectedElement.scrollIntoView(true)
} else {
Expand All @@ -80,9 +84,9 @@ scrollNavigationToSelectedElement = () => {

/*
This is a work-around for safari being IE of our times.
It doesn't fire a DOMContentLoaded, presumabely because eventListener is added after it wants to do it
It doesn't fire a DOMContentLoaded, presumably because eventListener is added after it wants to do it
*/
if (document.readyState == 'loading') {
if (document.readyState === 'loading') {
window.addEventListener('DOMContentLoaded', () => {
displayNavigationFromPage()
})
Expand Down
Loading

0 comments on commit 207bad1

Please sign in to comment.