Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing extended Gradle Module Metadata for Tooling #959

Draft
wants to merge 3 commits into
base: 1.20.x
Choose a base branch
from

Conversation

shartte
Copy link
Contributor

@shartte shartte commented May 13, 2024

No description provided.

@shartte shartte marked this pull request as draft May 13, 2024 09:09
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented May 13, 2024

  • Publish PR to GitHub Packages

Last commit published: 636279f873ec8796307dde98a767fd6ae126b287.

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 #959' // https://github.com/neoforged/NeoForge/pull/959
        url 'https://prmaven.neoforged.net/NeoForge/pr959'
        content {
            includeModule('net.neoforged', 'neoforge')
            includeModule('net.neoforged', 'testframework')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr959.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr959
cd NeoForge-pr959
curl -L https://prmaven.neoforged.net/NeoForge/pr959/net/neoforged/neoforge/20.6.104-beta-pr-959-features-gradle-metadata/mdk-pr959.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, "installer"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installer is, in gradle-land, probably still considered a LIBRARY -- it's a jar with classes in it. It just happens to have Bundling.EMBEDDED. A library is generally "a binary and a set of dependencies" -- gradle probably could have better called them "binaries and/or dependencies of binaries" to be honest

// Publish it
javaComponent.addVariantsFromConfiguration(it) {}
}
universalJar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone does implementation 'net.neoforged:neoforge:x.y.z', they will end up with the universal jar. This doesn't make much sense and leads to confusion; a straight dependency on neoforged in this way should probably fail to resolve if nothing else is specified and no plugin is present. Maybe give this variant a capability?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tried that once already and at that point at least it did simply resolve to an empty set of files. We can try again, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will never resolve to an empty set of files, it has to pick a variant. If I had to guess it picked a variant due to a partial match or something - you have to make variants explicitly not match, not just be incomplete matches, because gradle considers any missing attributes to be matches. I'll give it a poke if I have a chance

Changelog and classifiers

Add publications

Publish all moddev artifacts using capabilities

Publishing... stuff...

Add mavens for PRs

Use published neoform version

Use published neoform version
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.

None yet

3 participants