neoforged / ModDevGradle

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

Fix data file publishing #117

Closed Matyrobbrt closed 1 month ago

Matyrobbrt commented 1 month ago

Data files weren't being published as artifacts to maven

neoforged-pr-publishing[bot] commented 1 month ago

Last commit published: 68f9064ac8a25be89db6d64e0c2b2171d65b7db1.

PR Publishing ### The artifacts published by this PR: - :package: [`net.neoforged.moddev:net.neoforged.moddev.gradle.plugin:1.0.30-pr-117-fix-data-file-publishing`](https://github.com/neoforged/ModDevGradle/packages/2212123) - :package: [`net.neoforged.moddev.repositories:net.neoforged.moddev.repositories.gradle.plugin:1.0.30-pr-117-fix-data-file-publishing`](https://github.com/neoforged/ModDevGradle/packages/2212124) - :package: [`net.neoforged:moddev-gradle:1.0.30-pr-117-fix-data-file-publishing`](https://github.com/neoforged/ModDevGradle/packages/2212122) ### Repository Declaration In order to use the artifacts published by the PR, add the following repository to your buildscript: ```gradle repositories { maven { name 'Maven for PR #117' // https://github.com/neoforged/ModDevGradle/pull/117 url 'https://prmaven.neoforged.net/ModDevGradle/pr117' content { includeModule('net.neoforged.moddev', 'net.neoforged.moddev.gradle.plugin') includeModule('net.neoforged.moddev.repositories', 'net.neoforged.moddev.repositories.gradle.plugin') includeModule('net.neoforged', 'moddev-gradle') } } } ```
Matyrobbrt commented 1 month ago

Yeah I noticed, it's because the elements configuration always has a dependency, even if it's empty. I don't think it really matters in the end if the empty variant is published, i might just remove the "conditional" part which is basically always true.

Technici4n commented 1 month ago

I don't want to publish a variant for a niche feature by default, it's not great.

Matyrobbrt commented 1 month ago

And what do you suggest instead?

Matyrobbrt commented 1 month ago

Well, this is ugly, but I suppose it works:

        elementsConfiguration.getAllDependencies().configureEach(dep -> {
            // We always add a dependency containing the project's published data files
            // Make sure that doesn't cause an empty variant
            if (dep instanceof FileCollectionDependency fc && fc.getFiles().isEmpty()) return;

            configurePublishing.run();
        });
neoforged-releases[bot] commented 1 month ago

🚀 This PR has been released as ModDevGradle version 2.0.8-beta.