Skip to content

Commit bd2ed67

Browse files
author
Chao Zhang
authored
Merge pull request #6 from nulls/feature/mpp
Support native targets
2 parents 9f63f0b + a36a8d3 commit bd2ed67

9 files changed

Lines changed: 54 additions & 41 deletions

File tree

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- main
66
jobs:
77
publish:
8-
runs-on: ubuntu-latest
8+
runs-on: macos-latest
99
steps:
1010
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
1111

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
- `gradle.properties` to the next SNAPSHOT version (X.Y.Z)
1616
- `git commit -am "Prepare next development version."`
1717
- `git push && git push --tags`
18-
- Wait for the [publish-release.yml](.github/workflows/publish-release.yml) action to complete.
18+
- Wait for the [publish-snapshot.yml](.github/workflows/publish-snapshot.yml) action to complete.

build.gradle.kts

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
plugins {
4-
`java-library`
52
`maven-publish`
63
signing
7-
kotlin("jvm") version "1.7.21"
4+
kotlin("multiplatform") version "1.7.21"
85
kotlin("plugin.serialization") version "1.7.21"
6+
id("org.jetbrains.dokka") version "1.7.20"
97
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
108
id("org.owasp.dependencycheck") version "7.3.2"
119
}
@@ -17,41 +15,47 @@ repositories {
1715
mavenCentral()
1816
}
1917

20-
dependencies {
21-
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
22-
testImplementation(kotlin("stdlib"))
23-
testImplementation(kotlin("test"))
24-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
25-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
26-
}
27-
28-
java {
29-
sourceCompatibility = JavaVersion.VERSION_1_8
30-
targetCompatibility = JavaVersion.VERSION_1_8
31-
withJavadocJar()
32-
withSourcesJar()
33-
}
34-
35-
tasks {
36-
withType<KotlinCompile>().configureEach {
37-
this.kotlinOptions {
38-
jvmTarget = "1.8"
39-
freeCompilerArgs = listOf("-opt-in=kotlinx.serialization.ExperimentalSerializationApi")
18+
kotlin {
19+
jvm {
20+
compilations.all {
21+
kotlinOptions {
22+
jvmTarget = JavaVersion.VERSION_1_8.toString()
23+
}
4024
}
4125
}
26+
linuxX64()
27+
mingwX64()
28+
macosX64()
4229

43-
withType<Javadoc>().configureEach {
44-
val customArgs = projectDir.resolve("javadoc-silence.txt")
45-
customArgs.writeText(
46-
"""-Xdoclint:none
47-
""".trimIndent()
48-
)
49-
options.optionFiles?.add(customArgs)
30+
sourceSets {
31+
all {
32+
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
33+
}
34+
val commonMain by getting {
35+
dependencies {
36+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
37+
}
38+
}
39+
val jvmTest by getting {
40+
dependencies {
41+
implementation(kotlin("stdlib"))
42+
implementation(kotlin("test"))
43+
implementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
44+
runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
45+
}
46+
}
5047
}
48+
}
5149

50+
tasks {
5251
withType<Test>().configureEach {
5352
useJUnitPlatform()
5453
}
54+
create<Jar>("dokkaJar") {
55+
group = JavaBasePlugin.DOCUMENTATION_GROUP
56+
archiveClassifier.set("javadoc")
57+
from(dokkaHtml)
58+
}
5559
}
5660

5761
dependencyCheck {
@@ -60,11 +64,8 @@ dependencyCheck {
6064

6165
publishing {
6266
publications {
63-
register<MavenPublication>(rootProject.name) {
64-
groupId = project.group as? String
65-
artifactId = project.name
66-
version = project.version as? String
67-
from(components["java"])
67+
withType<MavenPublication> {
68+
artifact(tasks.findByName("dokkaJar"))
6869
pom {
6970
description.set("SARIF data models for Kotlinx serialization")
7071
name.set(rootProject.name)

gradle.properties

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
GROUP=io.github.detekt.sarif4k
2+
VERSION=0.3.0-SNAPSHOT
3+
4+
# OOM in Dokka: https://github.com/Kotlin/dokka/issues/1405
5+
org.gradle.jvmargs=-XX:MaxMetaspaceSize=256m
6+
17
kotlin.code.style=official
28

3-
GROUP=io.github.detekt.sarif4k
4-
VERSION=0.3.0-SNAPSHOT
9+
# Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html.
10+
kotlin.mpp.stability.nowarn=true
11+
12+
# Kotlin Native architecture warning suppression.
13+
# Affects Linux and Windows users / GitHub Actions, but they cannot do anything about it.
14+
# > Some Kotlin/Native targets cannot be built on this mingw_x64 machine and are disabled:
15+
# > * In project ':':
16+
# > * target 'macosX64' (can be built with one of the hosts: macos_x64, macos_arm64)
17+
kotlin.native.ignoreDisabledTargets=true

javadoc-silence.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/kotlin/io/github/detekt/sarif4k/SarifDataBindings.kt renamed to src/commonMain/kotlin/io/github/detekt/sarif4k/SarifDataBindings.kt

File renamed without changes.

src/main/kotlin/io/github/detekt/sarif4k/SarifSerializer.kt renamed to src/commonMain/kotlin/io/github/detekt/sarif4k/SarifSerializer.kt

File renamed without changes.

src/test/kotlin/io/github/detekt/sarif4k/SarifSerializerTest.kt renamed to src/jvmTest/kotlin/io/github/detekt/sarif4k/SarifSerializerTest.kt

File renamed without changes.

0 commit comments

Comments
 (0)