Created
April 29, 2026 03:59
-
-
Save Lothrazar/814b009e7e06ec030117a303d4eafd33 to your computer and use it in GitHub Desktop.
neoforge default gradle doesnt handle multi project repos, need to wrap tasks init in this if statement. Now they will work standalone and also within the multi-pass
This file contains hidden or 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
| import os | |
| ROOT = r"C:\Users\USER\MyFiles\mc121" | |
| OLD = """tasks.named('wrapper', Wrapper).configure { | |
| // Define wrapper values here so as to not have to always do so when updating gradlew.properties. | |
| // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with | |
| // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased | |
| // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards. | |
| // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`) | |
| distributionType = Wrapper.DistributionType.BIN | |
| }""" | |
| NEW = """if (project == rootProject) { | |
| tasks.named('wrapper', Wrapper).configure { | |
| // Define wrapper values here so as to not have to always do so when updating gradlew.properties. | |
| // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with | |
| // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased | |
| // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards. | |
| // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`) | |
| distributionType = Wrapper.DistributionType.BIN | |
| } | |
| }""" | |
| for mod in os.listdir(ROOT): | |
| build_gradle = os.path.join(ROOT, mod, "build.gradle") | |
| if not os.path.isfile(build_gradle): | |
| continue | |
| content = open(build_gradle, encoding="utf-8").read() | |
| if OLD in content: | |
| open(build_gradle, "w", encoding="utf-8").write(content.replace(OLD, NEW)) | |
| print(f" fixed: {mod}") | |
| else: | |
| print(f"skipped: {mod} (block not found)") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment