|
| 1 | +plugins { |
| 2 | + id 'java' |
| 3 | + id 'signing' |
| 4 | + id 'maven-publish' |
| 5 | + id 'com.gradleup.nmcp' version '0.1.5' |
| 6 | +} |
| 7 | + |
| 8 | +version = '0.10.5' + (project.hasProperty("version_snapshot") ? "-SNAPSHOT" : "") |
| 9 | +group = 'io.github.cdagaming' |
| 10 | +description = 'Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate' |
| 11 | +base.archivesName = 'DiscordIPC' |
| 12 | + |
| 13 | +JavaVersion targetVersion = JavaVersion.VERSION_1_8 |
| 14 | +int targetVersionInt = Integer.parseInt(targetVersion.majorVersion) |
| 15 | + |
| 16 | +[java].each { |
| 17 | + it.toolchain { |
| 18 | + languageVersion.set(JavaLanguageVersion.of(targetVersionInt)) |
| 19 | + } |
| 20 | + it.withSourcesJar() |
| 21 | + it.withJavadocJar() |
| 22 | +} |
| 23 | + |
| 24 | +repositories { |
| 25 | + mavenCentral() |
| 26 | +} |
| 27 | + |
| 28 | +dependencies { |
| 29 | + implementation group: 'com.google.code.gson', name: 'gson', version: '2.13.1' |
| 30 | + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17' |
| 31 | + implementation group: 'com.kohlschutter.junixsocket', name: 'junixsocket-common', version: '2.10.1' |
| 32 | + implementation group: 'com.kohlschutter.junixsocket', name: 'junixsocket-native-common', version: '2.10.1' |
| 33 | + implementation group: 'net.lenni0451', name: 'Reflect', version: '1.5.0' |
| 34 | +} |
| 35 | + |
| 36 | +jar.manifest.mainAttributes([ |
| 37 | + 'Implementation-Title' : project.name, |
| 38 | + 'Implementation-Version': project.version |
| 39 | +]) |
| 40 | + |
| 41 | +[compileJava].each { |
| 42 | + it.options.encoding = 'UTF-8' |
| 43 | + it.options.deprecation = true |
| 44 | + it.options.fork = true |
| 45 | +} |
| 46 | + |
| 47 | +publishing { |
| 48 | + publications { |
| 49 | + mavenJava(MavenPublication) { |
| 50 | + from components.java |
| 51 | + |
| 52 | + pom { |
| 53 | + name = rootProject.name |
| 54 | + artifactId = rootProject.name |
| 55 | + packaging = 'jar' |
| 56 | + description = project.description |
| 57 | + url = 'https://github.com/CDAGaming/DiscordIPC' |
| 58 | + |
| 59 | + scm { |
| 60 | + connection = 'scm:git:git://github.com/CDAGaming/DiscordIPC.git' |
| 61 | + developerConnection = 'scm:git:ssh://github.com/CDAGaming/DiscordIPC.git' |
| 62 | + url = 'https://github.com/CDAGaming/DiscordIPC' |
| 63 | + } |
| 64 | + licenses { |
| 65 | + license { |
| 66 | + name = 'Apache License 2.0' |
| 67 | + url = 'https://github.com/CDAGaming/DiscordIPC/blob/master/LICENSE' |
| 68 | + } |
| 69 | + } |
| 70 | + developers { |
| 71 | + developer { |
| 72 | + id = 'cdagaming' |
| 73 | + name = 'CDAGaming' |
| 74 | + email = 'cstack2011@yahoo.com' |
| 75 | + } |
| 76 | + developer { |
| 77 | + id = 'jagrosh' |
| 78 | + name = 'John Grosh' |
| 79 | + email = 'j@gro.sh' |
| 80 | + } |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | + repositories { |
| 86 | + maven { |
| 87 | + credentials { |
| 88 | + username = project.findProperty("mvn.user") ?: System.getenv("OSSRH_USERNAME") |
| 89 | + password = project.findProperty("mvn.key") ?: System.getenv("OSSRH_PASSWORD") |
| 90 | + } |
| 91 | + |
| 92 | + def releasesRepoUrl = "" |
| 93 | + def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/" |
| 94 | + url = version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
| 95 | + } |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +nmcp { |
| 100 | + centralPortal { |
| 101 | + username = project.findProperty("mvn.user") ?: System.getenv("OSSRH_USERNAME") |
| 102 | + password = project.findProperty("mvn.key") ?: System.getenv("OSSRH_PASSWORD") |
| 103 | + publishingType = "USER_MANAGED" |
| 104 | + } |
| 105 | +} |
| 106 | + |
| 107 | +signing { |
| 108 | + useGpgCmd() |
| 109 | + sign publishing.publications.mavenJava |
| 110 | +} |
0 commit comments