|
| 1 | +plugins { |
| 2 | + id 'java-library' |
| 3 | + id "maven-publish" |
| 4 | + id("xyz.jpenilla.run-paper") version "1.0.6" |
| 5 | +} |
| 6 | + |
| 7 | + |
| 8 | +// Plugin config |
| 9 | +ext.pluginNameUpper = "HamsterEcoHelper" |
| 10 | +ext.pluginNameLower = ext.pluginNameUpper.toLowerCase() |
| 11 | +ext.majorVersion = 9 |
| 12 | +ext.minorVersion = 0 |
| 13 | +ext.minecraftVersion = "1.18.1" |
| 14 | +sourceCompatibility = 17 |
| 15 | +targetCompatibility = 17 |
| 16 | + |
| 17 | +// Suppiled by Jenkins |
| 18 | +ext.buildNumber = System.env.BUILD_NUMBER == null ? "x" : "$System.env.BUILD_NUMBER" |
| 19 | +ext.mavenDirectory = System.env.MAVEN_DIR == null ? "$projectDir/repo" : "$System.env.MAVEN_DIR" |
| 20 | +ext.jdDirectory = System.env.JAVADOCS_DIR == null ? null : "$System.env.JAVADOCS_DIR" |
| 21 | + |
| 22 | +// Version used for distribution. Different from maven repo |
| 23 | +group = "cat.nyaa" |
| 24 | +archivesBaseName = "${pluginNameUpper}-mc$minecraftVersion" |
| 25 | +version = "$majorVersion.$minorVersion.$buildNumber".toString() |
| 26 | + |
| 27 | +runServer { |
| 28 | + minecraftVersion("1.18.1") |
| 29 | +} |
| 30 | + |
| 31 | +// Repositories and dependencies |
| 32 | +repositories { |
| 33 | + mavenCentral() |
| 34 | + maven { url "https://repo.dmulloy2.net/repository/public/" } |
| 35 | + maven { name 'Spigot'; url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } |
| 36 | + maven { name 'Sonatype'; url 'https://oss.sonatype.org/content/groups/public' } |
| 37 | + maven { name 'NyaaCat'; url 'https://ci.nyaacat.com/maven/' } |
| 38 | + maven { name 'EssentialsX'; url 'https://repo.essentialsx.net/releases/'} |
| 39 | + maven { name "papermc"; url 'https://papermc.io/repo/repository/maven-public/'} |
| 40 | + maven { name 'aikar'; url 'https://repo.aikar.co/content/groups/aikar/' } |
| 41 | + maven { name 'jitpack'; url 'https://jitpack.io' } |
| 42 | +} |
| 43 | + |
| 44 | +dependencies { |
| 45 | + implementation 'org.jetbrains:annotations:22.0.0' |
| 46 | + compileOnly "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT" |
| 47 | + |
| 48 | + // other nyaa plugins |
| 49 | + if (gradle.hasProperty("useLocalDependencies") && gradle.useLocalDependencies) { |
| 50 | + compileOnly project(":NyaaCore") |
| 51 | + compileOnly project(":LockettePro") |
| 52 | + } else { |
| 53 | + compileOnly('cat.nyaa:nyaacore:9.0-SNAPSHOT') { transitive = true } |
| 54 | + compileOnly('me.crafter.mc:lockettepro:2.10-SNAPSHOT') { transitive = false } |
| 55 | + } |
| 56 | + |
| 57 | + // 3rd party plugins |
| 58 | + compileOnly ('com.github.MilkBowl:VaultAPI:1.7') |
| 59 | + compileOnly ('net.essentialsx:EssentialsX:2.19.0') |
| 60 | +} |
| 61 | + |
| 62 | +// source file modification (modify version string) |
| 63 | +processResources { |
| 64 | + filesMatching("**/plugin.yml") { |
| 65 | + expand 'version': project.version |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +// source file jar |
| 70 | +task sourcesJar(type: Jar) { |
| 71 | + archiveClassifier.set("sources") |
| 72 | + from sourceSets.main.allSource |
| 73 | +} |
| 74 | + |
| 75 | +// javadoc generation options |
| 76 | +javadoc { |
| 77 | + // javadoc output folder |
| 78 | + if (project.jdDirectory != null) destinationDir = file("${jdDirectory}/${pluginNameLower}-${version}") |
| 79 | + (options as StandardJavadocDocletOptions).with { |
| 80 | + links 'https://docs.oracle.com/en/java/javase/16/docs/api/' |
| 81 | + links 'https://hub.spigotmc.org/javadocs/spigot/' |
| 82 | + links 'https://google.github.io/guava/releases/21.0/api/docs/' |
| 83 | + links 'https://ci.md-5.net/job/BungeeCord/ws/chat/target/apidocs/' |
| 84 | + |
| 85 | + locale 'en_US' |
| 86 | + encoding 'UTF-8' |
| 87 | + docEncoding 'UTF-8' |
| 88 | + addBooleanOption('keywords', true) |
| 89 | + addStringOption('Xdoclint:none', '-quiet') |
| 90 | + |
| 91 | + addBooleanOption('html5', true) |
| 92 | + |
| 93 | + windowTitle = "${pluginNameUpper} Javadoc" |
| 94 | + docTitle = "${pluginNameUpper} (mc$minecraftVersion-${project.version})" |
| 95 | + } |
| 96 | +} |
| 97 | + |
| 98 | +// javadoc jar |
| 99 | +task javadocJar(type: Jar, dependsOn: javadoc) { |
| 100 | + archiveClassifier.set("javadoc") |
| 101 | + from javadoc.destinationDir |
| 102 | +} |
| 103 | + |
| 104 | +// compile options |
| 105 | +compileJava { |
| 106 | + options.compilerArgs += ["-Xlint:deprecation"] |
| 107 | +} |
| 108 | + |
| 109 | +// maven publish |
| 110 | +publishing { |
| 111 | + publications { |
| 112 | + mavenJava(MavenPublication) { |
| 113 | + group project.group |
| 114 | + artifactId pluginNameLower |
| 115 | + version "$majorVersion.$minorVersion-SNAPSHOT" |
| 116 | + |
| 117 | + from components.java |
| 118 | + artifact sourcesJar |
| 119 | + artifact javadocJar |
| 120 | + } |
| 121 | + } |
| 122 | + repositories { |
| 123 | + maven { |
| 124 | + url mavenDirectory |
| 125 | + } |
| 126 | + } |
| 127 | +} |
| 128 | + |
0 commit comments