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

Rewrite exporting & implement "export rules" + "export profiles" #18

Merged
merged 13 commits into from
Jun 26, 2024

Conversation

juraj-hrivnak
Copy link
Owner

@juraj-hrivnak juraj-hrivnak commented Jun 25, 2024

Export Rules

Exporting a modpack is now controlled by a list of rules which control what should happen with the content you want to export/package.

These rules can be written in many ways and are fully extensible by extending the RuleContext class.

To create an export rule, you simply implement the functional interface like this:

fun exampleRule() = ExportRule {
    when (it)
    {
        is ExportingProject -> it.export() // (Sample function)
        else                -> it.ignore()
    }
}

Export rules must be part of an ExportProfile to be executed.

Export Profiles

An export profile is used to contain the above-mentioned list of rules.
Each export profile is independent of each other and will result in one exported file.

ExportProfile(
    name = "example-profile",
    rules = listOf(
        exampleRule()
    )
)

An export profile can be exported using the ExportProfile.export() extension function.
Multiple export profiles can be exported asynchronously when used as a parameter in the export() function.

@juraj-hrivnak juraj-hrivnak added the enhancement New feature or request label Jun 25, 2024
@juraj-hrivnak juraj-hrivnak marked this pull request as ready for review June 26, 2024 19:18
@juraj-hrivnak juraj-hrivnak self-assigned this Jun 26, 2024
@juraj-hrivnak juraj-hrivnak merged commit 70327a3 into main Jun 26, 2024
6 checks passed
@juraj-hrivnak juraj-hrivnak deleted the rewrite/export branch June 26, 2024 19:21
@juraj-hrivnak juraj-hrivnak mentioned this pull request Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done🎉
Development

Successfully merging this pull request may close these issues.

1 participant