Skip to content

Add module-info for jvm artifact #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion json-schema-validator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType

plugins {
Expand All @@ -18,15 +20,25 @@ plugins {
convention.publication
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

kotlin {
explicitApi()

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-opt-in=io.github.optimumcode.json.schema.ExperimentalApi")
}
jvmToolchain(11)
jvm {
withJava()
compilerOptions {
jvmTarget = JvmTarget.JVM_11
freeCompilerArgs.add("-Xjdk-release=11")
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
Expand Down Expand Up @@ -168,4 +180,24 @@ afterEvaluate {
tasks.named("check").configure {
dependsOn(detektAllTask)
}
}

tasks {
named<JavaCompile>("compileJava") {
options.compilerArgumentProviders +=
object : CommandLineArgumentProvider {
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
val kotlinClasses =
[email protected]<KotlinCompile>(
"compileKotlinJvm",
).flatMap(KotlinCompile::destinationDirectory)

override fun asArguments() =
listOf(
"--patch-module",
"io.github.optimumcode.json.schema=${kotlinClasses.get().asFile.absolutePath}",
)
}
}
}
9 changes: 9 additions & 0 deletions json-schema-validator/src/jvmMain/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module io.github.optimumcode.json.schema {
requires kotlin.stdlib;
requires transitive kotlinx.serialization.json;

exports io.github.optimumcode.json.schema;
exports io.github.optimumcode.json.schema.model;
exports io.github.optimumcode.json.schema.extension;
exports io.github.optimumcode.json.pointer;
}
Loading