Skip to content

Commit

Permalink
Enabled Dokka (#18)
Browse files Browse the repository at this point in the history
* Only use com.goncalossilva:resources as a plugin

* Use canaray version of nodeJs

* Commented, because it failed for Kim

* Enabled Dokka

* Removed unused import

* Disabled wasmJs tests
  • Loading branch information
StefanOltmann authored Dec 18, 2023
1 parent 5c4f747 commit bf2e234
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 10 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy to GitHub Pages

on:
push:
branches: [ "main" ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Set up Java JDK 18
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '18.0.2+9'
- name: Gradle Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/native
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle.kts') }}
- name: Build & Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x ./gradlew
./gradlew dokkaHtml
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'build/dokka/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
35 changes: 31 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugins {
id("me.qoomon.git-versioning") version "6.4.3"
id("com.goncalossilva.resources") version "0.4.0"
id("com.github.ben-manes.versions") version "0.50.0"
id("org.jetbrains.dokka") version "1.9.10"
}

repositories {
Expand Down Expand Up @@ -135,7 +136,11 @@ kotlin {
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs()
wasmJs {
// All tests reading from files fail, because kotlinx-io
// has no Path support for WASM (yet?).
// nodejs()
}

@OptIn(ExperimentalWasmDsl::class)
wasmWasi()
Expand All @@ -158,9 +163,6 @@ kotlin {
/* Kotlin Test */
implementation(kotlin("test"))

/* Multiplatform test resources */
implementation("com.goncalossilva:resources:0.4.0")

/* Multiplatform file access */
implementation("org.jetbrains.kotlinx:kotlinx-io-core:0.3.0")
}
Expand Down Expand Up @@ -229,6 +231,22 @@ kotlin {
macosX64Main.dependsOn(this)
macosArm64Main.dependsOn(this)
}

val iosArm64Test by sourceSets.getting
val iosSimulatorArm64Test by sourceSets.getting
val macosX64Test by sourceSets.getting
val macosArm64Test by sourceSets.getting

@Suppress("UnusedPrivateMember", "UNUSED_VARIABLE") // False positive
val appleTest by sourceSets.creating {

dependsOn(commonTest)

iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
macosX64Test.dependsOn(this)
macosArm64Test.dependsOn(this)
}
}

// region Writing version.txt for GitHub Actions
Expand Down Expand Up @@ -400,3 +418,12 @@ publishing {
}
}
// endregion

//rootProject.the<NodeJsRootExtension>().apply {
// nodeVersion = "21.0.0-v8-canary202309143a48826a08"
// nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
//}
//
//tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
// args.add("--ignore-engines")
//}
13 changes: 13 additions & 0 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


format-util@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271"
integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg==

[email protected]:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ashampoo.xmp

actual fun getPathForResource(path: String): String = path
13 changes: 13 additions & 0 deletions src/appleTest/kotlin/com/ashampoo/xmp/ResourcePath.apple.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.ashampoo.xmp

import platform.Foundation.NSBundle

actual fun getPathForResource(path: String): String {

val pathForResource = NSBundle.mainBundle.pathForResource(
path.substringBeforeLast("."),
path.substringAfterLast(".")
).toString()

return pathForResource
}
14 changes: 14 additions & 0 deletions src/commonTest/kotlin/com/ashampoo/xmp/PathExtensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ashampoo.xmp

import kotlinx.io.buffered
import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
import kotlinx.io.readByteArray

@OptIn(ExperimentalStdlibApi::class)
internal fun Path.readText(): String =
SystemFileSystem
.source(this)
.buffered()
.use { it.readByteArray() }
.decodeToString()
18 changes: 18 additions & 0 deletions src/commonTest/kotlin/com/ashampoo/xmp/ResourcePath.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2023 Ashampoo GmbH & Co. KG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ashampoo.xmp

expect fun getPathForResource(path: String): String
7 changes: 3 additions & 4 deletions src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ashampoo.xmp

import com.ashampoo.xmp.options.SerializeOptions
import com.goncalossilva.resources.Resource
import kotlinx.io.buffered
import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
Expand Down Expand Up @@ -214,13 +213,13 @@ class RewriteXmpTest {
}

private fun getOriginalXmp(index: Int): String =
Resource("$RESOURCE_PATH/sample_$index.xmp").readText()
Path(getPathForResource("$RESOURCE_PATH/sample_$index.xmp")).readText()

private fun getFormattedCompactXmp(index: Int): String =
Resource("$RESOURCE_PATH/sample_${index}_formatted_compact.xmp").readText()
Path(getPathForResource("$RESOURCE_PATH/sample_${index}_formatted_compact.xmp")).readText()

private fun getFormattedCanonicalXmp(index: Int): String =
Resource("$RESOURCE_PATH/sample_${index}_formatted_canonical.xmp").readText()
Path(getPathForResource("$RESOURCE_PATH/sample_${index}_formatted_canonical.xmp")).readText()

companion object {

Expand Down
3 changes: 1 addition & 2 deletions src/commonTest/kotlin/com/ashampoo/xmp/WriteXmpTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.ashampoo.xmp

import com.ashampoo.xmp.options.PropertyOptions
import com.ashampoo.xmp.options.SerializeOptions
import com.goncalossilva.resources.Resource
import kotlinx.io.buffered
import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
Expand Down Expand Up @@ -184,7 +183,7 @@ class WriteXmpTest {
}

private fun getXmp(name: String): String =
Resource("$RESOURCE_PATH/$name").readText()
Path(getPathForResource("$RESOURCE_PATH/$name")).readText()

companion object {
private const val RESOURCE_PATH: String = "src/commonTest/resources/com/ashampoo/xmp"
Expand Down
3 changes: 3 additions & 0 deletions src/jvmTest/kotlin/com/ashampoo/xmp/ResourcePath.jvm.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ashampoo.xmp

actual fun getPathForResource(path: String): String = path
3 changes: 3 additions & 0 deletions src/wasmJsTest/kotlin/com/ashampoo/xmp/ResourcePath.wasmJs.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ashampoo.xmp

actual fun getPathForResource(path: String): String = path
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ashampoo.xmp

actual fun getPathForResource(path: String): String = path
3 changes: 3 additions & 0 deletions src/winTest/kotlin/com/ashampoo/xmp/ResourcePath.win.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ashampoo.xmp

actual fun getPathForResource(path: String): String = path

0 comments on commit bf2e234

Please sign in to comment.