-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
156 lines (136 loc) · 5.06 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import org.gradle.internal.os.OperatingSystem
plugins {
java
`java-library`
id("com.github.johnrengelman.shadow") version "7.1.2"
id("me.kingtux.versionfile") version "1.0.0"
`maven-publish`
signing
}
val lwjglVersion = "3.2.3"
val jomlVersion = "1.9.25"
// LWJGL Native Versions
var lwjglNatives = when (OperatingSystem.current()) {
OperatingSystem.LINUX -> System.getProperty("os.arch").let {
if (it.startsWith("arm") || it.startsWith("aarch64")) "natives-linux-${if (it.contains("64") || it.startsWith("armv8")) "arm64" else "arm32"}"
else "natives-linux"
}
OperatingSystem.WINDOWS -> if (System.getProperty("os.arch")
.contains("64")
) "natives-windows" else "natives-windows-x86"
OperatingSystem.MAC_OS -> "natives-macos"
else -> throw Error("Unrecognized or unsupported Operating system. Please set \"lwjglNatives\" manually")
}
if (hasProperty("native")) {
lwjglNatives = properties.get("native").toString()
}
group = "org.kakara"
val artifactName = "engine"
var build = "0"
var branch = ""
if (hasProperty("branch")) {
branch = properties.get("branch").toString()
}
if (hasProperty("buildNumber")) {
version = org.kakara.engine.Version.getEngineVersion(properties.get("buildNumber").toString(), branch);
} else {
version = org.kakara.engine.Version.getEngineVersion("", branch);
}
java {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
maven("https://repo.ryandw11.com/repository/maven-releases")
jcenter()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
artifactId = artifactName
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(artifactName)
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://repo.kingtux.dev/repositories/maven/kakara")
val snapshotsRepoUrl = uri("https://repo.kingtux.dev/repositories/maven/kakara")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials(PasswordCredentials::class)
}
mavenLocal()
}
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
if (project.hasProperty("is-build")) {
//Used by Jenkins
archiveFileName.set("${project.name}-${project.version}-${project.property("native")}.jar")
}
archiveClassifier.set("");
dependsOn(project.tasks.getByName("vftask"));
}
"jar" {
dependsOn(project.tasks.getByName("vftask"));
}
}
versionFileConfig {
isCompileIntoJar = true;
jarDirectory = "engine"
}
dependencies {
// Regular Depends
implementation(group = "me.ryandw11", name = "Octree", version = "1.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-io:commons-io:2.11.0")
implementation("org.jetbrains:annotations:23.0.0")
implementation("com.github.nifty-gui:nifty:1.4.3")
implementation("org.l33tlabs.twl:pngdecoder:1.0")
implementation("io.imgui.java:binding:1.77-0.17.2")
implementation("io.imgui.java:lwjgl3:1.77-0.17.2")
implementation("org.slf4j:slf4j-api:1.8.0-beta4")
testRuntimeOnly("org.slf4j:slf4j-simple:1.8.0-beta4")
implementation("org.joml", "joml", jomlVersion)
//LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-assimp")
implementation("org.lwjgl", "lwjgl-glfw")
implementation("org.lwjgl", "lwjgl-nanovg")
implementation("org.lwjgl", "lwjgl-openal")
implementation("org.lwjgl", "lwjgl-opengl")
implementation("org.lwjgl", "lwjgl-par")
implementation("org.lwjgl", "lwjgl-stb")
if (!lwjglNatives.equals("build", true)) {
runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-assimp", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-nanovg", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-openal", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-par", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
implementation("io.imgui.java:$lwjglNatives:1.77-0.17.2")
}
}