Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/misc.xml

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
}

dependencies {
api(project(':dependencies'))
api(project(':changelog'))
api(project(':maven-publishing'))
api(project(':resource-processing'))
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ tableau {
group = 'com.example' // Use your own group here.
minecraftVersion = '1.21.3' // Or any other minecraft version.
publisher = 'SomePublisher' // Use your own name here.
url = 'https://github.com/someorg/modid' // Use your own URL here.
repositoryUrl = uri('https://github.com/someorg/modid') // Use your own URL here.
}
}
}
4 changes: 2 additions & 2 deletions examples/maven-publish/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tableau {
group = 'com.example' // Use your own group here.
minecraftVersion = '1.21.3' // Or any other minecraft version.
publisher = 'SomePublisher' // Use your own name here.
url = 'https://github.com/someorg/modid' // Use your own URL here.
repositoryUrl = uri('https://github.com/someorg/modid') // Use your own URL here.
}

maven {
Expand All @@ -14,4 +14,4 @@ tableau {
usingGit()
}
}
}
}
9 changes: 7 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ sonarqube = "5.+"
shadow = "8.+"
jetbrainsAnnotations = "+"
curseForgeGradle = "1.+"
fancyModLoader = "5.+"
secureJarHandler = "3.+"

[libraries]
neogradle-userdev = { module = "net.neoforged.gradle:userdev", version.ref = "neogradle" }
Expand All @@ -15,11 +17,14 @@ sonarqube = { module = "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin",
shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version.ref = "shadow" }
jetbrainsAnnotations = { module = "org.jetbrains:annotations", version.ref = "jetbrainsAnnotations" }
curseForgeGradle = { module = "net.darkhax.curseforgegradle:CurseForgeGradle", version.ref = "curseForgeGradle" }
fancyModLoader = { module = "net.neoforged.fancymodloader:loader", version.ref = "fancyModLoader" }
secureJarHandler = { module = "cpw.mods:securejarhandler", version.ref = "secureJarHandler" }

[bundles]
neogradle = ["neogradle-userdev"]
neogradle = ["neogradle-userdev", "fancyModLoader"]
crowdin = ["crowdin", "gradle-download"]
sonarqube = ["sonarqube"]
shadow = ["shadow"]
jetbrainsAnnotations = ["jetbrainsAnnotations"]
curseForgeGradle = ["curseForgeGradle"]
curseForgeGradle = ["curseForgeGradle"]
fancyModLoader = ["fancyModLoader", "secureJarHandler"]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.ldtteam.tableau.scripting.extensions.TableauScriptingExtension;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;

import javax.inject.Inject;
import java.net.URI;

