-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from aemogie/main
Gradle buildscript refactor.
- Loading branch information
Showing
20 changed files
with
206 additions
and
191 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,86 @@ | ||
import org.gradle.internal.os.OperatingSystem | ||
|
||
plugins { | ||
id 'com.github.johnrengelman.shadow' version '7.1.0' | ||
id 'java' | ||
id 'application' | ||
id("application") | ||
id("com.github.johnrengelman.shadow").version("7.1.0") | ||
} | ||
|
||
group 'com.GwgCommunity' | ||
version '1.0-SNAPSHOT' | ||
tasks.wrapper { | ||
gradleVersion = "7.3.1" | ||
distributionType = Wrapper.DistributionType.BIN | ||
} | ||
|
||
group = "com.GwgCommunity" | ||
version = "1.0-SNAPSHOT" | ||
|
||
sourceCompatibility = 11 | ||
targetCompatibility = 11 | ||
|
||
project.ext.lwjglVersion = "3.3.0" | ||
project.ext.jomlVersion = "1.10.1" | ||
switch (OperatingSystem.current()) { | ||
repositories { mavenCentral() } | ||
|
||
ext.junitVersion = "4.13.2" | ||
ext.lwjglVersion = "3.3.0" | ||
ext.jomlVersion = "1.10.4" | ||
|
||
/* ext.lwjglNatives */ switch (OperatingSystem.current()) { | ||
case OperatingSystem.LINUX: | ||
def osArch = System.getProperty("os.arch") | ||
project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64") | ||
ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64") | ||
? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}" | ||
: "natives-linux" | ||
break | ||
case OperatingSystem.MAC_OS: | ||
project.ext.lwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos" | ||
ext.lwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos" | ||
break | ||
case OperatingSystem.WINDOWS: | ||
def osArch = System.getProperty("os.arch") | ||
project.ext.lwjglNatives = osArch.contains("64") | ||
ext.lwjglNatives = osArch.contains("64") | ||
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}" | ||
: "natives-windows-x86" | ||
break | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
application { | ||
mainClass = 'scenes.TextRenderingDemo' | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
'Main-Class': 'scenes.UIRenderingDemo', | ||
) | ||
} | ||
dependencies { | ||
testImplementation("junit:junit:$junitVersion") | ||
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion")) | ||
implementation("org.lwjgl:lwjgl") | ||
implementation("org.lwjgl:lwjgl-glfw") | ||
implementation("org.lwjgl:lwjgl-openal") | ||
implementation("org.lwjgl:lwjgl-opengl") | ||
implementation("org.lwjgl:lwjgl-stb") | ||
runtimeOnly("org.lwjgl:lwjgl::$lwjglNatives") | ||
runtimeOnly("org.lwjgl:lwjgl-glfw::$lwjglNatives") | ||
runtimeOnly("org.lwjgl:lwjgl-openal::$lwjglNatives") | ||
runtimeOnly("org.lwjgl:lwjgl-opengl::$lwjglNatives") | ||
runtimeOnly("org.lwjgl:lwjgl-stb::$lwjglNatives") | ||
implementation("org.joml:joml:$jomlVersion") | ||
} | ||
|
||
|
||
task fatJar(type: Jar) { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
manifest.from jar.manifest | ||
classifier = 'all' | ||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
with jar | ||
} | ||
|
||
sourceSets { | ||
test { | ||
java { | ||
srcDir 'src/main/test' | ||
} | ||
application { | ||
mainClass = "scenes.UIRenderingDemo" | ||
if (OperatingSystem.current() == OperatingSystem.MAC_OS) { | ||
applicationDefaultJvmArgs = ["-XstartOnFirstThread"] | ||
} | ||
} | ||
|
||
test { | ||
testLogging { | ||
events "passed", "skipped", "failed" | ||
} | ||
useJUnit() | ||
testLogging.events("passed", "skipped", "failed") | ||
} | ||
|
||
dependencies { | ||
testImplementation group: 'junit', name: 'junit', version: '4.12' | ||
|
||
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion") | ||
|
||
implementation "org.lwjgl:lwjgl" | ||
implementation "org.lwjgl:lwjgl-glfw" | ||
implementation "org.lwjgl:lwjgl-openal" | ||
implementation "org.lwjgl:lwjgl-opengl" | ||
implementation "org.lwjgl:lwjgl-stb" | ||
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" | ||
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" | ||
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" | ||
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" | ||
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" | ||
implementation "org.joml:joml:${jomlVersion}" | ||
} | ||
|
||
task generateApiDocs(type: Javadoc) { | ||
title = "" | ||
options.noTimestamp(false) | ||
source sourceSets.main.allJava | ||
classpath = configurations.runtimeClasspath | ||
options.encoding 'UTF-8' | ||
destinationDir = file("build/generated-files") | ||
options.addStringOption("doclet", "com.microsoft.doclet.DocFxDoclet") | ||
options.docletpath = [file("lib/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies.jar")] | ||
dependsOn build | ||
} | ||
|
||
// Possible thing to look into later... this doesn't work, I am too tired rn to try making it work. | ||
task execute(type: JavaExec) { | ||
dependsOn fatJar | ||
classpath = fatJar.outputs.files | ||
// main('com.name.enginetester.GameLoop') | ||
|
||
if (OperatingSystem.current() == OperatingSystem.MAC_OS) { | ||
jvmArgs '-XstartOnFirstThread' | ||
} | ||
tasks.register("generateApiDocs", Javadoc) { | ||
it.title = "" | ||
it.options.noTimestamp(false) | ||
it.source(sourceSets.main.allJava) | ||
it.classpath = configurations.runtimeClasspath | ||
it.options.encoding("UTF-8") | ||
it.destinationDir = file("build/generated-files") | ||
it.options.addStringOption("doclet", "com.microsoft.doclet.DocFxDoclet") | ||
it.options.docletpath = [file("lib/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies.jar")] | ||
it.dependsOn(build) | ||
} | ||
|
||
// aliases | ||
tasks.register("fatJar") { it.dependsOn(tasks.shadowJar) } | ||
tasks.register("execute") { it.dependsOn(tasks.runShadow) } |
Binary file not shown.
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,8 +1,5 @@ | ||
#Tue Dec 07 22:11:29 CST 2021 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME |
Oops, something went wrong.