Skip to content

Enhance test coverage for ModStitch gradle plugin across all platforms#37

Draft
isXander with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-8d4ed041-a392-48e1-a62a-9c78059aabb3
Draft

Enhance test coverage for ModStitch gradle plugin across all platforms#37
isXander with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-8d4ed041-a392-48e1-a62a-9c78059aabb3

Conversation

Copilot AI commented Aug 7, 2025

Copy link
Copy Markdown

This PR significantly improves the test coverage of the ModStitch gradle plugin by adding comprehensive integration tests that validate the documented feature-set across all three supported platforms: Fabric Loom, NeoForge MDG, and MDGLegacy.

Overview

ModStitch is a thin abstraction layer on top of Minecraft mod-loader gradle plugins, providing a unified API for building mods across different platforms. The existing test coverage was minimal and didn't comprehensively validate the broad feature set documented in the ModstitchExtension API.

What's Added

8 New Comprehensive Test Classes

  1. CoreConfigurationTests - Tests core configuration features:

    • Minecraft version configuration and validation
    • Mod loader version configuration (Fabric Loader, NeoForge, Forge)
    • Java version auto-detection based on Minecraft version (Java 8/16/17/21)
    • Platform detection utilities across all three platforms
  2. MetadataManifestTests - Tests metadata and manifest generation:

    • Metadata block configuration (mod ID, name, version, description, authors, license)
    • Platform-specific manifest generation (fabric.mod.json, neoforge.mods.toml, mods.toml)
    • Template processing and variable substitution
    • Metadata validation with required fields
  3. MixinConfigurationTests - Tests mixin integration:

    • Mixin config registration and setup
    • Multiple mixin configurations support
    • Environment-specific mixin configs (client/server)
    • Mixin annotation processor setup
  4. ParchmentConfigurationTests - Tests parchment mappings:

    • Parchment configuration for parameter name mappings
    • Custom version specification and auto minecraft version inheritance
    • Optional/disabled parchment scenarios
  5. ProxyConfigurationTests - Tests dependency abstraction:

    • Proxy configuration creation for abstracting platform differences
    • Mod vs non-mod dependency handling through modstitchImplementation vs modstitchModImplementation
    • Source set proxy configurations for main and test
  6. RunConfigurationTests - Tests run configuration setup:

    • Default and custom run configurations
    • Environment variables and program arguments configuration
    • Multiple run configs (client, server, data generation)
  7. JarInspectionTests - Tests built artifact validation using JAR inspection:

    • JAR structure validation for each platform
    • Manifest validation and version information
    • Verification of mixin configs, access wideners/transformers inclusion
    • Complete project build validation
  8. ExtensionIntegrationTests - Tests extension integration:

    • Publishing extension setup and multi-platform publishing
    • Shadow extension setup and shadow JAR creation
    • Final/named jar task configuration
  9. UnitTestingIntegrationTests - Tests unit testing functionality:

    • Unit testing setup that includes Minecraft sources
    • Custom JUnit platform configuration

Platform Coverage

Each test is implemented across all three supported platforms with appropriate tags:

  • @Tag("loom") - Fabric Loom tests
  • @Tag("mdg") - NeoForge ModDevGradle tests
  • @Tag("mdgl") - Legacy Forge ModDevGradle tests

This ensures platform parity and validates that the abstraction layer works consistently across all mod loaders.

Key Testing Techniques

  • JAR Inspection: Uses JarFile to inspect built JAR contents and validate structure
  • Configuration Validation: Tests property configuration through Gradle TestKit
  • Task Validation: Verifies task creation, configuration, and execution
  • Cross-Platform Compatibility: Ensures consistent behavior across platforms

Benefits

  • Comprehensive Coverage: Tests all major features documented in the ModstitchExtension API
  • Platform Parity: Ensures consistent behavior across Loom, MDG, and MDGLegacy
  • Regression Prevention: Catches breaking changes in any platform implementation
  • JAR Validation: Validates that built artifacts are correctly structured for each platform
  • Living Documentation: Tests serve as executable documentation of plugin behavior

The test suite follows the request for "fewer tests but broader feature coverage" by creating focused integration tests that validate complete workflows rather than many small unit tests. The JAR inspection technique specifically addresses the requirement to validate built artifacts are structured correctly.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • maven.fabricmc.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-all/10utluxaxniiv4wxiphsi49nj/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-all/10utluxaxniiv4wxiphsi49nj/gradle-8.14.3/lib/agents/gradle-instrumentation-agent-8.14.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14.3 (dns block)
  • maven.neoforged.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-all/10utluxaxniiv4wxiphsi49nj/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-all/10utluxaxniiv4wxiphsi49nj/gradle-8.14.3/lib/agents/gradle-instrumentation-agent-8.14.3.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14.3 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…l platforms

Co-authored-by: isXander <43245524+isXander@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve the test coverage of this gradle plugin. View the extension Modstitch and its nested API. This will provide you with a documented feature-set of the gradle plugin. Understand that this plugin is a thin abstraction layer on top of the two Minec... Enhance test coverage for ModStitch gradle plugin across all platforms Aug 7, 2025
Copilot AI requested a review from isXander August 7, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants