-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.gradle.kts
136 lines (115 loc) · 4.16 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import org.gradle.api.attributes.java.TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE
import org.gradle.internal.os.OperatingSystem.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL
plugins {
java
kotlin("jvm") version "1.4.10"
`maven-publish`
// id "org.jetbrains.kotlin.kapt" version "1.3.10"
id("org.jetbrains.dokka") version "1.4.10"
id("com.github.johnrengelman.shadow") version "6.1.0"
}
// jitpack
group = "com.github.kotlin_graphics"
val moduleName = "$group.assimp"
val kotestVersion = "4.2.5"
val kx = "com.github.kotlin-graphics"
val unsignedVersion = "f2cd9c97"
val koolVersion = "b4ff3661"
val glmVersion = "3466fcde"
val gliVersion = "9c67885f"
val unoVersion = "68d50c59"
val lwjglVersion = "3.2.3"
val lwjglNatives = "natives-" + when (current()) {
WINDOWS -> "windows"
LINUX -> "linux"
else -> "macos"
}
repositories {
mavenCentral()
jcenter()
maven("https://jitpack.io")
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("$kx:kotlin-unsigned:$unsignedVersion")
implementation("$kx:kool:$koolVersion")
implementation("$kx:glm:$glmVersion")
implementation("$kx:gli:$gliVersion")
implementation("$kx:uno-sdk:$unoVersion")
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
listOf("", "-glfw", "-jemalloc", "-openal", "-opengl", "-stb").forEach {
implementation("org.lwjgl", "lwjgl$it")
runtimeOnly("org.lwjgl", "lwjgl$it", classifier = lwjglNatives)
}
// implementation("io.github.microutils:kotlin-logging:1.7.8")
implementation("io.github.microutils:kotlin-logging-jvm:2.0.3")
implementation("org.slf4j:slf4j-api:1.7.29")
testImplementation("org.slf4j:slf4j-simple:1.7.29")
testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
}
//java { modularity.inferModulePath.set(true) }
tasks {
dokkaHtml {
dokkaSourceSets.configureEach {
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/kotlin-graphics/assimp/tree/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
withType<KotlinCompile>().all {
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
}
sourceCompatibility = "11"
}
// compileJava { // 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'
// options.compilerArgs = listOf("--patch-module", "$moduleName=${sourceSets.main.get().output.asPath}")
// }
withType<Test> {
useJUnitPlatform()
maxHeapSize = "1g" // set heap size for the test JVM(s)
}
}
val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.get().outputDirectory.get())
archiveClassifier.set("javadoc")
}
val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.get().outputDirectory.get())
archiveClassifier.set("html-doc")
}
val sourceJar = task("sourceJar", Jar::class) {
dependsOn(tasks.classes)
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
artifacts {
archives(dokkaJavadocJar)
archives(dokkaHtmlJar)
archives(sourceJar)
}
publishing {
publications.create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourceJar)
}
repositories.maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kotlin-graphics/assimp")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
configurations.all { attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE, 11) }