plugins { id "java-library" id "maven-publish" id "net.kyori.blossom" version "1.3.1" } java.toolchain.languageVersion = JavaLanguageVersion.of(8) compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8" group = project.maven_group archivesBaseName = project.maven_name version = project.maven_version repositories { mavenCentral() maven { name = "ViaVersion" url "https://repo.viaversion.com" } } dependencies { compileOnly "com.viaversion:viaversion:4.8.0-23w31a-SNAPSHOT" compileOnly("com.viaversion:viabackwards-common:4.8.0-23w31a-SNAPSHOT") { exclude group: "com.viaversion", module: "viaversion" } compileOnly "org.yaml:snakeyaml:2.1" } blossom { replaceToken("\${version}", project.version, "src/main/java/net/raphimc/viaaprilfools/ViaAprilFools.java") replaceToken("\${impl_version}", "git-${project.archivesBaseName}-${project.version}:${latestCommitHash()}", "src/main/java/net/raphimc/viaaprilfools/ViaAprilFools.java") } java { withSourcesJar() withJavadocJar() } jar { from("LICENSE") { rename { "${it}_${project.archivesBaseName}" } } } publishing { repositories { maven { name = "Via" url = "https://repo.viaversion.com/" credentials(PasswordCredentials) authentication { basic(BasicAuthentication) } } } publications { maven(MavenPublication) { groupId = project.maven_group artifactId = project.maven_name version = project.maven_version from components.java pom { name = "ViaAprilFools" description = "ViaVersion addon to add support for some notable Minecraft snapshots" url = "https://github.com/ViaVersion/ViaAprilFools" licenses { license { name = "GPL-3.0 License" url = "https://github.com/ViaVersion/ViaAprilFools/blob/main/LICENSE" } } developers { developer { id = "RK_01" } } scm { connection = "scm:git:git://github.com/ViaVersion/ViaAprilFools.git" developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaAprilFools.git" url = "https://github.com/ViaVersion/ViaAprilFools.git" } } } } } String latestCommitHash() { def stdout = new ByteArrayOutputStream() exec { commandLine "git", "rev-parse", "--short", "HEAD" standardOutput = stdout } return stdout.toString().trim() }