-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement DSL builder for export profiles & error severity handling
- Loading branch information
1 parent
b5ee8e0
commit 0020441
Showing
14 changed files
with
220 additions
and
108 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
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
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
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
29 changes: 9 additions & 20 deletions
29
src/commonMain/kotlin/teksturepako/pakku/api/actions/export/profiles/CurseForgeProfile.kt
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,25 +1,14 @@ | ||
package teksturepako.pakku.api.actions.export.profiles | ||
|
||
import teksturepako.pakku.api.actions.export.ExportProfile | ||
import teksturepako.pakku.api.actions.export.rules.createCfModpackModel | ||
import teksturepako.pakku.api.actions.export.exportProfile | ||
import teksturepako.pakku.api.actions.export.rules.cfMissingProjectsRule | ||
import teksturepako.pakku.api.actions.export.rules.cfModpackRule | ||
import teksturepako.pakku.api.actions.export.rules.replacementRule | ||
import teksturepako.pakku.api.actions.export.rules.ruleOfCfMissingProjects | ||
import teksturepako.pakku.api.actions.export.rules.ruleOfCfModpack | ||
import teksturepako.pakku.api.data.ConfigFile | ||
import teksturepako.pakku.api.data.LockFile | ||
import teksturepako.pakku.api.platforms.CurseForge | ||
import teksturepako.pakku.compat.exportFileDirector | ||
import teksturepako.pakku.compat.fileDirectorRule | ||
|
||
class CurseForgeProfile(lockFile: LockFile, configFile: ConfigFile) : ExportProfile( | ||
name = CurseForge.serialName, | ||
rules = listOf( | ||
lockFile.getFirstMcVersion()?.let { | ||
val modpackModel = createCfModpackModel(it, lockFile, configFile) | ||
ruleOfCfModpack(modpackModel) | ||
}, | ||
if (lockFile.getAllProjects().any { "filedirector" in it }) exportFileDirector(excludedProviders = setOf(CurseForge)) | ||
else ruleOfCfMissingProjects(), | ||
replacementRule() | ||
), | ||
dependsOn = CurseForge | ||
) | ||
fun curseForgeProfile() = exportProfile(name = CurseForge.serialName, requiresPlatform = CurseForge) { | ||
rule { cfModpackRule() } | ||
optionalRule { fileDirectorRule(excludedProviders = setOf(CurseForge)) } orElse rule { cfMissingProjectsRule() } | ||
rule { replacementRule() } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/commonMain/kotlin/teksturepako/pakku/api/actions/export/profiles/DefaultProfiles.kt
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package teksturepako.pakku.api.actions.export.profiles | ||
|
||
val defaultProfiles = listOf( | ||
curseForgeProfile(), | ||
modrinthProfile(), | ||
serverPackProfile() | ||
) |
32 changes: 11 additions & 21 deletions
32
src/commonMain/kotlin/teksturepako/pakku/api/actions/export/profiles/ModrinthProfile.kt
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,26 +1,16 @@ | ||
package teksturepako.pakku.api.actions.export.profiles | ||
|
||
import teksturepako.pakku.api.actions.export.ExportProfile | ||
import teksturepako.pakku.api.actions.export.rules.createMrModpackModel | ||
import teksturepako.pakku.api.actions.export.exportProfile | ||
import teksturepako.pakku.api.actions.export.rules.mrMissingProjectsRule | ||
import teksturepako.pakku.api.actions.export.rules.mrModpackRule | ||
import teksturepako.pakku.api.actions.export.rules.replacementRule | ||
import teksturepako.pakku.api.actions.export.rules.ruleOfMrMissingProjects | ||
import teksturepako.pakku.api.actions.export.rules.ruleOfMrModpack | ||
import teksturepako.pakku.api.data.ConfigFile | ||
import teksturepako.pakku.api.data.LockFile | ||
import teksturepako.pakku.api.platforms.Modrinth | ||
import teksturepako.pakku.compat.exportFileDirector | ||
import teksturepako.pakku.compat.fileDirectorRule | ||
|
||
class ModrinthProfile(lockFile: LockFile, configFile: ConfigFile) : ExportProfile( | ||
name = Modrinth.serialName, | ||
fileExtension = "mrpack", | ||
rules = listOf( | ||
lockFile.getFirstMcVersion()?.let { | ||
val modpackModel = createMrModpackModel(it, lockFile, configFile) | ||
ruleOfMrModpack(modpackModel) | ||
}, | ||
if (lockFile.getAllProjects().any { "filedirector" in it }) exportFileDirector(excludedProviders = setOf(Modrinth)) | ||
else ruleOfMrMissingProjects(), | ||
replacementRule() | ||
), | ||
dependsOn = Modrinth | ||
) | ||
fun modrinthProfile() = exportProfile( | ||
name = Modrinth.serialName, fileExtension = "mrpack", requiresPlatform = Modrinth | ||
) { | ||
rule { mrModpackRule() } | ||
optionalRule { fileDirectorRule(excludedProviders = setOf(Modrinth)) } orElse rule { mrMissingProjectsRule() } | ||
rule { replacementRule() } | ||
} |
15 changes: 6 additions & 9 deletions
15
src/commonMain/kotlin/teksturepako/pakku/api/actions/export/profiles/ServerPackProfile.kt
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,13 +1,10 @@ | ||
package teksturepako.pakku.api.actions.export.profiles | ||
|
||
import teksturepako.pakku.api.actions.export.ExportProfile | ||
import teksturepako.pakku.api.actions.export.rules.exportServerPack | ||
import teksturepako.pakku.api.actions.export.exportProfile | ||
import teksturepako.pakku.api.actions.export.rules.replacementRule | ||
import teksturepako.pakku.api.actions.export.rules.serverPackRule | ||
|
||
class ServerPackProfile : ExportProfile( | ||
name = "serverpack", | ||
rules = listOf( | ||
exportServerPack(), | ||
replacementRule() | ||
) | ||
) | ||
fun serverPackProfile() = exportProfile(name = "serverpack") { | ||
rule { serverPackRule() } | ||
rule { replacementRule() } | ||
} |
Oops, something went wrong.