-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add new script to easily add the essential loader #5
Draft
Sychic
wants to merge
8
commits into
master
Choose a base branch
from
new/essential-loader-script
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3aa877d
New: Essential Loader Script
Sychic fa6dc87
essential-loader: use implementation instead of runtimeOnly
Sychic 361cb24
essential-loader: add tweakclass to manifest
Sychic 7fba960
essential-loader: improve error message
Sychic c95b47b
change: remove unecessary manifest attribute
Sychic c4f5045
change: adjust error message
Sychic ee69140
build: update loader to 1.2.2
Sychic 5163d93
loader: error on unsupported versions
Sychic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package gg.essential | ||
|
||
import gg.essential.gradle.multiversion.Platform | ||
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute | ||
|
||
|
||
plugins { | ||
id("gg.essential.loom") | ||
} | ||
|
||
val platform = Platform.of(project) | ||
|
||
val essentialLoader: Configuration by configurations.creating | ||
|
||
when { | ||
platform.isLegacyForge -> { | ||
dependencies { | ||
"implementation"(essentialLoader("gg.essential:loader-launchwrapper:1.2.2")!!) | ||
} | ||
tasks.named<Jar>("jar") { | ||
Sychic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dependsOn(essentialLoader) | ||
manifest.attributes(mapOf( | ||
"TweakClass" to "gg.essential.loader.stage0.EssentialSetupTweaker" | ||
)) | ||
from({ zipTree(essentialLoader.singleFile) }) | ||
} | ||
} | ||
|
||
platform.isFabric -> { | ||
dependencies { | ||
"include"("modRuntimeOnly"("gg.essential:loader-fabric:1.2.2")!!) | ||
} | ||
} | ||
|
||
Sychic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//FIXME: Fix loader not working on ml | ||
platform.isModLauncher -> { | ||
error("Modlauncher is currently not supported") | ||
// dependencies { | ||
// val relocatedPackage = findProperty("essential.loader.package")?.toString() ?: throw GradleException(""" | ||
// A package for the Essential loader to be relocated to has not been set. | ||
// You need to set `essential.loader.package` in the project's `gradle.properties` file to a package where Essential's loader will be relocated to. | ||
// For example: `essential.loader.package = org.example.coolmod.relocated.essential` | ||
// """.trimIndent()) | ||
// val relocationAttribute = | ||
// registerRelocationAttribute("essential-loader-relocated") { | ||
// relocate("gg.essential.loader.stage0", "$relocatedPackage.stage0") | ||
// // preserve stage1 path | ||
// rename("gg/essential/loader/stage0/stage1.jar", "gg/essential/loader/stage0/stage1.jar") | ||
// } | ||
// essentialLoader.attributes { | ||
// attribute(relocationAttribute, true) | ||
// } | ||
// if (platform.mcVersion < 11700) { | ||
// "forgeRuntimeLibrary"(essentialLoader("gg.essential:loader-modlauncher8:1.2.2")!!) | ||
// } else { | ||
// "forgeRuntimeLibrary"(essentialLoader("gg.essential:loader-modlauncher9:1.2.2")!!) | ||
// } | ||
// } | ||
// tasks.named<Jar>("jar") { | ||
// dependsOn(essentialLoader) | ||
// from({ zipTree(essentialLoader.singleFile) }) | ||
// } | ||
} | ||
|
||
else -> error("No loader available for this platform") | ||
} | ||
|
||
// Unit statement so it doesn't try to get the result from the when block | ||
Unit |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a property for the loader version which just defaults to
1.2.2
? (and we can change that whenever we get around to it)Without one, we would have to make sure we always update this (which shouldn't be too often from my knowledge, but still)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe however the original intent was for the dev to have to do as little as possible (and I think it's mostly fine that the version is hardcoded since in theory the stage0 version should almost never change)