|
| 1 | +import com.smushytaco.lwjgl_gradle.Module |
| 2 | + |
| 3 | +plugins { |
| 4 | +// id 'fabric-loom' version '1.10-SNAPSHOT' // TODO Fork Fabric Loom for Quantum Voxel instead of Minecraft |
| 5 | + id("maven-publish") |
| 6 | + id("java") |
| 7 | + id("java-library") |
| 8 | + id("com.smushytaco.lwjgl3") version "1.0.0" |
| 9 | +} |
| 10 | + |
| 11 | +version = property("mod_version").toString() |
| 12 | +group = property("maven_group").toString() |
| 13 | + |
| 14 | +base { |
| 15 | + archivesName.set(property("archives_base_name").toString()) |
| 16 | +} |
| 17 | + |
| 18 | +lwjgl { |
| 19 | + version = "3.4.0-SNAPSHOT" |
| 20 | + usePredefinedPlatforms = true |
| 21 | + api(Module.OPENGL, Module.OPENAL, Module.STB) |
| 22 | +} |
| 23 | + |
| 24 | +repositories { |
| 25 | + // Add repositories to retrieve artifacts from in here. |
| 26 | + // You should only use this when depending on other mods because |
| 27 | + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. |
| 28 | + // See https://docs.gradle.org/current/userguide/declaring_repositories.html |
| 29 | + // for more information about repositories. |
| 30 | + mavenCentral() |
| 31 | + |
| 32 | + maven("https://maven.ultreon.dev/releases") |
| 33 | + maven("https://maven.ultreon.dev/snapshots") |
| 34 | + maven("https://maven.fabricmc.net/") |
| 35 | + maven("https://jitpack.io") |
| 36 | + |
| 37 | + maven("https://oss.sonatype.org/content/repositories/snapshots/") |
| 38 | + maven("https://oss.sonatype.org/content/repositories/releases/") |
| 39 | +} |
| 40 | + |
| 41 | +dependencies { |
| 42 | + // To change the versions see the gradle.properties file |
| 43 | + api("dev.ultreon.qvoxel:client:0.1.0-alpha.2025.11.29") |
| 44 | + api("dev.ultreon.qvoxel:server:0.1.0-alpha.2025.11.29") |
| 45 | + |
| 46 | + runtimeOnly("dev.ultreon.qvoxel:gameprovider:0.1.0-alpha.2025.11.29") |
| 47 | +} |
| 48 | + |
| 49 | +tasks { |
| 50 | + processResources { |
| 51 | + inputs.property("version", project.version.toString()) |
| 52 | + |
| 53 | + filesMatching("fabric.mod.json") { |
| 54 | + expand(inputs.properties) |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + withType<ProcessResources>() { |
| 59 | + duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| 60 | + } |
| 61 | + |
| 62 | + withType<JavaCompile>().configureEach { |
| 63 | + options.release = 25 |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +java { |
| 68 | + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
| 69 | + // if it is present. |
| 70 | + // If you remove this line, sources will not be generated. |
| 71 | + withSourcesJar() |
| 72 | + |
| 73 | + sourceCompatibility = JavaVersion.VERSION_25 |
| 74 | + targetCompatibility = JavaVersion.VERSION_25 |
| 75 | + |
| 76 | + toolchain { |
| 77 | + languageVersion = JavaLanguageVersion.of(25) |
| 78 | + } |
| 79 | +} |
| 80 | + |
| 81 | +tasks.register<JavaExec>("runClient") { |
| 82 | + dependsOn("classes") |
| 83 | + mainClass = "net.fabricmc.loader.impl.launch.knot.KnotClient" |
| 84 | + classpath = sourceSets.main.get().runtimeClasspath + sourceSets.main.get().output |
| 85 | + |
| 86 | + if (System.getProperty("os.name").contains("Mac")) { |
| 87 | + jvmArgs("-XstartOnFirstThread", "-Dfabric.development=true") |
| 88 | + } |
| 89 | + |
| 90 | + workingDir = file("run") |
| 91 | +} |
| 92 | + |
| 93 | +tasks.register<JavaExec>("runServer") { |
| 94 | + dependsOn("classes") |
| 95 | + mainClass = "net.fabricmc.loader.impl.launch.knot.KnotServer" |
| 96 | + classpath = sourceSets.main.get().runtimeClasspath + sourceSets.main.get().output |
| 97 | + |
| 98 | + workingDir = file("run") |
| 99 | +} |
| 100 | + |
| 101 | +tasks.jar { |
| 102 | + inputs.property("archivesName", project.base.archivesName) |
| 103 | + |
| 104 | + duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| 105 | + |
| 106 | + from("LICENSE") { |
| 107 | + rename { "${it}_${inputs.properties["archivesName"]}" } |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +// configure the maven publication |
| 112 | +publishing { |
| 113 | + publications { |
| 114 | + create<MavenPublication>("mavenJava") { |
| 115 | + artifactId = project.property("archives_base_name").toString() |
| 116 | + from(components.named("java").get()) |
| 117 | + } |
| 118 | + } |
| 119 | + |
| 120 | + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. |
| 121 | + repositories { |
| 122 | + // Add repositories to publish to here. |
| 123 | + // Notice: This block does NOT have the same function as the block in the top level. |
| 124 | + // The repositories here will be used for publishing your artifact, not for |
| 125 | + // retrieving dependencies. |
| 126 | + } |
| 127 | +} |
| 128 | + |
| 129 | +mkdir("run") |
0 commit comments