diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-20 22:42:33 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-20 22:42:33 +0700 |
commit | e95dfd774b359fb296ccd4e725b8114e3b21dea4 (patch) | |
tree | c9b304260fdb7d19b3bee3d4b83b5c1dce976a78 | |
parent | bda6a119108d238e3c7d85e82f37f5d6da3b9b5e (diff) | |
download | OneConfig-e95dfd774b359fb296ccd4e725b8114e3b21dea4.tar.gz OneConfig-e95dfd774b359fb296ccd4e725b8114e3b21dea4.tar.bz2 OneConfig-e95dfd774b359fb296ccd4e725b8114e3b21dea4.zip |
separate lwjgl stuff from actual project
-rw-r--r-- | build.gradle.kts | 58 | ||||
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | lwjgl/build.gradle.kts | 103 | ||||
-rw-r--r-- | settings.gradle.kts | 3 |
4 files changed, 115 insertions, 51 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 477222c..e798224 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,35 +74,17 @@ val shadeRelocated: Configuration by configurations.creating { } val shade: Configuration by configurations.creating { - configurations.implementation.get().extendsFrom(this) + configurations.api.get().extendsFrom(this) } -val lwjgl: Configuration by configurations.creating - -val lwjglNative: Configuration by configurations.creating { - isTransitive = false -} +val shadeNoPom: Configuration by configurations.creating sourceSets { main { - runtimeClasspath += lwjglNative output.setResourcesDir(java.classesDirectory) } } -val lwjglJar by tasks.registering(ShadowJar::class) { - group = "shadow" - archiveClassifier.set("lwjgl") - configurations = listOf(lwjgl) - exclude("META-INF/versions/**") - exclude("**/module-info.class") - exclude("**/package-info.class") - relocate("org.lwjgl", "org.lwjgl3") { - include("org.lwjgl.PointerBuffer") - include("org.lwjgl.BufferUtils") - } -} - dependencies { compileOnly("gg.essential:vigilance-$platform:222") { isTransitive = false @@ -140,27 +122,13 @@ dependencies { shade("org.spongepowered:mixin:0.7.11-SNAPSHOT") { isTransitive = false } - - lwjgl("org.lwjgl:lwjgl:3.3.1") - lwjgl("org.lwjgl:lwjgl-stb:3.3.1") - lwjgl("org.lwjgl:lwjgl-tinyfd:3.3.1") - lwjgl("org.lwjgl:lwjgl-nanovg:3.3.1") - lwjglNative("org.lwjgl:lwjgl:3.3.1:natives-windows") - lwjglNative("org.lwjgl:lwjgl-stb:3.3.1:natives-windows") - lwjglNative("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows") - lwjglNative("org.lwjgl:lwjgl-nanovg:3.3.1:natives-windows") - lwjglNative("org.lwjgl:lwjgl:3.3.1:natives-linux") - lwjglNative("org.lwjgl:lwjgl-stb:3.3.1:natives-linux") - lwjglNative("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux") - lwjglNative("org.lwjgl:lwjgl-nanovg:3.3.1:natives-linux") - lwjglNative("org.lwjgl:lwjgl:3.3.1:natives-macos") - lwjglNative("org.lwjgl:lwjgl-stb:3.3.1:natives-macos") - lwjglNative("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos") - lwjglNative("org.lwjgl:lwjgl-nanovg:3.3.1:natives-macos") - shade(lwjglJar.get().outputs.files) - shade(prebundle(shadeRelocated)) + shade("cc.polyfrost:lwjgl:$mod_version") + shadeNoPom(prebundle(shadeRelocated)) dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.21") + + configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom) } + configurations.named(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom) } } tasks.processResources { @@ -224,7 +192,7 @@ tasks { } named<ShadowJar>("shadowJar") { archiveClassifier.set("donotusethis") - configurations = listOf(shade, lwjglNative) + configurations = listOf(shade) duplicatesStrategy = DuplicatesStrategy.EXCLUDE dependsOn(jar) } @@ -283,18 +251,11 @@ tasks { afterEvaluate { val checkFile = file(".gradle/loom-cache/SETUP") - val lwjglJarDelayed by tasks.creating { - dependsOn(lwjglJar) - } - @Suppress("UNUSED_VARIABLE") val setupGradle by tasks.creating { group = "loom" description = "Setup OneConfig" - dependsOn(lwjglJarDelayed) - val genSourcesWithQuiltflower = tasks.named("genSourcesWithQuiltflower").get() - dependsOn(genSourcesWithQuiltflower) - genSourcesWithQuiltflower.mustRunAfter(lwjglJarDelayed) + dependsOn(tasks.named("genSourcesWithQuiltflower").get()) doLast { checkFile.parentFile.mkdirs() checkFile.createNewFile() @@ -317,7 +278,6 @@ publishing { artifact(tasks["jar"]) artifact(tasks["remapJar"]) - artifact(tasks["lwjglJar"]) artifact(tasks["sourcesJar"]) artifact(tasks["dokkaJar"]) } diff --git a/gradle.properties b/gradle.properties index 0d0e8da..f4c1838 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_name = OneConfig mod_id = oneconfig -mod_version = 0.1.0-alpha17 +mod_version = 0.1.0-alpha19 essential.defaults.loom=0 diff --git a/lwjgl/build.gradle.kts b/lwjgl/build.gradle.kts new file mode 100644 index 0000000..9f347bd --- /dev/null +++ b/lwjgl/build.gradle.kts @@ -0,0 +1,103 @@ +plugins { + kotlin("jvm") + id("gg.essential.defaults.repo") + id("gg.essential.defaults.java") + id("com.github.johnrengelman.shadow") + id("maven-publish") + id("signing") + java +} + +val mod_name: String by project +val mod_version: String by project +val mod_id: String by project + +version = mod_version + +repositories { + maven("https://repo.polyfrost.cc/releases") +} +val shadeCompileOnly: Configuration by configurations.creating +val shadeRuntimeOnly: Configuration by configurations.creating + +sourceSets { + main { + runtimeClasspath += shadeRuntimeOnly + } +} + +dependencies { + shadeCompileOnly("org.lwjgl:lwjgl:3.3.1") + shadeCompileOnly("org.lwjgl:lwjgl-stb:3.3.1") + shadeCompileOnly("org.lwjgl:lwjgl-tinyfd:3.3.1") + shadeCompileOnly("org.lwjgl:lwjgl-nanovg:3.3.1") + + shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-windows") + shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-windows") + shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows") + shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-windows") + shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-linux") + shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-linux") + shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux") + shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-linux") + shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-macos") + shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-macos") + shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos") + shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-macos") +} + +tasks { + named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { + archiveClassifier.set("") + configurations = listOf(shadeCompileOnly, shadeRuntimeOnly) + exclude("META-INF/versions/**") + exclude("**/module-info.class") + exclude("**/package-info.class") + relocate("org.lwjgl", "org.lwjgl3") { + include("org.lwjgl.PointerBuffer") + include("org.lwjgl.BufferUtils") + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + dependsOn(jar) + } + jar { + enabled = false + } +} + +publishing { + publications { + register<MavenPublication>("lwjgl") { + groupId = "cc.polyfrost" + artifactId = "lwjgl" + artifact(tasks["shadowJar"]) + } + } + + repositories { + maven { + name = "releases" + url = uri("https://repo.polyfrost.cc/releases") + credentials(PasswordCredentials::class) + authentication { + create<BasicAuthentication>("basic") + } + } + maven { + name = "snapshots" + url = uri("https://repo.polyfrost.cc/snapshots") + credentials(PasswordCredentials::class) + authentication { + create<BasicAuthentication>("basic") + } + } + maven { + name = "private" + url = uri("https://repo.polyfrost.cc/private") + credentials(PasswordCredentials::class) + authentication { + create<BasicAuthentication>("basic") + } + } + } +}
\ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index da56434..69f48d4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,4 +31,5 @@ listOf( projectDir = file("versions/$version") buildFileName = "../../build.gradle.kts" } -}
\ No newline at end of file +} +include(":lwjgl")
\ No newline at end of file |