Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
TexBlock committed Sep 7, 2024
1 parent fdfc60e commit 73a1107
Showing 5 changed files with 53 additions and 10 deletions.
2 changes: 2 additions & 0 deletions base/fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import net.fabricmc.loom.util.ModPlatform

apply from: rootProject.file("gradle/scripts/klib-fabric.gradle")

group = "band.kessoku.lib.base"
2 changes: 2 additions & 0 deletions base/neo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import net.fabricmc.loom.util.ModPlatform

apply from: rootProject.file("gradle/scripts/klib-neo.gradle")

group = "band.kessoku.lib.base"
Original file line number Diff line number Diff line change
@@ -43,15 +43,6 @@ public void additionalRepositories(RepositoryHandler repositories) {
repositories.maven(repo -> {
repo.setName("NeoForge");
repo.setUrl("https://maven.neoforged.net/releases/");

repo.content(descriptor -> {
NEO_GROUPS.forEach(descriptor::includeGroupAndSubgroups);
});

repo.metadataSources(sources -> {
sources.mavenPom();
sources.ignoreGradleMetadataRedirection();
});
});

repositories.maven(repo -> {
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package band.kessoku.gradle.plugin;

import net.fabricmc.loom.api.LoomGradleExtensionAPI;
import net.fabricmc.loom.util.ModPlatform;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.tasks.SourceSetContainer;

@@ -14,6 +16,10 @@ public abstract class KesssokuExtension {
@Inject
protected abstract Project getProject();

public void testModuleImpls(List<String> names, String plat) {
names.forEach(name -> testModuleImpl(name, plat));
}

public void moduleImpls(List<String> names, String plat) {
names.forEach(name -> moduleImpl(name, plat));
}
@@ -22,6 +28,24 @@ public void moduleIncludes(List<String> names, String plat) {
names.forEach(name -> moduleInclude(name, plat));
}

public void testModuleImpl(String name, String plat) {
Project project = this.getProject();
DependencyHandler dependencies = project.getDependencies();

Dependency dependency = dependencies.project(Map.of(
"path", ":" + name + "-" + plat,
"configuration", "namedElements"
));
dependencies.add("testImplementation", dependency);

// LoomGradleExtensionAPI loom = project.getExtensions().getByType(LoomGradleExtensionAPI.class);
// loom.mods(mods -> mods.register("kessoku-" + name + "-" + plat, settings -> {
// Project depProject = project.project(":" + name + "-" + plat);
// SourceSetContainer sourceSets = depProject.getExtensions().getByType(SourceSetContainer.class);
// settings.sourceSet(sourceSets.getByName("main"), depProject);
// }));
}

public void moduleImpl(String name, String plat) {
Project project = this.getProject();
DependencyHandler dependencies = project.getDependencies();
@@ -57,4 +81,28 @@ public void moduleInclude(String name, String plat) {
settings.sourceSet(sourceSets.getByName("main"), depProject);
}));
}

public void commonImpl(String name, ModPlatform platform) {
Project project = this.getProject();
DependencyHandler dependencies = project.getDependencies();

ModuleDependency dependency = (ModuleDependency) dependencies.project(Map.of(
"path", ":" + name + "-common",
"configuration", "namedElements"
));
dependency.setTransitive(false);
dependencies.add("api", dependency);
dependencies.add("development" + platform.displayName(), dependency);
}

public void shade(String name, ModPlatform platform) {
Project project = this.getProject();
DependencyHandler dependencies = project.getDependencies();

Dependency dependency = dependencies.project(Map.of(
"path", ":" + name + "-common",
"configuration", "transformProduction" + platform.displayName()
));
dependencies.add("shadow", dependency);
}
}
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
package band.kessoku.lib.registry.api;

import band.kessoku.lib.registry.impl.KessokuRegistryServices;
import org.jetbrains.annotations.ApiStatus;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
@@ -24,7 +25,6 @@
import net.minecraft.registry.Registries;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.ApiStatus;

@SuppressWarnings("unused")
public interface Registry {

0 comments on commit 73a1107

Please sign in to comment.