1- import org.gradle.api.attributes.LibraryElements.*
1+ import org.gradle.api.attributes.LibraryElements.JAR
2+ import org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE
23import org.jetbrains.dokka.gradle.DokkaTask
4+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5+ import java.net.URL
36
47plugins {
58 java
6- `java- library`
7- kotlin(" jvm" ) version " 1.3.72"
8- maven
9+ kotlin(" jvm" ) version " 1.4.0"
10+ `maven- publish`
911 // id "org.jetbrains.kotlin.kapt" version "1.3.10"
10- id(" org.jetbrains.dokka" ) version " 0.10.1 "
11- id(" com.github.johnrengelman.shadow" ) version " 5.2 .0"
12+ id(" org.jetbrains.dokka" ) version " 1.4.0 "
13+ id(" com.github.johnrengelman.shadow" ) version " 6.0 .0"
1214}
1315
1416allprojects {
1517 apply (plugin = " java" )
16- apply (plugin = " java-library" )
1718 apply (plugin = " org.jetbrains.kotlin.jvm" )
18- apply (plugin = " maven" )
19+ apply (plugin = " maven-publish " )
1920 apply (plugin = " org.jetbrains.dokka" )
2021 apply (plugin = " com.github.johnrengelman.shadow" )
2122
2223// version = "0.9-beta"
2324 group = " com.github.kotlin_graphics"
2425
25- java {
26- modularity.inferModulePath.set(true )
27- }
26+ java { modularity.inferModulePath.set(true ) }
2827
2928 dependencies {
3029
@@ -35,55 +34,78 @@ allprojects {
3534 components { withModule<ModularKotlinRule >(kotlin(" stdlib" )) }
3635 components { withModule<ModularKotlinRule >(kotlin(" stdlib-jdk8" )) }
3736
38- listOf (" runner-junit5" , " assertions-core" , " runner-console" /* , "property"*/ ).forEach {
39- testImplementation(" io.kotest:kotest-$it -jvm:${findProperty(" kotestVersion" )} " )
40- }
37+ implementation(platform(" org.lwjgl:lwjgl-bom:${findProperty(" lwjglVersion" )} " ))
38+
39+ testImplementation(" io.kotest:kotest-runner-junit5-jvm:${findProperty(" kotestVersion" )} " )
40+ testImplementation(" io.kotest:kotest-assertions-core-jvm:${findProperty(" kotestVersion" )} " )
4141 }
4242
4343 repositories {
4444 mavenCentral()
4545 jcenter()
46- maven { url = uri (" https://jitpack.io" ) }
46+ maven(" https://jitpack.io" )
4747 }
4848
4949 tasks {
50- val dokka by getting(DokkaTask ::class ) {
51- outputFormat = " html"
52- outputDirectory = " $buildDir /dokka"
50+
51+ dokkaHtml {
52+ dokkaSourceSets.configureEach {
53+ sourceLink {
54+ localDirectory.set(file(" src/main/kotlin" ))
55+ remoteUrl.set(URL (" https://github.com/kotlin-graphics/gli/tree/master/src/main/kotlin" ))
56+ remoteLineSuffix.set(" #L" )
57+ }
58+ }
5359 }
5460
55- compileKotlin {
61+ withType< KotlinCompile >().all {
5662 kotlinOptions {
5763 jvmTarget = " 11"
58- freeCompilerArgs = listOf (" -XXLanguage:+InlineClasses " , " -Xjvm-default=enable " )
64+ freeCompilerArgs + = listOf (" -Xinline-classes " , " -Xopt-in=kotlin.RequiresOptIn " )
5965 }
6066 sourceCompatibility = " 11"
6167 }
6268
63- compileTestKotlin {
64- kotlinOptions.jvmTarget = " 11"
65- sourceCompatibility = " 11"
66- }
67-
6869 withType<Test > { useJUnitPlatform() }
6970 }
7071
71- val dokkaJar by tasks.creating( Jar :: class ) {
72- group = JavaBasePlugin . DOCUMENTATION_GROUP
73- description = " Assembles Kotlin docs with Dokka "
72+ val dokkaJavadocJar by tasks.register< Jar >( " dokkaJavadocJar " ) {
73+ dependsOn(tasks.dokkaJavadoc)
74+ from(tasks.dokkaJavadoc.get().outputDirectory.get())
7475 archiveClassifier.set(" javadoc" )
75- from(tasks.dokka)
76+ }
77+
78+ val dokkaHtmlJar by tasks.register<Jar >(" dokkaHtmlJar" ) {
79+ dependsOn(tasks.dokkaHtml)
80+ from(tasks.dokkaHtml.get().outputDirectory.get())
81+ archiveClassifier.set(" html-doc" )
7682 }
7783
7884 val sourceJar = task(" sourceJar" , Jar ::class ) {
79- dependsOn(tasks[ " classes" ] )
85+ dependsOn(tasks. classes)
8086 archiveClassifier.set(" sources" )
8187 from(sourceSets.main.get().allSource)
8288 }
8389
8490 artifacts {
91+ archives(dokkaJavadocJar)
92+ archives(dokkaHtmlJar)
8593 archives(sourceJar)
86- archives(dokkaJar)
94+ }
95+
96+ publishing {
97+ publications.create<MavenPublication >(" mavenJava" ) {
98+ from(components[" java" ])
99+ artifact(sourceJar)
100+ }
101+ repositories.maven {
102+ name = " GitHubPackages"
103+ url = uri(" https://maven.pkg.github.com/kotlin-graphics/uno-sdk" )
104+ credentials {
105+ username = System .getenv(" GITHUB_ACTOR" )
106+ password = System .getenv(" GITHUB_TOKEN" )
107+ }
108+ }
87109 }
88110
89111 // == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
0 commit comments