Skip to content

Commit

Permalink
start
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed Aug 12, 2023
1 parent 9887e83 commit a18bc37
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 24 deletions.
47 changes: 25 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import com.matthewprenger.cursegradle.Options
import gg.essential.gradle.util.*

plugins {
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.4.21"
alias(libs.plugins.kotlin)
//kotlin("plugin.serialization") version "1.8.22"
id("gg.essential.multi-version")
id("gg.essential.defaults")
id("com.github.johnrengelman.shadow")
Expand Down Expand Up @@ -52,7 +52,7 @@ base {
archivesName.set("$mod_name (${getMcVersionStr()}-${platform.loaderStr})")
}

tasks.compileKotlin.setJvmDefault(if (platform.mcVersion >= 11400) "all" else "all-compatibility")
//tasks.compileKotlin.setJvmDefault(if (platform.mcVersion >= 11400) "all" else "all-compatibility")
loom.noServerRunConfigs()
loom {
/*if (project.platform.isLegacyForge) launchConfigs.named("client") {
Expand All @@ -78,39 +78,42 @@ val shade: Configuration by configurations.creating {
}

dependencies {
val elementaVersion = "590+markdown"
val universalVersion = "277"
val elementaPlatform: String? by project
val universalPlatform: String? by project
val essentialPlatform: String? by project
if (platform.isFabric) {
val fabricApiVersion: String by project
val fabricLanguageKotlinVersion: String by project
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricLanguageKotlinVersion")
modCompileOnly("gg.essential:elementa-${elementaPlatform ?: platform}:$elementaVersion")
modImplementation("include"("gg.essential:universalcraft-${universalPlatform ?: platform}:$universalVersion")!!)
modCompileOnly("gg.essential:elementa-${elementaPlatform ?: platform}:${libs.versions.elementa}")
modImplementation("include"("gg.essential:universalcraft-${universalPlatform ?: platform}:${libs.versions.universal}")!!)
} else if (platform.isForge) {
compileOnly("gg.essential:essential-${essentialPlatform ?: platform}:4166+ge3c5b9d02")
if (platform.isLegacyForge) {
shade("gg.essential:loader-launchwrapper:1.1.3") {
/*shade("gg.essential:loader-launchwrapper:1.1.3") {
isTransitive = false
}
}*/
shade(libs.bundles.kotlin) { isTransitive = false }
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
compileOnly("org.spongepowered:mixin:0.8.5")
} else {
val kotlinForForgeVersion: String by project
runtimeOnly("thedarkcolour:kotlinforforge:$kotlinForForgeVersion")
shade("gg.essential:universalcraft-${universalPlatform ?: platform}:$universalVersion") {
isTransitive = false
}
implementation("thedarkcolour:kotlinforforge:$kotlinForForgeVersion")
}
shade("gg.essential:universalcraft-${universalPlatform ?: platform}:${libs.versions.universal}") {
isTransitive = false
}
}
listOf(libs.bundles.twelvemonkeys, libs.caffeine).forEach {
if (platform.isFabric) {
implementation(it)
include(it)
} else {
shade(it) { isTransitive = false }
}
}
shade("gg.essential:elementa-${elementaPlatform ?: platform}:$elementaVersion") {
shade("gg.essential:elementa-${elementaPlatform ?: platform}:${libs.versions.elementa}") {
isTransitive = false
}
shade("com.github.ben-manes.caffeine:caffeine:2.9.3")
shade("com.twelvemonkeys.imageio:imageio-webp:3.9.4")
}

tasks.processResources {
Expand Down Expand Up @@ -160,10 +163,10 @@ tasks {
configurations = listOf(shade)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
mergeServiceFiles()
relocate("com.github.benmanes.caffeine", "dev.dediamondpro.resourcify.libs.caffeine")
relocate("com.twelvemonkeys", "dev.dediamondpro.resourcify.libs.twelvemonkeys")
relocate("gg.essential.elementa", "dev.dediamondpro.resourcify.libs.elementa")
if (platform.isForge && !platform.isLegacyForge) {
if (platform.isForge) {
relocate("com.github.benmanes.caffeine", "dev.dediamondpro.resourcify.libs.caffeine")
relocate("com.twelvemonkeys", "dev.dediamondpro.resourcify.libs.twelvemonkeys")
relocate("gg.essential.elementa", "dev.dediamondpro.resourcify.libs.elementa")
relocate("gg.essential.universal", "dev.dediamondpro.resourcify.libs.universal")
}
}
Expand Down
38 changes: 38 additions & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[versions]
kotlin = "1.8.22"
caffeine = "2.9.3"
twelvemonkeys = "3.9.4"
universal = "277"
elementa = "590+markdown"

[libraries]
# Kotlin
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }

# Caching
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }

# Image Dependencies
twelvemonkeys_core = { module = "com.twelvemonkeys.imageio:imageio-core", version.ref = "twelvemonkeys" }
twelvemonkeys_webp = { module = "com.twelvemonkeys.imageio:imageio-webp", version.ref = "twelvemonkeys" }
twelvemonkeys_metadata = { module = "com.twelvemonkeys.imageio:imageio-metadata", version.ref = "twelvemonkeys" }
twelvemonkeys_lang = { module = "com.twelvemonkeys.common:common-lang", version.ref = "twelvemonkeys" }
twelvemonkeys_io = { module = "com.twelvemonkeys.common:common-io", version.ref = "twelvemonkeys" }
twelvemonkeys_image = { module = "com.twelvemonkeys.common:common-image", version.ref = "twelvemonkeys" }

[plugins]
# Kotlin
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

[bundles]
kotlin = [
"kotlin"
]
twelvemonkeys = [
"twelvemonkeys_core",
"twelvemonkeys_webp",
"twelvemonkeys_metadata",
"twelvemonkeys_lang",
"twelvemonkeys_io",
"twelvemonkeys_image"
]
2 changes: 1 addition & 1 deletion root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

plugins {
kotlin("jvm") version "1.6.10" apply false
alias(libs.plugins.kotlin) apply false
id("net.kyori.blossom") version "1.3.0" apply false
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
id("gg.essential.multi-version.root")
Expand Down
10 changes: 9 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ pluginManagement {
maven("https://repo.essential.gg/repository/maven-public")
}
plugins {
val egtVersion = "0.2.1"
val egtVersion = "0.2.2"
id("gg.essential.multi-version.root") version egtVersion
}
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("libs.versions.toml"))
}
}
}

val mod_name: String by settings

rootProject.name = mod_name
Expand Down

0 comments on commit a18bc37

Please sign in to comment.