Skip to content

Commit

Permalink
Merge pull request #6 from nulls/feature/mpp
Browse files Browse the repository at this point in the history
Support native targets
  • Loading branch information
chao2zhang committed Nov 21, 2022
2 parents 9f63f0b + a36a8d3 commit bd2ed67
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- main
jobs:
publish:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3

Expand Down
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
- `gradle.properties` to the next SNAPSHOT version (X.Y.Z)
- `git commit -am "Prepare next development version."`
- `git push && git push --tags`
- Wait for the [publish-release.yml](.github/workflows/publish-release.yml) action to complete.
- Wait for the [publish-snapshot.yml](.github/workflows/publish-snapshot.yml) action to complete.
73 changes: 37 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
`maven-publish`
signing
kotlin("jvm") version "1.7.21"
kotlin("multiplatform") version "1.7.21"
kotlin("plugin.serialization") version "1.7.21"
id("org.jetbrains.dokka") version "1.7.20"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("org.owasp.dependencycheck") version "7.3.2"
}
Expand All @@ -17,41 +15,47 @@ repositories {
mavenCentral()
}

dependencies {
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
testImplementation(kotlin("stdlib"))
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

tasks {
withType<KotlinCompile>().configureEach {
this.kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-opt-in=kotlinx.serialization.ExperimentalSerializationApi")
kotlin {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
}
linuxX64()
mingwX64()
macosX64()

withType<Javadoc>().configureEach {
val customArgs = projectDir.resolve("javadoc-silence.txt")
customArgs.writeText(
"""-Xdoclint:none
""".trimIndent()
)
options.optionFiles?.add(customArgs)
sourceSets {
all {
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("test"))
implementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
}
}
}
}

tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}
create<Jar>("dokkaJar") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
from(dokkaHtml)
}
}

dependencyCheck {
Expand All @@ -60,11 +64,8 @@ dependencyCheck {

publishing {
publications {
register<MavenPublication>(rootProject.name) {
groupId = project.group as? String
artifactId = project.name
version = project.version as? String
from(components["java"])
withType<MavenPublication> {
artifact(tasks.findByName("dokkaJar"))
pom {
description.set("SARIF data models for Kotlinx serialization")
name.set(rootProject.name)
Expand Down
17 changes: 15 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
GROUP=io.github.detekt.sarif4k
VERSION=0.3.0-SNAPSHOT

# OOM in Dokka: https://github.com/Kotlin/dokka/issues/1405
org.gradle.jvmargs=-XX:MaxMetaspaceSize=256m

kotlin.code.style=official

GROUP=io.github.detekt.sarif4k
VERSION=0.3.0-SNAPSHOT
# Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html.
kotlin.mpp.stability.nowarn=true

# Kotlin Native architecture warning suppression.
# Affects Linux and Windows users / GitHub Actions, but they cannot do anything about it.
# > Some Kotlin/Native targets cannot be built on this mingw_x64 machine and are disabled:
# > * In project ':':
# > * target 'macosX64' (can be built with one of the hosts: macos_x64, macos_arm64)
kotlin.native.ignoreDisabledTargets=true
1 change: 0 additions & 1 deletion javadoc-silence.txt

This file was deleted.

File renamed without changes.

0 comments on commit bd2ed67

Please sign in to comment.