|
| 1 | +plugins { |
| 2 | + id 'java-library' |
| 3 | + id 'maven-publish' |
| 4 | + id 'com.github.johnrengelman.shadow' version '8.1.1' |
| 5 | +} |
| 6 | + |
| 7 | +group = 'com.comphenix.protocol' |
| 8 | +version = '5.0.0-SNAPSHOT' |
| 9 | +description = 'Provides access to the Minecraft protocol' |
| 10 | + |
| 11 | +def isSnapshot = version.endsWith('-SNAPSHOT') |
| 12 | + |
| 13 | +repositories { |
| 14 | + // mavenLocal() // can speed up build, but may fail in CI |
| 15 | + mavenCentral() |
| 16 | + |
| 17 | + maven { |
| 18 | + url 'https://repo.dmulloy2.net/repository/public/' |
| 19 | + } |
| 20 | + |
| 21 | + maven { |
| 22 | + url 'https://hub.spigotmc.org/nexus/content/groups/public/' |
| 23 | + } |
| 24 | + |
| 25 | + maven { |
| 26 | + url 'https://libraries.minecraft.net/' |
| 27 | + metadataSources { |
| 28 | + mavenPom() |
| 29 | + artifact() |
| 30 | + ignoreGradleMetadataRedirection() |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +dependencies { |
| 36 | + implementation 'net.bytebuddy:byte-buddy:1.14.3' |
| 37 | + compileOnly 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT' |
| 38 | + compileOnly 'org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT' |
| 39 | + compileOnly 'io.netty:netty-all:4.0.23.Final' |
| 40 | + compileOnly 'net.kyori:adventure-text-serializer-gson:4.13.0' |
| 41 | + compileOnly 'com.googlecode.json-simple:json-simple:1.1.1' |
| 42 | + |
| 43 | + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2' |
| 44 | + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' |
| 45 | + testImplementation 'org.mockito:mockito-core:4.11.0' |
| 46 | + testImplementation 'org.mockito:mockito-inline:4.11.0' |
| 47 | + testImplementation 'io.netty:netty-common:4.1.77.Final' |
| 48 | + testImplementation 'io.netty:netty-transport:4.1.77.Final' |
| 49 | + testImplementation 'org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT' |
| 50 | +} |
| 51 | + |
| 52 | +java { |
| 53 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 54 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 55 | + |
| 56 | + withJavadocJar() |
| 57 | + withSourcesJar() |
| 58 | +} |
| 59 | + |
| 60 | +shadowJar { |
| 61 | + dependencies { |
| 62 | + include(dependency('net.bytebuddy:byte-buddy:.*')) |
| 63 | + } |
| 64 | + relocate 'net.bytebuddy', 'com.comphenix.net.bytebuddy' |
| 65 | + archiveFileName = 'ProtocolLib.jar' |
| 66 | +} |
| 67 | + |
| 68 | +test { |
| 69 | + useJUnitPlatform() |
| 70 | +} |
| 71 | + |
| 72 | +processResources { |
| 73 | + def includeBuild = isSnapshot && System.getenv('BUILD_NUMBER') |
| 74 | + def fullVersion = includeBuild |
| 75 | + ? version + '-' + System.getenv('BUILD_NUMBER') |
| 76 | + : version |
| 77 | + |
| 78 | + eachFile { expand(['version': fullVersion]) } |
| 79 | +} |
| 80 | + |
| 81 | +publishing { |
| 82 | + publications { |
| 83 | + mavenJava(MavenPublication) { |
| 84 | + from components.java |
| 85 | + |
| 86 | + afterEvaluate { |
| 87 | + artifactId = 'ProtocolLib' |
| 88 | + } |
| 89 | + } |
| 90 | + } |
| 91 | + |
| 92 | + repositories { |
| 93 | + maven { |
| 94 | + url isSnapshot |
| 95 | + ? 'https://repo.dmulloy2.net/repository/snapshots/' |
| 96 | + : 'https://repo.dmulloy2.net/repository/releases/' |
| 97 | + |
| 98 | + credentials { |
| 99 | + username project.nexusUsername |
| 100 | + password project.nexusPassword |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | +} |
| 105 | + |
| 106 | +tasks.withType(JavaCompile) { |
| 107 | + options.encoding = 'UTF-8' |
| 108 | +} |
| 109 | + |
| 110 | +tasks.withType(Javadoc) { |
| 111 | + options.encoding = 'UTF-8' |
| 112 | +} |
0 commit comments