diff options
author | Matyrobbrt <matyrobbrt@gmail.com> | 2023-05-01 12:00:13 +0300 |
---|---|---|
committer | Matyrobbrt <matyrobbrt@gmail.com> | 2023-05-01 12:00:13 +0300 |
commit | 4d6cf31fbad5d043de2ac248538015a14875e00f (patch) | |
tree | 0f9eaddf3a9d8fd211eb730da3b8e6f3d8a36283 | |
parent | 2dcca2fbd97c3b302bb6fc4a5afd181573b8ce8b (diff) | |
download | Artifactural-4d6cf31fbad5d043de2ac248538015a14875e00f.tar.gz Artifactural-4d6cf31fbad5d043de2ac248538015a14875e00f.tar.bz2 Artifactural-4d6cf31fbad5d043de2ac248538015a14875e00f.zip |
Add dependencies to published pom
-rw-r--r-- | build.gradle | 20 | ||||
-rw-r--r-- | buildSrc/src/main/groovy/net/minecraftforge/artifactural/buildscript/SoftwareComponentFactoryGrabber.groovy | 35 |
2 files changed, 50 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle index 3b956ca..ac32a6e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import net.minecraftforge.artifactural.buildscript.JarTransformationTask +import net.minecraftforge.artifactural.buildscript.SoftwareComponentFactoryGrabber import org.objectweb.asm.Label import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.InsnNode @@ -171,16 +172,25 @@ license { header = file("$rootDir/LICENSE-header.txt") } -artifacts { - archives tasks.named('transformJar').flatMap { it.outputFile } +configurations.runtimeElements.outgoing { + it.artifacts.removeIf { + (it.classifier == null || it.classifier.blank) && it.extension == 'jar' // Remove the jar artifact as we want to replace it with the transformed one + } + it.artifact(tasks.named('transformJar').flatMap { it.outputFile }) { + classifier = null + } +} + +final transformed = project.objects.newInstance(SoftwareComponentFactoryGrabber).softwareComponentFactory.adhoc('transformed') +project.components.add(transformed) +transformed.addVariantsFromConfiguration(configurations.runtimeElements) { + mapToMavenScope 'runtime' } publishing { publications.create("mavenJava", MavenPublication) { + from components.transformed artifact sourcesJar - artifact(tasks.named('transformJar').flatMap { it.outputFile }) { - classifier = null - } pom { groupId = project.group version = project.version diff --git a/buildSrc/src/main/groovy/net/minecraftforge/artifactural/buildscript/SoftwareComponentFactoryGrabber.groovy b/buildSrc/src/main/groovy/net/minecraftforge/artifactural/buildscript/SoftwareComponentFactoryGrabber.groovy new file mode 100644 index 0000000..ef6d4e0 --- /dev/null +++ b/buildSrc/src/main/groovy/net/minecraftforge/artifactural/buildscript/SoftwareComponentFactoryGrabber.groovy @@ -0,0 +1,35 @@ +/* + * Artifactural + * Copyright (c) 2018-2021. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.artifactural.buildscript + +import groovy.transform.CompileStatic +import org.gradle.api.component.SoftwareComponentFactory + +import javax.inject.Inject + +@CompileStatic +class SoftwareComponentFactoryGrabber { + final SoftwareComponentFactory softwareComponentFactory + + @Inject + SoftwareComponentFactoryGrabber(SoftwareComponentFactory softwareComponentFactory) { + this.softwareComponentFactory = softwareComponentFactory + } +} |