neoforged / ModDevGradle

A Gradle plugin for developing Minecraft mods using NeoForge
https://projects.neoforged.net/neoforged/moddevgradle
GNU Lesser General Public License v2.1
33 stars 4 forks source link

Gradle fails on MacOS #45

Closed Trikzon closed 3 months ago

Trikzon commented 3 months ago

Using the 1.21-mdg NeoForge MDK as a minimal example, I get the following error when building gradle on a 2020 M1 Macbook Air.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':createArtifactManifest'.
> Error while evaluating property 'neoForgeModDevArtifacts' of task ':createArtifactManifest'.
   > Failed to calculate the value of task ':createArtifactManifest' property 'neoForgeModDevArtifacts'.
      > Could not resolve all artifacts for configuration ':neoFormRuntimeDependenciesRuntimeClasspath'.
         > Could not resolve net.neoforged:minecraft-dependencies:{strictly 1.21}.
           Required by:
               project : > net.neoforged:neoforge:21.0.0-beta > net.neoforged:neoform:1.21-20240613.152323 > net.neoforged:minecraft-dependencies:1.21
            > The consumer was configured to find a component for use during runtime, as well as attribute 'net.neoforged.distribution' with value 'client'. However we cannot choose between the following variants of net.neoforged:minecraft-dependencies:1.21:
                - clientLinuxNatives
                - clientOsxNatives
                - clientWindowsNatives
              All of them match the consumer attributes:
                - Variant 'clientLinuxNatives' capability net.neoforged:minecraft-dependencies-natives:1.21 declares a component for use during runtime, as well as attribute 'net.neoforged.distribution' with value 'client':
                    - Unmatched attributes:
                        - Provides attribute 'net.neoforged.operatingsystem' with value 'linux' but the consumer didn't ask for it
                        - Provides compatibility with Java 21 but the consumer didn't ask for it
                        - Provides integration status but the consumer didn't ask for it
                - Variant 'clientOsxNatives' capability net.neoforged:minecraft-dependencies-natives:1.21 declares a component for use during runtime, as well as attribute 'net.neoforged.distribution' with value 'client':
                    - Unmatched attributes:
                        - Provides attribute 'net.neoforged.operatingsystem' with value 'osx' but the consumer didn't ask for it
                        - Provides compatibility with Java 21 but the consumer didn't ask for it
                        - Provides integration status but the consumer didn't ask for it
                - Variant 'clientWindowsNatives' capability net.neoforged:minecraft-dependencies-natives:1.21 declares a component for use during runtime, as well as attribute 'net.neoforged.distribution' with value 'client':
                    - Unmatched attributes:
                        - Provides attribute 'net.neoforged.operatingsystem' with value 'windows' but the consumer didn't ask for it
                        - Provides compatibility with Java 21 but the consumer didn't ask for it
                        - Provides integration status but the consumer didn't ask for it

The full error log with --stacktrace can be found at https://gist.github.com/Trikzon/5514b2811acbbc97beca16bf11a8f460.

This only occurs on my Macbook. The MDK does not fail on my Windows machine.

Technici4n commented 3 months ago

Hello! That seems related to https://github.com/neoforged/ModDevGradle/blob/6f7115b883d3437c0488577a1aeeb523755ad800/src/main/java/net/neoforged/moddevgradle/internal/OperatingSystemDisambiguation.java#L18.

Can you confirm that os.name java property starts with Mac OS X? (see the linked code)

Independently of that, it looks like the os name should be osx rather than macosx in MDG.

Trikzon commented 3 months ago
println System.getProperty("os.name")

prints Mac OS X

Technici4n commented 3 months ago

This should be fixed in MDG 0.1.100. :)

Trikzon commented 3 months ago

That fixed it! Thank you :D