/**
* Mod extension, handles the project configuration for the mod.
Expand Down Expand Up @@ -64,6 +64,7 @@ public void versioning(final Action<Versioning> action) {
* The current mod id for the mod.
* <p>
* Not configuring the mod id, will likely result in an error during the build.
* </p>
*
* @return The mod id.
*/
Expand All @@ -88,6 +89,27 @@ public void versioning(final Action<Versioning> action) {
*/
public abstract Property<String> getMinecraftVersion();

/**
* The mod display name.
*
* @return The mod display name.
*/
public abstract Property<String> getModName();

/**
* The full mod description.
*
* @return The mod description.
*/
public abstract Property<String> getModDescription();

/**
* The mod logo file.
*
* @return The mod logo.
*/
public abstract Property<String> getModLogo();

/**
* The display name of the team or contributor who publishes the mod.
*
Expand All @@ -96,11 +118,32 @@ public void versioning(final Action<Versioning> action) {
public abstract Property<String> getPublisher();

/**
* The url of the website where documentation or source code can be found for the project.
* The url of the website where documentation can be found for the project.
*
* @return The website url, the location where documentation/support can be found.
*/
public abstract Property<URI> getDisplayUrl();

/**
* The url of the website where the source code can be found for the project.
*
* @return The repository url, is the location where the source code can be found.
*/
public abstract Property<URI> getRepositoryUrl();

/**
* The url of the website where the issue tracker can be found for the project.
*
* @return The issue tracker url, where issues may be filed for the mod.
*/
public abstract Property<URI> getIssueTrackerUrl();

/**
* The license for the mod.
*
* @return The mod url, is the location where documentation and support can be found.
* @return The license used for the mod.
*/
public abstract Property<String> getUrl();
public abstract Property<String> getLicense();

/**
* Mod versioning configuration model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.ldtteam.tableau.common.extensions.ModExtension;
import com.ldtteam.tableau.curseforge.extensions.CurseForgeExtension;
import com.ldtteam.tableau.extensions.NeoGradleExtension;
import com.ldtteam.tableau.dependencies.extensions.DependenciesExtension;
import com.ldtteam.tableau.jarjar.JarJarPlugin;
import com.ldtteam.tableau.neogradle.NeoGradlePlugin;
import com.ldtteam.tableau.scripting.extensions.TableauScriptingExtension;
Expand All @@ -14,11 +14,9 @@
import net.darkhax.curseforgegradle.Constants;
import net.darkhax.curseforgegradle.TaskPublishCurseForge;
import net.darkhax.curseforgegradle.UploadArtifact;
import org.gradle.api.GradleException;
import org.gradle.api.InvalidUserDataException;
import org.gradle.api.Project;
import org.gradle.api.Plugin;
import org.gradle.api.internal.project.IProjectFactory;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.jvm.tasks.Jar;
Expand Down Expand Up @@ -70,6 +68,7 @@ private void configureUploadTask(final Project project) {
final TaskProvider<? extends Jar> mainJar = getMainJar(project);
final CurseForgeExtension curse = CurseForgeExtension.get(project);
final SourceSetExtension sourceSets = SourceSetExtension.get(project);
final DependenciesExtension dependencies = DependenciesExtension.get(project);
final ModExtension mod = ModExtension.get(project);

if (!curse.getId().isPresent()) {
Expand Down Expand Up @@ -118,6 +117,9 @@ private void configureUploadTask(final Project project) {
}
});

dependencies.getAllRequiredDependencies().get().forEach(dep -> artifact.addRelation(dep.modId(), Constants.RELATION_REQUIRED));
dependencies.getAllOptionalDependencies().get().forEach(dep -> artifact.addRelation(dep.modId(), Constants.RELATION_OPTIONAL));

curse.getRelationships().get().forEach((slug, relationship) -> {
if (!Constants.VALID_RELATION_TYPES.contains(relationship)) {
throw new InvalidUserDataException("Invalid relationship type: %s for project: %s".formatted(relationship, slug));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ public String toString() {
* <ul>
* <li>embeddedLibrary</li>
* <li>incompatible</li>
* <li>optionalDependency</li>
* <li>requiredDependency</li>
* <li>tool</li>
* </ul>
* @return the relationships this project has with others
Expand Down Expand Up @@ -187,18 +185,18 @@ public Relationships(MapProperty<String, String> relationships) {
/**
* The relationships of the project on CurseForge.
* <p>
* The key is the slug of the project in the relationship and the value is the kind of relationship.
* As values, you can use:
* <ul>
* <li>embeddedLibrary</li>
* <li>incompatible</li>
* <li>optionalDependency</li>
* <li>requiredDependency</li>
* <li>tool</li>
* </ul>
* The key is the slug of the project in the relationship and the value is the kind of relationship.
* As values, you can use:
* </p>
* <ul>
* <li>embeddedLibrary</li>
* <li>incompatible</li>
* <li>tool</li>
* </ul>
* @return the relationships this project has with other published projects on CurseForge.
*/
public MapProperty<String, String> getRelationships() {
public MapProperty<String, String> getRelationships()
{
return this.relationships;
}

Expand Down Expand Up @@ -228,23 +226,5 @@ public void embedded(String slug) {
public void incompatible(String slug) {
getRelationships().put(slug, Constants.RELATION_INCOMPATIBLE);
}

/**
* Marks the given project as an optional dependency.
*
* @param slug the slug of the project
*/
public void optional(String slug) {
getRelationships().put(slug, Constants.RELATION_OPTIONAL);
}

/**
* Marks the given project as a required dependency.
*
* @param slug the slug of the project
*/
public void required(String slug) {
getRelationships().put(slug, Constants.RELATION_REQUIRED);
}
}
}
29 changes: 29 additions & 0 deletions modules/dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Gradle plugin project to get you started.
* For more details on writing Custom Plugins, please refer to https://docs.gradle.org/8.10/userguide/custom_plugins.html in the Gradle documentation.
* This project uses @Incubating APIs which are subject to change.
*/

plugins {
// Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
id 'java-gradle-plugin'
}

dependencies {
api project(':scripting')
api project(':sourceset-management')

api libs.bundles.fancyModLoader
}

gradlePlugin {
// Define the plugin
plugins {
"dependencies" {
id = 'com.ldtteam.tableau.dependencies'
implementationClass = 'com.ldtteam.tableau.dependencies.DependenciesPlugin'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This source file was generated by the Gradle 'init' task
*/
package com.ldtteam.tableau.dependencies;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

import javax.inject.Inject;

/**
* The root plugin for the Dependencies module.
* <p>
* Can be applied to any {@link org.gradle.api.plugins.PluginAware} but will only interact with {@link Project projects}
*/
public class DependenciesPlugin implements Plugin<Object> {

/**
* Creates a new plugin instance.
*/
@Inject
public DependenciesPlugin() {
}

@Override
public void apply(@NotNull Object target) {
if (target instanceof Project project) {
project.getPlugins().apply(DependenciesProjectPlugin.class);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This source file was generated by the Gradle 'init' task
*/
package com.ldtteam.tableau.dependencies;

import com.ldtteam.tableau.dependencies.extensions.DependenciesExtension;
import com.ldtteam.tableau.scripting.extensions.TableauScriptingExtension;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.jetbrains.annotations.NotNull;

import javax.inject.Inject;

/**
* Defines the Dependencies module plugin for {@link Project projects}
*/
public class DependenciesProjectPlugin implements Plugin<Project> {

/**
* Creates a new plugin instance.
*/
@Inject
public DependenciesProjectPlugin() {
}

@Override
public void apply(@NotNull Project target) {
target.getPlugins().apply(JavaLibraryPlugin.class);
TableauScriptingExtension.register(target, DependenciesExtension.EXTENSION_NAME, DependenciesExtension.class, target);
}
}
Loading