|
| 1 | +/* |
| 2 | + * Copyright (c) 2024-2025 OnixByte |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | + * of this software and associated documentation files (the "Software"), to deal |
| 6 | + * in the Software without restriction, including without limitation the rights |
| 7 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | + * copies of the Software, and to permit persons to whom the Software is |
| 9 | + * furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in all |
| 12 | + * copies or substantial portions of the Software. |
| 13 | + * |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | + * SOFTWARE. |
| 21 | + */ |
| 22 | + |
| 23 | +import java.net.URI |
| 24 | + |
| 25 | +plugins { |
| 26 | + java |
| 27 | + id("java-library") |
| 28 | + id("maven-publish") |
| 29 | + id("signing") |
| 30 | +} |
| 31 | + |
| 32 | +val artefactVersion: String by project |
| 33 | +val projectUrl: String by project |
| 34 | +val projectGithubUrl: String by project |
| 35 | +val licenseName: String by project |
| 36 | +val licenseUrl: String by project |
| 37 | + |
| 38 | +group = "com.onixbyte" |
| 39 | +version = artefactVersion |
| 40 | + |
| 41 | +repositories { |
| 42 | + mavenCentral() |
| 43 | +} |
| 44 | + |
| 45 | +java { |
| 46 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 47 | + targetCompatibility = JavaVersion.VERSION_17 |
| 48 | + withSourcesJar() |
| 49 | + withJavadocJar() |
| 50 | +} |
| 51 | + |
| 52 | +tasks.withType<JavaCompile> { |
| 53 | + options.encoding = "UTF-8" |
| 54 | +} |
| 55 | + |
| 56 | +tasks.withType<Jar> { |
| 57 | + exclude("logback.xml") |
| 58 | +} |
| 59 | + |
| 60 | +dependencies { |
| 61 | + compileOnly(libs.slf4j) |
| 62 | + implementation(libs.logback) |
| 63 | + testImplementation(platform(libs.junit.bom)) |
| 64 | + testImplementation(libs.junit.jupiter) |
| 65 | +} |
| 66 | + |
| 67 | +tasks.test { |
| 68 | + useJUnitPlatform() |
| 69 | +} |
| 70 | + |
| 71 | +publishing { |
| 72 | + publications { |
| 73 | + create<MavenPublication>("tuple") { |
| 74 | + groupId = group.toString() |
| 75 | + artifactId = "tuple" |
| 76 | + version = artefactVersion |
| 77 | + |
| 78 | + pom { |
| 79 | + name = "OnixByte Tuple" |
| 80 | + description = |
| 81 | + "The tuple module is designed to offer a convenient and efficient way to handle grouped data." |
| 82 | + url = projectUrl |
| 83 | + |
| 84 | + licenses { |
| 85 | + license { |
| 86 | + name = licenseName |
| 87 | + url = licenseUrl |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + scm { |
| 92 | + connection = "scm:git:git://github.com:onixbyte/onixbyte-toolbox.git" |
| 93 | + developerConnection = "scm:git:git://github.com:onixbyte/onixbyte-toolbox.git" |
| 94 | + url = projectGithubUrl |
| 95 | + } |
| 96 | + |
| 97 | + developers { |
| 98 | + developer { |
| 99 | + id = "zihluwang" |
| 100 | + name = "Zihlu Wang" |
| 101 | + email = "really@zihlu.wang" |
| 102 | + timezone = "Asia/Hong_Kong" |
| 103 | + } |
| 104 | + |
| 105 | + developer { |
| 106 | + id = "siujamo" |
| 107 | + name = "Siu Jam'o" |
| 108 | + email = "jamo.siu@outlook.com" |
| 109 | + timezone = "Asia/Shanghai" |
| 110 | + } |
| 111 | + } |
| 112 | + } |
| 113 | + |
| 114 | + from(components["java"]) |
| 115 | + |
| 116 | + signing { |
| 117 | + sign(publishing.publications["tuple"]) |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + repositories { |
| 122 | + maven { |
| 123 | + name = "sonatypeNexus" |
| 124 | + url = URI(providers.gradleProperty("repo.maven-central.host").get()) |
| 125 | + credentials { |
| 126 | + username = providers.gradleProperty("repo.maven-central.username").get() |
| 127 | + password = providers.gradleProperty("repo.maven-central.password").get() |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | +} |
0 commit comments