Skip to content

Commit

Permalink
Fix build and nuke Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Erdragh committed May 13, 2024
1 parent 33b6e50 commit d508886
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 408 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:
with:
name: build-fabric
path: fabric/build/libs
- name: Capture Forge Artifacts
- name: Capture Neo Artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v4
with:
name: build-forge
path: forge/build/libs
name: build-neo
path: neoforge/build/libs
- name: Capture Changelog
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v4
Expand All @@ -78,11 +78,11 @@ jobs:
path: build/fabric
pattern: build-fabric
merge-multiple: true
- name: Download Forge artifacts
- name: Download Neo artifacts
uses: actions/download-artifact@v4
with:
path: build/forge
pattern: build-forge
path: build/neo
pattern: build-neo
merge-multiple: true
- name: Download Changelog
uses: actions/download-artifact@v4
Expand All @@ -102,9 +102,9 @@ jobs:
path: "./gradle.properties"
properties: "version enabledPlatforms minecraftVersion"

- name: Upload Forge Releases (Curse/Modrinth)
id: forge_release
if: contains(steps.properties.outputs.enabledPlatforms, 'forge')
- name: Upload Neo Releases (Curse/Modrinth)
id: neo_release
if: contains(steps.properties.outputs.enabledPlatforms, 'neoforge')
uses: Kir-Antipov/[email protected]
with:
curseforge-id: ${{ vars.CURSE_ID }}
Expand All @@ -114,19 +114,17 @@ jobs:
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files: ./build/forge/!(*-@(dev|sources|dev-shadow)).jar
name: "AstralBot ${{ steps.properties.outputs.version }} Forge ${{ steps.properties.output.minecraftVersion }}"
name: "AstralBot ${{ steps.properties.outputs.version }} NeoForge ${{ steps.properties.output.minecraftVersion }}"
version: ${{ steps.properties.outputs.version }}
version-type: release
changelog-file: build-changelog/prepared_changelog.md
loaders: forge
game-versions: ${{ steps.properties.outputs.minecraftVersion }}

curseforge-dependencies: |
sqlite-jdbc(optional)
kotlin-for-forge(required)
forge-config-api-port-fabric(required)
modrinth-dependencies: |
sqlite-jdbc(optional)
kotlin-for-forge(required)
forge-config-api-port(required)
Expand Down
60 changes: 32 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,43 +69,42 @@ subprojects {
val sqliteJDBCVersion: String by project
val commonmarkVersion: String by project

// This array gets used at multiple places, so it's easier to
// just specify all dependencies at once and re-use them. This
// also makes changing them later on easier.
val botDependencies = arrayOf(
// Library used to communicate with Discord, see https://jda.wiki
"net.dv8tion:JDA:$jdaVersion",

// Library to interact with the SQLite database,
// see: https://github.com/JetBrains/Exposed
"org.jetbrains.exposed:exposed-core:$exposedVersion",
"org.jetbrains.exposed:exposed-dao:$exposedVersion",
"org.jetbrains.exposed:exposed-jdbc:$exposedVersion",
"org.jetbrains.exposed:exposed-kotlin-datetime:$exposedVersion",

// Markdown parser used for formatting Discord messages in Minecraft
"org.commonmark:commonmark:$commonmarkVersion",
)


// This config includes the bot dependencies in the final jar
val botDep by configurations.creating {
// Configuration for shaded dependencies, get relocated to dev.erdragh.astralbot.shadowed
val shadowBotDep by configurations.creating {
isTransitive = true
}
// Configuration for JiJ-ed dependencies
val includeBotDep by configurations.creating {
isTransitive = false
}
// Configuration for libraries that are needed at runtime
val runtimeLib by configurations.creating {
isTransitive = true
}
configurations.implementation.extendsFrom(configurations.named("botDep"))
configurations.implementation.extendsFrom(configurations.named("shadowBotDep"))
configurations.implementation.extendsFrom(configurations.named("includeBotDep"))
configurations.implementation.extendsFrom(configurations.named("runtimeLib"))

dependencies {
// Discord Bot dependencies
// Database driver that allows Exposed to communicate with
// the SQLite database. This will not be in the JAR and needs to be provided
// otherwise (e.g. https://www.curseforge.com/minecraft/mc-mods/sqlite-jdbc)
runtimeLib("org.xerial:sqlite-jdbc:$sqliteJDBCVersion")
botDependencies.forEach {
botDep(it) {
includeBotDep("org.xerial:sqlite-jdbc:$sqliteJDBCVersion")

runtimeLib("org.commonmark:commonmark:$commonmarkVersion")
includeBotDep("org.commonmark:commonmark:$commonmarkVersion")


arrayOf(
// Library used to communicate with Discord, see https://jda.wiki
"net.dv8tion:JDA:$jdaVersion",

// Library to interact with the SQLite database,
// see: https://github.com/JetBrains/Exposed
"org.jetbrains.exposed:exposed-core:$exposedVersion",
"org.jetbrains.exposed:exposed-dao:$exposedVersion",
"org.jetbrains.exposed:exposed-jdbc:$exposedVersion",
"org.jetbrains.exposed:exposed-kotlin-datetime:$exposedVersion",
).forEach {
runtimeLib(it) {
// opus-java is for audio, which this bot doesn't need
exclude(module = "opus-java")
// Kotlin would be included as a transitive dependency
Expand All @@ -115,6 +114,11 @@ subprojects {
// Minecraft already ships with a logging system
exclude(group = "org.slf4j")
}
shadowBotDep(it) {
exclude(module = "opus-java")
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.slf4j")
}
}
}

Expand Down
9 changes: 6 additions & 3 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ plugins {

val modId: String by project

val includeBotDep: Configuration by configurations.getting
val shadowBotDep: Configuration by configurations.getting

dependencies {
mappings(loom.officialMojangMappings())
val minecraftVersion: String by project
Expand All @@ -26,6 +29,8 @@ dependencies {
modImplementation("net.fabricmc:fabric-language-kotlin:${fabricKotlinVersion}")

modApi("fuzs.forgeconfigapiport:forgeconfigapiport-fabric:$forgeConfigAPIVersion")

includeBotDep.dependencies.forEach { include(it) }
}

loom {
Expand All @@ -51,8 +56,6 @@ loom {
}
}

val botDep: Configuration by configurations.getting

tasks {
withType<JavaCompile> {
source(project(":common").sourceSets.main.get().allSource)
Expand All @@ -70,7 +73,7 @@ tasks {
shadowJar {
archiveClassifier.set("dev-shadow")

configurations = listOf(botDep)
configurations = listOf(shadowBotDep)

// This transforms the service files to make relocated Exposed work (see: https://github.com/JetBrains/Exposed/issues/1353)
mergeServiceFiles()
Expand Down
188 changes: 0 additions & 188 deletions forge/build.gradle.kts

This file was deleted.

Empty file removed forge/gradle.properties
Empty file.

This file was deleted.

Loading

0 comments on commit d508886

Please sign in to comment.