NeoGradle icon indicating copy to clipboard operation
NeoGradle copied to clipboard

Add JUnit support

Open Matyrobbrt opened this issue 1 year ago • 5 comments

Add support for configuring JUnit run tasks.

Matyrobbrt avatar Jan 24 '24 13:01 Matyrobbrt

  • [x] Publish PR to GitHub Packages

Last commit published: 0363b2c51f628e061a5232e364164142101d05f2.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #107' // https://github.com/neoforged/NeoGradle/pull/107
        url 'https://prmaven.neoforged.net/NeoGradle/pr107'
        content {
            includeModule('net.neoforged.gradle', 'dsl-vanilla')
            includeModule('net.neoforged.gradle', 'utils')
            includeModule('net.neoforged.gradle', 'dsl-mixin')
            includeModule('net.neoforged.gradle', 'common')
            includeModule('net.neoforged.gradle', 'junit')
            includeModule('net.neoforged.gradle', 'dsl-platform')
            includeModule('net.neoforged.gradle', 'dsl-userdev')
            includeModule('net.neoforged.gradle', 'mixin')
            includeModule('net.neoforged.gradle.mixin', 'net.neoforged.gradle.mixin.gradle.plugin')
            includeModule('net.neoforged.gradle', 'dsl-neoform')
            includeModule('net.neoforged.gradle.common', 'net.neoforged.gradle.common.gradle.plugin')
            includeModule('net.neoforged.gradle', 'neoform')
            includeModule('net.neoforged.gradle.neoform', 'net.neoforged.gradle.neoform.gradle.plugin')
            includeModule('net.neoforged.gradle', 'dsl-common')
            includeModule('net.neoforged.gradle.junit', 'net.neoforged.gradle.junit.gradle.plugin')
            includeModule('net.neoforged.gradle.userdev', 'net.neoforged.gradle.userdev.gradle.plugin')
            includeModule('net.neoforged.gradle', 'vanilla')
            includeModule('net.neoforged.gradle', 'platform')
            includeModule('net.neoforged.gradle.platform', 'net.neoforged.gradle.platform.gradle.plugin')
            includeModule('net.neoforged.gradle', 'userdev')
            includeModule('net.neoforged.gradle.vanilla', 'net.neoforged.gradle.vanilla.gradle.plugin')
        }
    }
}

How does this interact with running tests from IDEA directly (rather than through Gradle)? I'm assuming that it won't work, as FML/BootstrapLauncher expect environment variables and system properties to be present?

SquidDev avatar Jan 24 '24 17:01 SquidDev

If you run tests with the Gradle runner it will work fine in IDEA, if you run with the IntelliJ runner it won't, that's correct, and that's not really fixable.

Matyrobbrt avatar Jan 24 '24 17:01 Matyrobbrt

That's useful to know, thanks! Mostly just trying to compare with what I have now (I only need MC's Bootstrap for my existing tests, so can get away with doing less of a thorough job :)).

SquidDev avatar Jan 24 '24 18:01 SquidDev

@marchermans The IntelliJ & Gradle unit test launchers are not runTypes, hence the comparison falls flat. We do not launch via a generated gradle task, nor do we launch via BootstrapLauncher here. I don't want to expose these internal shenanigans for users since it's more friction to get unit tests to work and not less.

shartte avatar Feb 20 '24 07:02 shartte

Is superseded by #183

marchermans avatar May 19 '24 15:05 marchermans