Skip to content

Commit 185ba37

Browse files
committed
v0.8.3.0 build 15
1 parent aadbe89 commit 185ba37

File tree

6 files changed

+157
-135
lines changed

6 files changed

+157
-135
lines changed

build.gradle

Lines changed: 0 additions & 132 deletions
This file was deleted.

build.gradle.kts

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
import org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE
2+
import org.gradle.api.attributes.java.TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE
3+
import org.gradle.internal.os.OperatingSystem.*
4+
import org.jetbrains.dokka.gradle.DokkaTask
5+
6+
plugins {
7+
java
8+
kotlin("jvm") version "1.3.72"
9+
maven
10+
id("org.jetbrains.dokka") version "0.10.1"
11+
id("com.github.johnrengelman.shadow").version("5.2.0")
12+
}
13+
14+
val group = "com.github.kotlin_graphics"
15+
val moduleName = "$group.gli"
16+
val kotestVersion = "4.0.5"
17+
18+
19+
val kx = "com.github.kotlin-graphics"
20+
val unsignedVersion = "0af6fae4"
21+
val koolVersion = "3962a0be"
22+
val glmVersion = "5b0f3461"
23+
val lwjglVersion = "3.2.3"
24+
val lwjglNatives = when (current()) {
25+
WINDOWS -> "windows"
26+
LINUX -> "linux"
27+
else -> "macos"
28+
}
29+
30+
repositories {
31+
mavenCentral()
32+
jcenter()
33+
maven { url = uri("https://jitpack.io") }
34+
}
35+
36+
dependencies {
37+
implementation(kotlin("stdlib"))
38+
implementation(kotlin("stdlib-jdk8"))
39+
40+
implementation("$kx:kotlin-unsigned:$unsignedVersion")
41+
implementation("$kx:kool:$koolVersion")
42+
implementation("$kx:glm:$glmVersion")
43+
44+
// https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-core
45+
listOf("", /*"-batik",*/ "-bmp", "-core", "-icns", "-iff", "-jpeg", "-metadata", "-pcx", "-pdf", "-pict", "-pnm",
46+
"-psd", "-sgi", "-tga", "-thumbsdb", "-tiff"/*, "-reference", "-clippath", "-hdr"*/).forEach {
47+
implementation("com.twelvemonkeys.imageio:imageio$it:3.5")
48+
}
49+
// https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-transcoder
50+
//implementation "org.apache.xmlgraphics:batik-transcoder:1.12"
51+
52+
listOf("", "-jemalloc", "-opengl").forEach {
53+
implementation("org.lwjgl:lwjgl$it:$lwjglVersion")
54+
implementation("org.lwjgl:lwjgl$it:$lwjglVersion:natives-$lwjglNatives")
55+
}
56+
57+
attributesSchema.attribute(LIBRARY_ELEMENTS_ATTRIBUTE).compatibilityRules.add(ModularJarCompatibilityRule::class)
58+
components { withModule<ModularKotlinRule>(kotlin("stdlib")) }
59+
components { withModule<ModularKotlinRule>(kotlin("stdlib-jdk8")) }
60+
61+
listOf("runner-junit5", "assertions-core", "runner-console"/*, "property"*/).forEach {
62+
testImplementation("io.kotest:kotest-$it-jvm:$kotestVersion")
63+
}
64+
}
65+
66+
java {
67+
modularity.inferModulePath.set(true)
68+
}
69+
70+
tasks {
71+
val dokka by getting(DokkaTask::class) {
72+
outputFormat = "html"
73+
outputDirectory = "$buildDir/dokka"
74+
}
75+
76+
compileKotlin {
77+
kotlinOptions {
78+
jvmTarget = "11"
79+
freeCompilerArgs = listOf("-XXLanguage:+InlineClasses")
80+
}
81+
sourceCompatibility = "11"
82+
}
83+
84+
compileTestKotlin {
85+
kotlinOptions.jvmTarget = "11"
86+
sourceCompatibility = "11"
87+
}
88+
89+
compileJava {
90+
// this is needed because we have a separate compile step in this example with the 'module-info.java' is in 'main/java' and the Kotlin code is in 'main/kotlin'
91+
options.compilerArgs = listOf("--patch-module", "$moduleName=${sourceSets.main.get().output.asPath}")
92+
}
93+
94+
withType<Test> { useJUnitPlatform() }
95+
}
96+
97+
val dokkaJar by tasks.creating(Jar::class) {
98+
group = JavaBasePlugin.DOCUMENTATION_GROUP
99+
description = "Assembles Kotlin docs with Dokka"
100+
archiveClassifier.set("javadoc")
101+
from(tasks.dokka)
102+
}
103+
104+
val sourceJar = task("sourceJar", Jar::class) {
105+
dependsOn(tasks["classes"])
106+
archiveClassifier.set("sources")
107+
from(sourceSets.main.get().allSource)
108+
}
109+
110+
artifacts {
111+
archives(sourceJar)
112+
archives(dokkaJar)
113+
}
114+
115+
// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
116+
configurations.all {
117+
attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE, 11)
118+
val n = name.toLowerCase()
119+
if (n.endsWith("compileclasspath") || n.endsWith("runtimeclasspath"))
120+
attributes.attribute(LIBRARY_ELEMENTS_ATTRIBUTE, objects.named("modular-jar"))
121+
if (n.endsWith("compile") || n.endsWith("runtime"))
122+
isCanBeConsumed = false
123+
}
124+
125+
abstract class ModularJarCompatibilityRule : AttributeCompatibilityRule<LibraryElements> {
126+
override fun execute(details: CompatibilityCheckDetails<LibraryElements>): Unit = details.run {
127+
if (producerValue?.name == LibraryElements.JAR && consumerValue?.name == "modular-jar")
128+
compatible()
129+
}
130+
}
131+
132+
abstract class ModularKotlinRule : ComponentMetadataRule {
133+
134+
@javax.inject.Inject
135+
abstract fun getObjects(): ObjectFactory
136+
137+
override fun execute(ctx: ComponentMetadataContext) {
138+
val id = ctx.details.id
139+
listOf("compile", "runtime").forEach { baseVariant ->
140+
ctx.details.addVariant("${baseVariant}Modular", baseVariant) {
141+
attributes {
142+
attribute(LIBRARY_ELEMENTS_ATTRIBUTE, getObjects().named("modular-jar"))
143+
}
144+
withFiles {
145+
removeAllFiles()
146+
addFile("${id.name}-${id.version}-modular.jar")
147+
}
148+
withDependencies {
149+
clear() // 'kotlin-stdlib-common' and 'annotations' are not modules and are also not needed
150+
}
151+
}
152+
}
153+
}
154+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

settings.gradle

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

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "gli"

src/main/kotlin/gli_/gli.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ const val GLI_VERSION_MAJOR = 0
6565
const val GLI_VERSION_MINOR = 8
6666
const val GLI_VERSION_PATCH = 3
6767
const val GLI_VERSION_REVISION = 0
68-
const val GLI_VERSION_BUILD = 14
68+
const val GLI_VERSION_BUILD = 15
6969
const val GLI_VERSION = GLI_VERSION_MAJOR * 1_000 + GLI_VERSION_MINOR * 100 + GLI_VERSION_PATCH * 10 + GLI_VERSION_REVISION + GLI_VERSION_BUILD / 10f

0 commit comments

Comments
 (0)