plugins { id 'org.cadixdev.licenser' version '0.6.1' id 'org.ajoberstar.grgit' version '5.2.1' id 'maven-publish' id 'java' } group 'org.inksnow.husk' version "1.1.2${versionMetadata()}" defaultTasks 'licenseFormat', 'build' repositories { mavenCentral() maven { url 'https://repo.william278.net/releases/' } } dependencies { compileOnly 'net.william278:minedown:1.8.2' compileOnly 'org.jetbrains:annotations:24.1.0' testImplementation 'net.william278:minedown:1.8.2' testImplementation 'net.kyori:adventure-platform-bukkit:4.3.2' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2' } logger.lifecycle("Building PagineDown ${version} by William278") version rootProject.version archivesBaseName = "${rootProject.name}" tasks { compileJava { options.encoding = 'UTF-8' options.release.set(8) } jar { manifest { attributes('Automatic-Module-Name': 'net.william278.paginedown') } } } license { header = rootProject.file('HEADER') include '**/*.java' newLine = true } javadoc { options.encoding = 'UTF-8' options.addStringOption('Xdoclint:none', '-quiet') } java { withSourcesJar() withJavadocJar() } jar.dependsOn(sourcesJar) jar.dependsOn(javadocJar) test { useJUnitPlatform() } publishing { repositories { maven { name = 'husk-release' url = findProperty("repository.huskrelease.url") credentials { username = findProperty("repository.huskrelease.username") password = findProperty("repository.huskrelease.password") } } } publications { mavenJava(MavenPublication) { groupId = 'org.inksnow.husk' artifactId = 'paginedown' version = "$rootProject.version" artifact jar artifact javadocJar artifact sourcesJar } } } @SuppressWarnings('GrMethodMayBeStatic') def versionMetadata() { // Get if there is a tag for this commit def tag = grgit.tag.list().find { it.commit.id == grgit.head().id } if (tag != null) { return '' } // Otherwise, get the last commit hash and if it's a clean head if (grgit == null) { return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown' } return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev') }