-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
151 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { `kotlin-dsl` } | ||
|
||
repositories { mavenCentral() } |
102 changes: 102 additions & 0 deletions
102
buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2024 Overrun Organization | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
*/ | ||
|
||
enum class NativePlatform( | ||
val osFamilyName: String, | ||
val osArch: String, | ||
classifier: String, | ||
val nativeLibPrefix: String, | ||
val nativeLibSuffix: String, | ||
val taskSuffix: String | ||
) { | ||
WIN_64("windows", "x64", "windows", "", ".dll", "Win64"), | ||
WIN_ARM64("windows", "arm64", "windows-arm64", "", ".dll", "WinArm64"), | ||
LINUX_64("linux", "x64", "linux", "lib", ".so", "Linux64"), | ||
LINUX_ARM32("linux", "arm32", "linux-arm32", "lib", ".so", "LinuxArm32"), | ||
LINUX_ARM64("linux", "arm64", "linux-arm64", "lib", ".so", "LinuxArm64"), | ||
MACOS("macos", "x64", "macos", "lib", ".dylib", "Macos"), | ||
MACOS_ARM64("macos", "arm64", "macos-arm64", "lib", ".dylib", "MacosArm64"); | ||
|
||
companion object { | ||
val ALL = values() | ||
} | ||
|
||
val classifier = "natives-$classifier" | ||
} | ||
|
||
enum class NativeBinding( | ||
val bindingName: String, | ||
val basename: String, | ||
vararg val platforms: NativePlatform | ||
) { | ||
GLFW( | ||
"glfw", "glfw3", | ||
NativePlatform.WIN_64, | ||
NativePlatform.LINUX_64, NativePlatform.LINUX_ARM64, | ||
NativePlatform.MACOS, NativePlatform.MACOS_ARM64 | ||
), | ||
NFD("nfd", "nfd", *NativePlatform.ALL), | ||
STB("stb", "stb", *NativePlatform.ALL) | ||
} | ||
|
||
enum class Artifact( | ||
val artifactName: String, | ||
val projectName: String, | ||
val projectDescription: String, | ||
val subprojectName: String, | ||
val mavenName: String, | ||
val nativeBinding: NativeBinding? = null | ||
) { | ||
CORE( | ||
"overrungl", "OverrunGL", | ||
"The OverrunGL core library.", | ||
":core", "Core" | ||
), | ||
GLFW( | ||
"overrungl-glfw", "OverrunGL - GLFW bindings", | ||
"A multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.", | ||
":glfw", "Glfw", NativeBinding.GLFW | ||
), | ||
JOML( | ||
"overrungl-joml", "OverrunGL - JOML native access", | ||
"A Java math library for OpenGL rendering calculations", | ||
":joml", "Joml" | ||
), | ||
NFD( | ||
"overrungl-nfd", "OverrunGL - Native File Dialog", | ||
"A tiny, neat C library that portably invokes native file open and save dialogs.", | ||
":nfd", "Nfd", NativeBinding.NFD | ||
), | ||
OPENGL( | ||
"overrungl-opengl", "OverrunGL - OpenGL bindings", | ||
"The most widely adopted 2D and 3D graphics API in the industry, bringing thousands of applications to a wide variety of computer platforms.", | ||
":opengl", "Opengl" | ||
), | ||
STB( | ||
"overrungl-stb", "OverrunGL - stb bindings", | ||
"Single-file public domain libraries for fonts, images, ogg vorbis files and more.", | ||
":stb", "Stb", NativeBinding.STB | ||
), | ||
//VULKAN("overrungl-vulkan", "OverrunGL - Vulkan bindings", | ||
// "A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.", | ||
// ":vulkan", "Vulkan", null), | ||
; | ||
|
||
fun nativeFileName(platform: NativePlatform): String? { | ||
return if (nativeBinding == null) null | ||
else "${nativeBinding.bindingName}/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,49 @@ | ||
import java.nio.file.Files | ||
import kotlin.io.path.Path | ||
|
||
val overrunMarshalVersion: String by rootProject | ||
val overrunPlatformVersion: String by rootProject | ||
|
||
val jdkVersion: String by rootProject | ||
val targetJavaVersion = jdkVersion.toInt() | ||
|
||
dependencies { | ||
api("io.github.over-run:marshal:$overrunMarshalVersion") | ||
api("io.github.over-run:platform:$overrunPlatformVersion") | ||
} | ||
|
||
tasks.register("assembleJavadocArgs") { | ||
group = "build" | ||
val mspFile = Path("${rootProject.layout.buildDirectory.get().asFile}/tmp/modulesourcepath.args") | ||
outputs.file(mspFile) | ||
|
||
doLast { | ||
Files.deleteIfExists(mspFile) | ||
|
||
Files.writeString( | ||
mspFile, """ | ||
--module-source-path | ||
${rootProject.projectDir.path}/modules/*/src/main/java | ||
""".trimIndent() | ||
) | ||
} | ||
} | ||
|
||
tasks.register<Javadoc>("aggregateJavadoc") { | ||
javadocTool = javaToolchains.javadocToolFor { | ||
languageVersion = JavaLanguageVersion.of(targetJavaVersion) | ||
} | ||
dependsOn(tasks["assembleJavadocArgs"]) | ||
group = "documentation" | ||
outputs.upToDateWhen { false } | ||
val projectsToDoc = Artifact.values().map { rootProject.project(it.subprojectName) } | ||
dependsOn(projectsToDoc.map { it.getTasksByName("classes", true) }) | ||
source(projectsToDoc.map { it.sourceSets["main"].java }) | ||
setDestinationDir(File("${rootProject.layout.buildDirectory.get().asFile}/docs/javadoc")) | ||
|
||
classpath = files(projectsToDoc.map { it.configurations["compileClasspath"].files }) | ||
|
||
// executable = project.findProperty("javadocExecutable") as String? | ||
|
||
options.optionFiles = listOf(File("${rootProject.layout.buildDirectory.get().asFile}/tmp/modulesourcepath.args")) | ||
} |