1- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31plugins {
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
5761dependencyCheck {
@@ -60,11 +64,8 @@ dependencyCheck {
6064
6165publishing {
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)
0 commit comments