Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add client pack and local pack rule #42

Closed

Conversation

SettingDust
Copy link
Contributor

No description provided.

@SettingDust SettingDust marked this pull request as ready for review October 9, 2024 10:02
@juraj-hrivnak
Copy link
Owner

Sorry for the late response. Thanks for the PR.

I am not a fan of registering the export profiles like this:

val registry = mutableMapOf<String, (LockFile, ConfigFile) -> ExportProfile>()

init
{
    registry[ClientPackProfile.NAME] = { _, _ -> ClientPackProfile() }
    registry[CombinedPackProfile.NAME] = { _, _ -> CombinedPackProfile() }
    registry[ServerPackProfile.NAME] = { _, _ -> ServerPackProfile() }
    registry[CurseForgeProfile.NAME] = { lockFile, configFile -> CurseForgeProfile(lockFile, configFile) }
    registry[ModrinthProfile.NAME] = { lockFile, configFile -> ModrinthProfile(lockFile, configFile) }
}

A registry is not a bad idea indeed, but registering should be implemented differently.
How I would do it:

// exportProfile is a function that will create an ExportProfile and add it to the "registry".
exportProfile(name = "serverpack")( // A curried function that can accept ExportRules as varargs
    ServerPackRule()
)

@@ -23,3 +23,9 @@ class CurseForgeProfile(lockFile: LockFile, configFile: ConfigFile) : ExportProf
),
dependsOn = CurseForge
)
{
companion object
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the things that I said, these companion objects become unnecessary.

@juraj-hrivnak juraj-hrivnak added the enhancement Enhancement of an existing feature label Dec 9, 2024
@juraj-hrivnak
Copy link
Owner

I am closing this because I introduced a new DSL for creating export profiles, and this will likely be superseded by the scripting support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of an existing feature
Projects
Status: Done🎉
Development

Successfully merging this pull request may close these issues.

2 participants