From a44efd4ba0c2e4ab921ff75e0f53fc9335aa79db Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Fri, 10 Nov 2023 00:06:37 +0200 Subject: Add Gradle integration test for `wasm-js` and `wasm-wasi` targets (#3315) * Add Gradle integration test for `wasm-js` and `wasm-wasi` targets * Fix review comments * Update versions of dependencies --- .../src/wasmJsMain/kotlin/RootPackageClass.kt | 30 ++++++++++++ .../src/wasmJsMain/kotlin/it/basic/PublicClass.kt | 53 ++++++++++++++++++++++ .../wasmJsMain/kotlin/it/internal/InternalClass.kt | 7 +++ .../it/suppressedByPackage/SuppressedByPackage.kt | 7 +++ .../kotlin/it/suppressedByPath/SuppressedByPath.kt | 7 +++ .../src/wasmWasiMain/kotlin/RootPackageClass.kt | 10 ++++ .../wasmWasiMain/kotlin/it/basic/PublicClass.kt | 53 ++++++++++++++++++++++ .../kotlin/it/internal/InternalClass.kt | 7 +++ .../it/suppressedByPackage/SuppressedByPackage.kt | 7 +++ .../kotlin/it/suppressedByPath/SuppressedByPath.kt | 7 +++ 10 files changed, 188 insertions(+) create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/RootPackageClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/basic/PublicClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/internal/InternalClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPath/SuppressedByPath.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/RootPackageClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/basic/PublicClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/internal/InternalClass.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt create mode 100644 integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPath/SuppressedByPath.kt (limited to 'integration-tests/gradle/projects/it-wasm-js-wasi-basic/src') diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/RootPackageClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/RootPackageClass.kt new file mode 100644 index 00000000..a2d05dff --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/RootPackageClass.kt @@ -0,0 +1,30 @@ +@file:Suppress("unused") + +import org.w3c.dom.HTMLAnchorElement +import kotlinx.coroutines.CoroutineScope + +/** + * A class that lives inside the root package + */ +class RootPackageClass { + val description = "I do live in the root package!" +} + +fun test(list: MutableList) = "list" + +@JsModule("is-sorted") +@JsNonModule +external fun sorted(a: Array): Boolean + +// this declaration can be used to check deserialization of dynamic type +external interface TextLinkProps: AnchorHTMLAttributes + +// this declaration uses external library and external documentation link +fun CoroutineScope.externalClass() = "some string" + +/** + * Some external function with JsFun + * @see kotlin.JsFun + */ +@kotlin.JsFun("xxx") +external fun externalFun() \ No newline at end of file diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/basic/PublicClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/basic/PublicClass.kt new file mode 100644 index 00000000..fc4b36bd --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/basic/PublicClass.kt @@ -0,0 +1,53 @@ +@file:Suppress("unused") + +package it.basic + +import RootPackageClass + +/** + * This class, unlike [RootPackageClass] is located in a sub-package + */ +class PublicClass { + /** + * This function is public and documented + */ + fun publicDocumentedFunction(): String = "" + + fun publicUndocumentedFunction(): String = "" + + /** + * This function is internal and documented + */ + internal fun internalDocumentedFunction(): String = "" + + internal fun internalUndocumentedFunction(): String = "" + + /** + * This function is private and documented + */ + private fun privateDocumentedFunction(): String = "" + + private fun privateUndocumentedFunction(): String = "" + + + /** + * This property is public and documented + */ + val publicDocumentedProperty: Int = 0 + + val publicUndocumentedProperty: Int = 0 + + /** + * This property internal and documented + */ + val internalDocumentedProperty: Int = 0 + + val internalUndocumentedProperty: Int = 0 + + /** + * This property private and documented + */ + private val privateDocumentedProperty: Int = 0 + + private val privateUndocumentedProperty: Int = 0 +} diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/internal/InternalClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/internal/InternalClass.kt new file mode 100644 index 00000000..7d42b978 --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/internal/InternalClass.kt @@ -0,0 +1,7 @@ +package it.internal + +/** + * §INTERNAL§ + * This class is internal and should not be rendered + */ +internal class InternalClass diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt new file mode 100644 index 00000000..d8dc9cff --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt @@ -0,0 +1,7 @@ +package it.suppressedByPackage + +/** + * §SUPPRESSED§ + * This should not be rendered. + */ +class SuppressedByPackage diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPath/SuppressedByPath.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPath/SuppressedByPath.kt new file mode 100644 index 00000000..4dda9da4 --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmJsMain/kotlin/it/suppressedByPath/SuppressedByPath.kt @@ -0,0 +1,7 @@ +package it.suppressedByPath + +/** + * §SUPPRESSED§ + * This should not be rendered. + */ +class SuppressedByPath diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/RootPackageClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/RootPackageClass.kt new file mode 100644 index 00000000..6735459c --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/RootPackageClass.kt @@ -0,0 +1,10 @@ +@file:Suppress("unused") + +/** + * A class that lives inside the root package + */ +class RootPackageClass { + val description = "I do live in the root package!" +} + +fun test(list: MutableList) = "list" \ No newline at end of file diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/basic/PublicClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/basic/PublicClass.kt new file mode 100644 index 00000000..fc4b36bd --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/basic/PublicClass.kt @@ -0,0 +1,53 @@ +@file:Suppress("unused") + +package it.basic + +import RootPackageClass + +/** + * This class, unlike [RootPackageClass] is located in a sub-package + */ +class PublicClass { + /** + * This function is public and documented + */ + fun publicDocumentedFunction(): String = "" + + fun publicUndocumentedFunction(): String = "" + + /** + * This function is internal and documented + */ + internal fun internalDocumentedFunction(): String = "" + + internal fun internalUndocumentedFunction(): String = "" + + /** + * This function is private and documented + */ + private fun privateDocumentedFunction(): String = "" + + private fun privateUndocumentedFunction(): String = "" + + + /** + * This property is public and documented + */ + val publicDocumentedProperty: Int = 0 + + val publicUndocumentedProperty: Int = 0 + + /** + * This property internal and documented + */ + val internalDocumentedProperty: Int = 0 + + val internalUndocumentedProperty: Int = 0 + + /** + * This property private and documented + */ + private val privateDocumentedProperty: Int = 0 + + private val privateUndocumentedProperty: Int = 0 +} diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/internal/InternalClass.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/internal/InternalClass.kt new file mode 100644 index 00000000..7d42b978 --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/internal/InternalClass.kt @@ -0,0 +1,7 @@ +package it.internal + +/** + * §INTERNAL§ + * This class is internal and should not be rendered + */ +internal class InternalClass diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt new file mode 100644 index 00000000..d8dc9cff --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPackage/SuppressedByPackage.kt @@ -0,0 +1,7 @@ +package it.suppressedByPackage + +/** + * §SUPPRESSED§ + * This should not be rendered. + */ +class SuppressedByPackage diff --git a/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPath/SuppressedByPath.kt b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPath/SuppressedByPath.kt new file mode 100644 index 00000000..4dda9da4 --- /dev/null +++ b/integration-tests/gradle/projects/it-wasm-js-wasi-basic/src/wasmWasiMain/kotlin/it/suppressedByPath/SuppressedByPath.kt @@ -0,0 +1,7 @@ +package it.suppressedByPath + +/** + * §SUPPRESSED§ + * This should not be rendered. + */ +class SuppressedByPath -- cgit