|
| 1 | +import java.lang.Runtime |
| 2 | + |
| 3 | +plugins { |
| 4 | + `java-library` |
| 5 | + jacoco |
| 6 | + alias(libs.plugins.org.sonarqube) |
| 7 | +} |
| 8 | + |
| 9 | +repositories { |
| 10 | + mavenCentral() |
| 11 | + maven("https://repo.papermc.io/repository/maven-public/") |
| 12 | + maven("https://jitpack.io/") |
| 13 | +} |
| 14 | + |
| 15 | +val mockitoAgent = configurations.create("mockitoAgent") |
| 16 | + |
| 17 | +dependencies { |
| 18 | + implementation(libs.org.jetbrains.annotations) |
| 19 | + implementation(libs.io.papermc.paper.paper.api) |
| 20 | + implementation(libs.com.github.jikoo.planarwrappers) |
| 21 | + |
| 22 | + testImplementation(libs.org.hamcrest.hamcrest) |
| 23 | + testImplementation(libs.org.mockito.mockito.core) |
| 24 | + mockitoAgent(libs.org.mockito.mockito.core) { isTransitive = false } |
| 25 | + testImplementation(libs.com.jparams.to.string.verifier) |
| 26 | +} |
| 27 | + |
| 28 | +group = "com.github.jikoo" |
| 29 | +version = "3.0.0-SNAPSHOT" |
| 30 | +description = "A customizable system mimicking vanilla Minecraft's enchanting functionality." |
| 31 | + |
| 32 | +tasks.withType<JavaCompile>() { |
| 33 | + options.release = 21 |
| 34 | + options.encoding = "UTF-8" |
| 35 | +} |
| 36 | + |
| 37 | +tasks.withType<Javadoc>() { |
| 38 | + options.encoding = "UTF-8" |
| 39 | +} |
| 40 | + |
| 41 | +testing { |
| 42 | + suites { |
| 43 | + named<JvmTestSuite>("test") { |
| 44 | + useJUnitJupiter("6.0.2") |
| 45 | + } |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +tasks.test { |
| 50 | + useJUnitPlatform() |
| 51 | + |
| 52 | + // Use as many cores as possible to run tests. |
| 53 | + maxParallelForks = Runtime.getRuntime().availableProcessors() |
| 54 | + // As Bukkit is very heavily statically initialized, don't reuse forks. |
| 55 | + forkEvery = 1 |
| 56 | + jvmArgs("-Xshare:off", "-javaagent:${mockitoAgent.asPath}") |
| 57 | + |
| 58 | + // Generate coverage reports |
| 59 | + finalizedBy(tasks.jacocoTestReport) |
| 60 | +} |
| 61 | + |
| 62 | +tasks.jacocoTestReport { |
| 63 | + reports { |
| 64 | + // Produce XML report for Sonar |
| 65 | + xml.required = true |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +sonar { |
| 70 | + properties { |
| 71 | + property("sonar.projectKey", "Jikoo_PlanarEnchanting") |
| 72 | + property("sonar.organization", "jikoo") |
| 73 | + property("sonar.host.url", "https://sonarcloud.io") |
| 74 | + property("sonar.language", "java") |
| 75 | + property("sonar.java.coveragePlugin", "jacoco") |
| 76 | + property("sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml") |
| 77 | + } |
| 78 | +} |
0 commit comments