|
1 | | - |
2 | 1 | plugins { |
3 | | - java |
| 2 | + `java-library` |
| 3 | + signing |
| 4 | + `maven-publish` |
| 5 | + id("net.minecrell.licenser") version "0.4.1" |
4 | 6 | } |
5 | 7 |
|
6 | 8 | group = "com.demonwav.mcdev" |
7 | 9 |
|
8 | 10 | java { |
9 | 11 | sourceCompatibility = JavaVersion.VERSION_1_8 |
10 | 12 | targetCompatibility = JavaVersion.VERSION_1_8 |
| 13 | + withSourcesJar() |
| 14 | + withJavadocJar() |
| 15 | +} |
| 16 | + |
| 17 | +license { |
| 18 | + header = file("header.txt") |
| 19 | +} |
| 20 | + |
| 21 | +val isSnapshot = version.toString().endsWith("-SNAPSHOT") |
| 22 | + |
| 23 | +publishing { |
| 24 | + publications { |
| 25 | + register<MavenPublication>("mavenJava") { |
| 26 | + groupId = project.group.toString() |
| 27 | + artifactId = project.name |
| 28 | + version = project.version.toString() |
| 29 | + |
| 30 | + from(components["java"]) |
| 31 | + withoutBuildIdentifier() |
| 32 | + |
| 33 | + pom { |
| 34 | + val repoUrl = "https://github.com/minecraft-dev/annotations" |
| 35 | + |
| 36 | + name.set("Minecraft Dev Annotations") |
| 37 | + description.set("Annotations for the Minecraft Development for IntelliJ plugin to assist with static code analysis.") |
| 38 | + url.set(repoUrl) |
| 39 | + inceptionYear.set("2020") |
| 40 | + packaging = "jar" |
| 41 | + |
| 42 | + licenses { |
| 43 | + license { |
| 44 | + name.set("MIT") |
| 45 | + url.set("$repoUrl/blob/master/license.txt") |
| 46 | + distribution.set("repo") |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + issueManagement { |
| 51 | + system.set("GitHub") |
| 52 | + url.set("$repoUrl/issues") |
| 53 | + } |
| 54 | + |
| 55 | + developers { |
| 56 | + developer { |
| 57 | + id.set("DemonWav") |
| 58 | + name.set("Kyle Wood") |
| 59 | + email.set("demonwav@gmail.com") |
| 60 | + url.set("https://github.com/DemonWav") |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + scm { |
| 65 | + url.set(repoUrl) |
| 66 | + connection.set("scm:git:$repoUrl.git") |
| 67 | + developerConnection.set(connection) |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + |
| 72 | + repositories { |
| 73 | + val url = if (isSnapshot) { |
| 74 | + "https://oss.sonatype.org/content/repositories/snapshots/" |
| 75 | + } else { |
| 76 | + "https://oss.sonatype.org/service/local/staging/deploy/maven2/" |
| 77 | + } |
| 78 | + maven(url) { |
| 79 | + credentials(PasswordCredentials::class) |
| 80 | + name = "osshr" |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | +} |
| 85 | + |
| 86 | +signing { |
| 87 | + useGpgCmd() |
| 88 | + sign(publishing.publications["mavenJava"]) |
| 89 | +} |
| 90 | + |
| 91 | +tasks.withType<Sign> { |
| 92 | + onlyIf { !isSnapshot } |
11 | 93 | } |
0 commit comments