Initial commit

This commit is contained in:
William Bell committed 2025-09-26 00:58:31 +01:00
commit 05c86a77fd
23 files changed
+352

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Kotlin ###
.kotlin
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+32
View File
@@ -0,0 +1,32 @@
<component name="ArtifactManager">
<artifact type="jar" name="Buildtopia.app.main:jar">
<output-path>$PROJECT_DIR$/out/artifacts/Buildtopia_app_main_jar</output-path>
<root id="archive" name="Buildtopia.app.main.jar">
<element id="module-output" name="Buildtopia.app.main" />
<element id="module-output" name="Buildtopia.utils.main" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.3.6/59f708eb4bf0be0204bbc9c06807911724673db6/lwjgl-opengl-3.3.6-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-jvm/1.8.1/4de3bace4b175753df5484d2acd74c14bfeb5be9/kotlinx-serialization-json-jvm-1.8.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.3.6/334cf885b39e2db9070c39e70e65efb136435f10/lwjgl-stb-3.3.6-natives-windows.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.3.6/99ef08056feb9627f90425a4d2a22cd9fae8e39b/lwjgl-glfw-3.3.6-natives-windows.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-core-jvm/1.8.1/510cb839cce9a3e708052d480a6fbf4a7274dfcd/kotlinx-serialization-core-jvm-1.8.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.3.6/7119f7d0eeb1e5502ff0ca71d2b4d47317da015/lwjgl-glfw-3.3.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.3.6/ce7721d30cfaf47feaed10213e0c43eb55c49d68/lwjgl-3.3.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.2.10/30de6faa127a4a012db8e71bf1b9c0a99b1402b2/kotlin-stdlib-2.2.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.joml/joml/1.10.5/22566d58af70ad3d72308bab63b8339906deb649/joml-1.10.5.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/23.0.0/8cc20c07506ec18e0834947b84a864bfc094484e/annotations-23.0.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.3.6/797e0965709ad180d9b00c88a086dbda15002203/lwjgl-glfw-3.3.6-natives-linux.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-datetime-jvm/0.6.2/f177b43ce53f69151797206ce762b36199692474/kotlinx-datetime-jvm-0.6.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.3.6/b8dc6467fe232d552793c53dc56f9fa8a385299c/lwjgl-opengl-3.3.6-natives-linux.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.3.6/82c8d748a654241b5961ddd1c098e8b648e38a48/lwjgl-glfw-3.3.6-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.3.6/d18b8016b1d458327ba987d398d7dd4fd20fb115/lwjgl-stb-3.3.6-natives-macos.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.3.6/78f27d07accd70ca857049ea9fa0dc7d2f3875dc/lwjgl-stb-3.3.6-natives-linux.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.3.6/18dc639ebc94aa5202c2157f7490d28997b697c5/lwjgl-opengl-3.3.6-natives-windows.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.3.6/e2d3739dcfe7b672b626ded66d94f6587083306e/lwjgl-stb-3.3.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.10.2/4a9f78ef49483748e2c129f3d124b8fa249dafbf/kotlinx-coroutines-core-jvm-1.10.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.3.6/9a29b6a22fc5184604b8cb434ee5d5ecc4bfcbee/lwjgl-3.3.6-natives-windows.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.3.6/dc7db8fc4f1e6563867f9155b9a42d9c73d8992f/lwjgl-3.3.6-natives-linux.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.3.6/ac2532612a4df374e9a9282bcf8ce2573018ebbb/lwjgl-opengl-3.3.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.3.6/f14e7a5289d2355822f4f83b3fd38d158c939acd/lwjgl-3.3.6-natives-macos.jar" path-in-jar="/" />
</root>
</artifact>
</component>
+7
View File
@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>blocktopia</w>
</words>
</dictionary>
</component>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
</GradleProjectSettings>
</option>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.2.10" />
</component>
</project>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+23
View File
@@ -0,0 +1,23 @@
# Buildtopia
This project uses [Gradle](https://gradle.org/).
To build and run the application, use the *Gradle* tool window by clicking the Gradle icon in the right-hand toolbar,
or run it directly from the terminal:
* Run `./gradlew run` to build and run the application.
* Run `./gradlew build` to only build the application.
* Run `./gradlew check` to run all checks, including tests.
* Run `./gradlew clean` to clean all build outputs.
Note the usage of the Gradle Wrapper (`./gradlew`).
This is the suggested way to use Gradle in production projects.
[Learn more about the Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html).
[Learn more about Gradle tasks](https://docs.gradle.org/current/userguide/command_line_interface.html#common_tasks).
This project follows the suggested multi-module setup and consists of the `app` and `utils` subprojects.
The shared build logic was extracted to a convention plugin located in `buildSrc`.
This project uses a version catalog (see `gradle/libs.versions.toml`) to declare and version dependencies
and both a build cache and a configuration cache (see `gradle.properties`).
+19
View File
@@ -0,0 +1,19 @@
plugins {
// Apply the shared build logic from a convention plugin.
// The shared code is located in `buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts`.
id("buildsrc.convention.kotlin-jvm")
// Apply the Application plugin to add support for building an executable JVM application.
application
}
dependencies {
// Project "app" depends on project "utils". (Project paths are separated with ":", so ":utils" refers to the top-level "utils" project.)
implementation(project(":utils"))
}
application {
// Define the Fully Qualified Name for the application main class
// (Note that Kotlin compiles `App.kt` to a class with FQN `com.example.app.AppKt`.)
mainClass = "dev.wbell.buildtopia.app.AppKt"
}
+20
View File
@@ -0,0 +1,20 @@
package dev.wbell.buildtopia.app
import dev.wbell.buildtopia.utils.Printer
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
fun main() {
val name = "Kotlin"
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
val message = "Hello, " + name + "!"
val printer = Printer(message)
printer.printMessage()
for (i in 1..5) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
println("i = $i")
}
}
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: dev.wbell.buildtopia.app.AppKt
Whitespace-only changes.
Whitespace-only changes.
+15
View File
@@ -0,0 +1,15 @@
plugins {
// The Kotlin DSL plugin provides a convenient way to develop convention plugins.
// Convention plugins are located in `src/main/kotlin`, with the file extension `.gradle.kts`,
// and are applied in the project's `build.gradle.kts` files as required.
`kotlin-dsl`
}
kotlin {
jvmToolchain(21)
}
dependencies {
// Add a dependency on the Kotlin Gradle plugin, so that convention plugins can apply it.
implementation(libs.kotlinGradlePlugin)
}
+17
View File
@@ -0,0 +1,17 @@
dependencyResolutionManagement {
// Use Maven Central and the Gradle Plugin Portal for resolving dependencies in the shared build logic (`buildSrc`) project.
@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
}
// Reuse the version catalog from the main build.
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
rootProject.name = "buildSrc"
@@ -0,0 +1,29 @@
// The code in this file is a convention plugin - a Gradle mechanism for sharing reusable build logic.
// `buildSrc` is a Gradle-recognized directory and every plugin there will be easily available in the rest of the build.
package buildsrc.convention
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin in JVM projects.
kotlin("jvm")
}
kotlin {
// Use a specific Java version to make it easier to work in different environments.
jvmToolchain(21)
}
tasks.withType<Test>().configureEach {
// Configure all test Gradle tasks to use JUnitPlatform.
useJUnitPlatform()
// Log information about all test results, not only the failed ones.
testLogging {
events(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
)
}
}
+7
View File
@@ -0,0 +1,7 @@
# Enable the build cache to save time by reusing outputs produced by other successful builds.
# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
# Enable the configuration cache to reuse the build configuration and enable parallel task execution.
# (Note that some plugins may not yet be compatible with the configuration cache.)
# https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache=true
+22
View File
@@ -0,0 +1,22 @@
# Version catalog is a central place for you to declare and version dependencies
# https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
[versions]
kotlin = "2.2.10"
kotlinxDatetime = "0.6.2"
kotlinxSerializationJSON = "1.8.1"
kotlinxCoroutines = "1.10.2"
[libraries]
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinxDatetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinxSerialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJSON" }
kotlinxCoroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
# Libraries can be bundled together for easier import
[bundles]
kotlinxEcosystem = ["kotlinxDatetime", "kotlinxSerialization", "kotlinxCoroutines"]
[plugins]
kotlinPluginSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
+25
View File
@@ -0,0 +1,25 @@
// The settings file is the entry point of every Gradle build.
// Its primary purpose is to define the subprojects.
// It is also used for some aspects of project-wide configuration, like managing plugins, dependencies, etc.
// https://docs.gradle.org/current/userguide/settings_file_basics.html
dependencyResolutionManagement {
// Use Maven Central as the default repository (where Gradle will download dependencies) in all subprojects.
@Suppress("UnstableApiUsage")
repositories {
mavenCentral()
}
}
plugins {
// Use the Foojay Toolchains plugin to automatically download JDKs required by subprojects.
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
// Include the `app` and `utils` subprojects in the build.
// If there are changes in only one of the projects, Gradle will rebuild only the one that has changed.
// Learn more about structuring projects with Gradle - https://docs.gradle.org/8.7/userguide/multi_project_builds.html
include(":app")
include(":utils")
rootProject.name = "Buildtopia"
+13
View File
@@ -0,0 +1,13 @@
plugins {
// Apply the shared build logic from a convention plugin.
// The shared code is located in `buildSrc/src/main/kotlin/kotlin-jvm.gradle.kts`.
id("buildsrc.convention.kotlin-jvm")
// Apply Kotlin Serialization plugin from `gradle/libs.versions.toml`.
alias(libs.plugins.kotlinPluginSerialization)
}
dependencies {
// Apply the kotlinx bundle of dependencies from the version catalog (`gradle/libs.versions.toml`).
implementation(libs.bundles.kotlinxEcosystem)
testImplementation(kotlin("test"))
}
+17
View File
@@ -0,0 +1,17 @@
package dev.wbell.buildtopia.utils
import kotlinx.datetime.*
import kotlinx.serialization.Serializable
import kotlinx.coroutines.*
@Serializable
class Printer(val message: String) {
fun printMessage() = runBlocking {
val now: Instant = Clock.System.now()
launch {
delay(1000L)
println(now.toString())
}
println(message)
}
}
+25
View File
@@ -0,0 +1,25 @@
package dev.wbell.buildtopia.utils
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlinx.serialization.json.Json
import kotlinx.serialization.encodeToString
import dev.wbell.buildtopia.utils.*
internal class PrinterTest {
@Test
fun testMessage() {
val message = "message"
val testPrinter = Printer(message)
assertEquals(testPrinter.message, message)
}
@Test
fun testSerialization() {
val message = "message"
val json1 = Json.encodeToString(Printer(message))
val json2 = Json.encodeToString(Printer(message))
assertEquals(json1, json2)
}
}