/GTNHGradle

This plugin is the container for most of our shared buildscript logic for all GTNH mods and some other 1.7.10 mods. The original buildscript grew to hundreds of lines of Groovy code, using this plugin we can use regular Java classes to compartmentalize that logic and make it easier to extend and update

Primary LanguageJavaGNU Lesser General Public License v2.1LGPL-2.1

GTNH Gradle plugin

This plugin is the container for most of our shared buildscript logic for all GTNH mods and some other 1.7.10 mods. The original buildscript grew to hundreds of lines of Groovy code, using this plugin we can use regular Java classes to compartmentalize that logic and make it easier to extend and update.

See the javadoc - the entrypoint is the plugin extension class.

Navigating the source code

The entrypoint for the plugin is in the GTNHGradlePlugin class. The main plugin class applies the plugin dependencies of GTNHGradle, including RFG, Maven publishing and the Download task, and then registers the gtnhGradle extension object which can be used to activate individual modules of this plugin.

test tests make sure that applying the plugin works correctly in a simple Gradle setup. Bulk of the testing is done in functionalTest which uses Gradle TestKit to test entire workflows in sandboxed Gradle environments.

Updating from the previous buildscript

  1. Make sure you're on the latest master commit and you pulled the recent repository changes ;-)
  2. Copy over the gradle/ directory and build.gradle, gradlew and gradlew.bat files from ExampleMod1.7.10 to the mod folder.
  3. Update settings.gradle pluginManagement{} and plugins{} block to the following: (keep the old blowdryerSetup as-is)
     pluginManagement {
         repositories {
             maven {
                 // RetroFuturaGradle
                 name "GTNH Maven"
                 url "https://nexus.gtnewhorizons.com/repository/public/"
                 mavenContent {
                     includeGroup("com.gtnewhorizons")
                     includeGroupByRegex("com\\.gtnewhorizons\\..+")
                 }
             }
             gradlePluginPortal()
             mavenCentral()
             mavenLocal()
         }
     }
    
     plugins {
         id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.7'
     }
  4. Run the automated migration while temporarily ignoring the new blowdryer setup with ./gradlew updateBuildscript -Pgtnh.settings.blowdryerTag=MIGRATION-MAGIC
  5. Check the updated files for any obvious mistakes
  6. Commit