diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-10-14 17:53:21 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-10-14 18:31:38 +0800 |
| commit | 81f07b79c7560c4b0aba0d6dd3c1cac781fad68a (patch) | |
| tree | 01a163dea539410c45a6dc53bf346d5832330e63 | |
| parent | 423f31a81e7c0933c8e5571efb748b8a11f1774b (diff) | |
| download | RoughlyEnoughItems-81f07b79c7560c4b0aba0d6dd3c1cac781fad68a.tar.gz RoughlyEnoughItems-81f07b79c7560c4b0aba0d6dd3c1cac781fad68a.tar.bz2 RoughlyEnoughItems-81f07b79c7560c4b0aba0d6dd3c1cac781fad68a.zip | |
Remove LBA compatibility, Add Fabric API compatibility
Update buildscripts and README
Update buildscripts and README
| -rw-r--r-- | README.md | 90 | ||||
| -rw-r--r-- | api/build.gradle | 37 | ||||
| -rwxr-xr-x | build.gradle | 8 | ||||
| -rw-r--r-- | default-plugin/build.gradle | 41 | ||||
| -rw-r--r-- | fabric/build.gradle | 41 | ||||
| -rw-r--r-- | fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java | 2 | ||||
| -rw-r--r-- | fabric/src/main/java/me/shedaniel/rei/impl/common/compat/FabricFluidAPISupportPlugin.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/common/compat/LBASupportPlugin.java) | 38 | ||||
| -rw-r--r-- | forge/build.gradle | 48 | ||||
| -rw-r--r-- | forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java | 8 | ||||
| -rw-r--r-- | gradle.properties | 4 | ||||
| -rw-r--r-- | runtime/build.gradle | 42 |
11 files changed, 244 insertions, 115 deletions
@@ -1,6 +1,7 @@ # Roughly Enough Items https://minecraft.curseforge.com/projects/roughly-enough-items <br> Roughly Enough Items is a mod to view Items and Recipes for Minecraft 1.13 - 1.17, supporting mod loaders from Forge, Rift to Fabric. +----- [Help translate REI on Crowdin!](https://crowdin.com/project/roughly-enough-items) @@ -9,3 +10,92 @@ Roughly Enough Items is a mod to view Items and Recipes for Minecraft 1.13 - 1.1  This mod is both client sided and server sided. + +# Maven +Firstly, add my Maven repository (If you already have the architectury maven, you don't need to do this, they are the same repo) +```gradle +repositories { + maven { url "https://maven.shedaniel.me" } +} +``` + +## Choosing the correct artifact to depend on +### Fabric +REI recommends you to declare a compile dependency on REI's API, and a runtime dependency on REI's full package. +```gradle +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:VERSION" + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:VERSION" +} +``` + +Additionally, if you want to interact with the builtin plugins, you may declare a compile dependency on it as well. +```gradle +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin-fabric:VERSION" +} +``` + +### Forge (ForgeGradle) +REI recommends you to just depend on REI's full package. +```gradle +dependencies { + implementation fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:VERSION") +} +``` + +### Forge (Architectury Loom) +REI recommends you to declare a compile dependency on REI's API, and a runtime dependency on REI's full package. +```gradle +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-forge:VERSION" + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-forge:VERSION" +} +``` + +Additionally, if you want to interact with the builtin plugins, you may declare a compile dependency on it as well. +```gradle +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin-forge:VERSION" +} +``` + +### Architectury +REI recommends you to declare a compile dependency on REI's common API, and declare the full package on the individual platform's subprojects. +```gradle +// Common +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:VERSION" +} + +// Fabric +dependencies { + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:VERSION" +} + +// Forge +dependencies { + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-forge:VERSION" +} +``` + +Additionally, if you want to interact with the builtin plugins, you may declare a compile dependency on it as well. +```gradle +// Common +dependencies { + modCompileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin:VERSION" +} +``` + +### List of artifacts +- **me.shedaniel:RoughlyEnoughItems-api**: REI API for Architectury Common +- **me.shedaniel:RoughlyEnoughItems-default-plugin**: REI Default Plugin for Architectury Common +- **me.shedaniel:RoughlyEnoughItems-runtime**: REI Runtime for Architectury Common +- **me.shedaniel:RoughlyEnoughItems-api-fabric**: REI API for Fabric +- **me.shedaniel:RoughlyEnoughItems-default-plugin-fabric**: REI Default Plugin for Fabric +- **me.shedaniel:RoughlyEnoughItems-runtime-fabric**: REI Runtime for Fabric +- **me.shedaniel:RoughlyEnoughItems-api-forge**: REI API for Forge +- **me.shedaniel:RoughlyEnoughItems-default-plugin-forge**: REI Default Plugin for Forge +- **me.shedaniel:RoughlyEnoughItems-runtime-forge**: REI Runtime for Forge +- **me.shedaniel:RoughlyEnoughItems-fabric**: Full REI for Fabric +- **me.shedaniel:RoughlyEnoughItems-forge**: Full REI for Forge diff --git a/api/build.gradle b/api/build.gradle index 08252ab79..a38d48176 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -2,8 +2,8 @@ archivesBaseName = rootProject.name + "-" + project.name dependencies { modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}") - modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}") - modCompileOnly("dev.architectury:architectury:${architectury_version}") + modApi("me.shedaniel.cloth:cloth-config:${cloth_config_version}") + modApi("dev.architectury:architectury:${architectury_version}") } architectury { @@ -11,13 +11,15 @@ architectury { } remapJar { - afterEvaluate { - remapAccessWidener.set(false) - } + remapAccessWidener = false +} + +configurations { + dev } -java { - withSourcesJar() +remapJar { + classifier "raw" } task fakeJar(type: Jar, dependsOn: remapJar) { @@ -25,20 +27,25 @@ task fakeJar(type: Jar, dependsOn: remapJar) { from(rootProject.file("fake/fabric.mod.json")) { into "" } - archiveClassifier.set "fake" + classifier null +} + +artifacts { + dev(jar) + apiElements(fakeJar) + runtimeElements(fakeJar) +} + +afterEvaluate { + configurations.apiElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } + configurations.runtimeElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } } publishing { publications { mavenCommon(MavenPublication) { artifactId = rootProject.name + "-" + project.name - artifact(fakeJar) { classifier null } - afterEvaluate { - artifact(remapSourcesJar.output) { - builtBy remapSourcesJar - classifier "sources" - } - } + from components.java } } } diff --git a/build.gradle b/build.gradle index c888cb901..4d9d09784 100755 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id("architectury-plugin") version("3.3-SNAPSHOT") - id("dev.architectury.loom") version("0.7.4-SNAPSHOT") apply false + id("architectury-plugin") version("3.4-SNAPSHOT") + id("dev.architectury.loom") version("0.10.0-SNAPSHOT") apply false id("org.cadixdev.licenser") version("0.5.0") id("com.matthewprenger.cursegradle") version("1.4.0") id("java") @@ -20,6 +20,10 @@ subprojects { apply plugin: "com.matthewprenger.cursegradle" apply plugin: "dev.architectury.loom" + java { + withSourcesJar() + } + loom { silentMojangMappingsLicense() } diff --git a/default-plugin/build.gradle b/default-plugin/build.gradle index 9662dd803..c22da8b91 100644 --- a/default-plugin/build.gradle +++ b/default-plugin/build.gradle @@ -1,14 +1,14 @@ archivesBaseName = rootProject.name + "-" + project.name loom { - accessWidener = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener") + accessWidenerPath = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener") } dependencies { modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}") - modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}") - modCompileOnly("dev.architectury:architectury:${architectury_version}") - compileOnly(project(path: ":api")) + modApi("me.shedaniel.cloth:cloth-config:${cloth_config_version}") + modApi("dev.architectury:architectury:${architectury_version}") + compileClasspath(project(path: ":api", configuration: "dev")) } architectury { @@ -16,13 +16,15 @@ architectury { } remapJar { - afterEvaluate { - remapAccessWidener.set(false) - } + remapAccessWidener = false +} + +configurations { + dev } -java { - withSourcesJar() +remapJar { + classifier "raw" } task fakeJar(type: Jar, dependsOn: remapJar) { @@ -30,20 +32,25 @@ task fakeJar(type: Jar, dependsOn: remapJar) { from(rootProject.file("fake/fabric.mod.json")) { into "" } - archiveClassifier.set "fake" + classifier null +} + +artifacts { + dev(jar) + apiElements(fakeJar) + runtimeElements(fakeJar) +} + +afterEvaluate { + configurations.apiElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } + configurations.runtimeElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } } publishing { publications { mavenCommon(MavenPublication) { artifactId = rootProject.name + "-" + project.name - artifact(fakeJar) { classifier null } - afterEvaluate { - artifact(remapSourcesJar.output) { - builtBy remapSourcesJar - classifier "sources" - } - } + from components.java } } } diff --git a/fabric/build.gradle b/fabric/build.gradle index c182229c0..6d42ecee2 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -2,15 +2,19 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" } -configurations { - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. -} - architectury { platformSetupLoomIde() fabric() } +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common +} + processResources { filesMatching("fabric.mod.json") { expand "version": project.version @@ -19,26 +23,23 @@ processResources { } loom { - accessWidener = file("src/main/resources/roughlyenoughitems.accessWidener") + accessWidenerPath = file("src/main/resources/roughlyenoughitems.accessWidener") } def depProjects = [":api", ":runtime", ":default-plugin"] dependencies { modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}") - modRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") + modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") { exclude(module: "fabric-api") } - modRuntime("com.terraformersmc:modmenu:${modmenu_version}") { - transitive(false) - } + modRuntime("com.terraformersmc:modmenu:${modmenu_version}") { transitive false } modApi("dev.architectury:architectury-fabric:${architectury_version}") depProjects.forEach { - implementation(project(path: it)) { transitive = false } - developmentFabric(project(path: it)) { transitive = false } - shadowCommon(project(path: it, configuration: "transformProductionFabric")) { transitive = false } + common(project(path: it, configuration: "dev")) { transitive false } + shadowCommon(project(path: it, configuration: "transformProductionFabric")) { transitive false } } } @@ -50,7 +51,7 @@ shadowJar { remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "fabric" + classifier null } jar { @@ -71,17 +72,17 @@ sourcesJar { } } +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + publishing { publications { mavenFabric(MavenPublication) { artifactId = rootProject.name + "-" + project.name - artifact(remapJar) { classifier null } - afterEvaluate { - artifact(remapSourcesJar.output) { - builtBy remapSourcesJar - classifier "sources" - } - } + from components.java } ["api", "default-plugin", "runtime"].forEach { projectName -> create(projectName + "Fabric", MavenPublication.class) { publication -> diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java index fae947dae..c44ae6a06 100644 --- a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java +++ b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java @@ -100,7 +100,7 @@ public class PluginDetectorImpl { loadPlugin(REIServerPlugin.class, ((PluginView<REIServerPlugin>) PluginManager.getServerInstance())::registerPlugin); if (FabricLoader.getInstance().isModLoaded("libblockattributes-fluids")) { try { - PluginView.getServerInstance().registerPlugin((REIServerPlugin) Class.forName("me.shedaniel.rei.impl.common.compat.LBASupportPlugin").getConstructor().newInstance()); + PluginView.getServerInstance().registerPlugin((REIServerPlugin) Class.forName("me.shedaniel.rei.impl.common.compat.FabricFluidAPISupportPlugin").getConstructor().newInstance()); } catch (Throwable throwable) { throwable.printStackTrace(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/compat/LBASupportPlugin.java b/fabric/src/main/java/me/shedaniel/rei/impl/common/compat/FabricFluidAPISupportPlugin.java index fac34a62b..651ff2821 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/compat/LBASupportPlugin.java +++ b/fabric/src/main/java/me/shedaniel/rei/impl/common/compat/FabricFluidAPISupportPlugin.java @@ -23,27 +23,39 @@ package me.shedaniel.rei.impl.common.compat; -import alexiil.mc.lib.attributes.fluid.FluidAttributes; -import alexiil.mc.lib.attributes.fluid.GroupedFluidInvView; -import alexiil.mc.lib.attributes.fluid.amount.FluidAmount; import dev.architectury.event.CompoundEventResult; -import dev.architectury.hooks.fluid.FluidStackHooks; +import dev.architectury.fluid.FluidStack; +import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.fluid.FluidSupportProvider; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.util.EntryStacks; +import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; +import net.fabricmc.fabric.api.transfer.v1.storage.Storage; +import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; +import net.minecraft.world.item.ItemStack; -public class LBASupportPlugin implements REIServerPlugin { +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +public class FabricFluidAPISupportPlugin implements REIServerPlugin { @Override public void registerFluidSupport(FluidSupportProvider support) { support.register(entry -> { - GroupedFluidInvView view = FluidAttributes.GROUPED_INV_VIEW.get(entry.getValue()); - if (view.getStoredFluids().size() > 0) - return CompoundEventResult.interruptTrue(view.getStoredFluids().stream() - .filter(fluidKey -> !fluidKey.isEmpty() && fluidKey.getRawFluid() != null) - .map(fluidKey -> { - FluidAmount amount = view.getAmount_F(fluidKey); - return EntryStacks.of(fluidKey.getRawFluid(), amount.mul(FluidStackHooks.bucketAmount()).asLong(1)); - })); + ItemStack stack = entry.getValue().copy(); + Storage<FluidVariant> storage = FluidStorage.ITEM.find(stack, ContainerItemContext.withInitial(stack)); + List<EntryStack<FluidStack>> result; + try (Transaction transaction = Transaction.openOuter()) { + result = StreamSupport.stream(storage.iterable(transaction).spliterator(), false) + .filter(view -> !view.isResourceBlank() && !view.getResource().isBlank()) + .map(view -> EntryStacks.of(FluidStack.create(view.getResource().getFluid(), view.getAmount(), view.getResource().getNbt()))) + .collect(Collectors.toList()); + } + if (!result.isEmpty()) { + return CompoundEventResult.interruptTrue(result.stream()); + } return CompoundEventResult.pass(); }); } diff --git a/forge/build.gradle b/forge/build.gradle index 0cd53cc9b..94be9b025 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -2,15 +2,19 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" } -configurations { - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. -} - architectury { platformSetupLoomIde() forge() } +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentForge.extendsFrom common +} + processResources { filesMatching("META-INF/mods.toml") { expand "version": project.version @@ -37,8 +41,10 @@ loom { } } - localMods { - // it.add(project(":jei-internals-workaround").sourceSets.main) + forge { + localMods { + // it.add(project(":jei-internals-workaround").sourceSets.main) + } } } @@ -49,17 +55,13 @@ dependencies { modApi("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}") modApi("dev.architectury:architectury-forge:${architectury_version}") - implementation(project(path: ":jei-compatibility-layer")) { transitive = false } - // implementation(project(path: ":jei-internals-workaround")) { transitive = false } - developmentForge(project(path: ":jei-compatibility-layer")) { transitive = false } - // developmentForge(project(path: ":jei-internals-workaround")) { transitive = false } - - shadowCommon(project(path: ":jei-compatibility-layer")) { transitive = false } + common(project(path: ":jei-compatibility-layer", configuration: "dev")) { transitive false } + shadowCommon(project(path: ":jei-compatibility-layer", configuration: "dev")) { transitive false } + // common(project(path: ":jei-internals-workaround")) { transitive = false } depProjects.forEach { - implementation(project(path: it)) { transitive = false } - developmentForge(project(path: it)) { transitive = false } - shadowCommon(project(path: it, configuration: "transformProductionForge")) { transitive = false } + common(project(path: it, configuration: "dev")) { transitive false } + shadowCommon(project(path: it, configuration: "transformProductionForge")) { transitive false } } // modRuntime("curse.maven:chiselsbits-231095:3176033") @@ -90,7 +92,7 @@ shadowJar { remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "forge" + classifier null } jar { @@ -111,17 +113,17 @@ sourcesJar { } } +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + publishing { publications { mavenFabric(MavenPublication) { artifactId = rootProject.name + "-" + project.name - artifact(remapJar) { classifier null } - afterEvaluate { - artifact(remapSourcesJar.output) { - builtBy remapSourcesJar - classifier "sources" - } - } + from components.java } ["api", "default-plugin"].forEach { projectName -> create(projectName + "Fabric", MavenPublication.class) { publication -> diff --git a/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java b/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java index 9ad85f452..7c47d1c84 100644 --- a/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java +++ b/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java @@ -42,9 +42,9 @@ public class DefaultClientPluginImpl { Set<Potion> potions = Sets.newLinkedHashSet(); for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) { for (PotionBrewing.Mix<Potion> mix : PotionBrewing.POTION_MIXES) { - IRegistryDelegate<Potion> from = mix.f_43532_; + IRegistryDelegate<Potion> from = mix.from; Ingredient ingredient = mix.ingredient; - IRegistryDelegate<Potion> to = mix.f_43534_; + IRegistryDelegate<Potion> to = mix.to; Ingredient base = Ingredient.of(Arrays.stream(container.getItems()) .map(ItemStack::copy) .map(stack -> PotionUtils.setPotion(stack, from.get()))); @@ -59,9 +59,9 @@ public class DefaultClientPluginImpl { } for (Potion potion : potions) { for (PotionBrewing.Mix<Item> mix : PotionBrewing.CONTAINER_MIXES) { - IRegistryDelegate<Item> from = mix.f_43532_; + IRegistryDelegate<Item> from = mix.from; Ingredient ingredient = mix.ingredient; - IRegistryDelegate<Item> to = mix.f_43534_; + IRegistryDelegate<Item> to = mix.to; Ingredient base = Ingredient.of(PotionUtils.setPotion(new ItemStack(from.get()), potion)); ItemStack output = PotionUtils.setPotion(new ItemStack(to.get()), potion); clientPlugin.registerBrewingRecipe(base, ingredient, output); diff --git a/gradle.properties b/gradle.properties index 8570b003f..910fad3b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ forge_version=37.0.18 fabricloader_version=0.11.6 cloth_config_version=5.0.37 modmenu_version=2.0.2 -fabric_api=0.39.2+1.17 -architectury_version=2.3.22 +fabric_api=0.40.8+1.17 +architectury_version=2.5.32 api_exculde= #api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,org.jetbrains:annotations,net.fabricmc.fabric-api:fabric diff --git a/runtime/build.gradle b/runtime/build.gradle index 44abf331b..76b4276b3 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -9,25 +9,26 @@ repositories { } loom { - accessWidener = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener") + accessWidenerPath = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener") } dependencies { modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}") - modCompileOnly("me.shedaniel.cloth:cloth-config:${cloth_config_version}") - modCompileOnly("dev.architectury:architectury:${architectury_version}") - compileOnly(project(path: ":api")) - modCompileOnly("alexiil.mc.lib:libblockattributes-fluids:0.8.3-pre.3") + modApi("me.shedaniel.cloth:cloth-config:${cloth_config_version}") + modApi("dev.architectury:architectury:${architectury_version}") + compileClasspath(project(path: ":api", configuration: "dev")) } remapJar { - afterEvaluate { - remapAccessWidener.set(false) - } + remapAccessWidener = false +} + +configurations { + dev } -java { - withSourcesJar() +remapJar { + classifier "raw" } task fakeJar(type: Jar, dependsOn: remapJar) { @@ -35,20 +36,25 @@ task fakeJar(type: Jar, dependsOn: remapJar) { from(rootProject.file("fake/fabric.mod.json")) { into "" } - archiveClassifier.set "fake" + classifier null +} + +artifacts { + dev(jar) + apiElements(fakeJar) + runtimeElements(fakeJar) +} + +afterEvaluate { + configurations.apiElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } + configurations.runtimeElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) } } publishing { publications { mavenCommon(MavenPublication) { artifactId = rootProject.name + "-" + project.name - artifact(fakeJar) { classifier null } - afterEvaluate { - artifact(remapSourcesJar.output) { - builtBy remapSourcesJar - classifier "sources" - } - } + from components.java } } } |
