|
| 1 | +plugins { |
| 2 | + `java-library` |
| 3 | + `maven-publish` |
| 4 | + signing |
| 5 | + jacoco |
| 6 | +} |
| 7 | + |
| 8 | +group = "org.libtorrent4j" |
| 9 | +version = "1.3.0" |
| 10 | + |
| 11 | +java { |
| 12 | + withJavadocJar() |
| 13 | + withSourcesJar() |
| 14 | +} |
| 15 | + |
| 16 | +val codacy: Configuration by configurations.creating |
| 17 | + |
| 18 | +repositories { |
| 19 | + mavenCentral() |
| 20 | +} |
| 21 | + |
| 22 | +dependencies { |
| 23 | + |
| 24 | + testImplementation("junit:junit:4.12") |
| 25 | + |
| 26 | + codacy("com.codacy:codacy-coverage-reporter:7.1.0") |
| 27 | +} |
| 28 | + |
| 29 | +configure<JavaPluginConvention> { |
| 30 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 31 | + targetCompatibility = JavaVersion.VERSION_11 |
| 32 | +} |
| 33 | + |
| 34 | +tasks.test { |
| 35 | + testLogging { |
| 36 | + events("passed", "skipped", "failed") |
| 37 | + } |
| 38 | + |
| 39 | + environment("LD_LIBRARY_PATH", File(".").absolutePath) |
| 40 | +} |
| 41 | + |
| 42 | +tasks.withType<GenerateModuleMetadata> { |
| 43 | + enabled = false |
| 44 | +} |
| 45 | + |
| 46 | +publishing { |
| 47 | + publications { |
| 48 | + create<MavenPublication>("mavenJava") { |
| 49 | + artifactId = "libtorrent4j" |
| 50 | + from(components["java"]) |
| 51 | + pom { |
| 52 | + name.set("libtorrent4j") |
| 53 | + description.set("A swig Java interface for libtorrent") |
| 54 | + url.set("https://github.com/aldenml/libtorrent4j") |
| 55 | + scm { |
| 56 | + connection.set("scm:git:git://github.com/aldenml/libtorrent4j.git") |
| 57 | + developerConnection.set( "scm:git:ssh:[email protected]/aldenml/libtorrent4j.git") |
| 58 | + url.set("https://github.com/aldenml/libtorrent4j") |
| 59 | + } |
| 60 | + licenses { |
| 61 | + license { |
| 62 | + name.set("The MIT License") |
| 63 | + url.set("https://github.com/aldenml/libtorrent4j/blob/master/LICENSE.md") |
| 64 | + } |
| 65 | + } |
| 66 | + developers { |
| 67 | + developer { |
| 68 | + id.set("aldenml") |
| 69 | + name.set("Alden Torres") |
| 70 | + |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + repositories { |
| 78 | + maven { |
| 79 | + credentials { |
| 80 | + username = if (hasProperty("ossrhUsername")) |
| 81 | + property("ossrhUsername").toString() else "" |
| 82 | + password = if (hasProperty("ossrhPassword")) |
| 83 | + property("ossrhPassword").toString() else "" |
| 84 | + } |
| 85 | + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") |
| 86 | + } |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +signing { |
| 91 | + sign(publishing.publications["mavenJava"]) |
| 92 | +} |
| 93 | + |
| 94 | +tasks.jacocoTestReport { |
| 95 | + reports { |
| 96 | + xml.isEnabled = true |
| 97 | + } |
| 98 | +} |
| 99 | + |
| 100 | +tasks.register("codacyCoverage", JavaExec::class) { |
| 101 | + dependsOn(tasks.jacocoTestReport) |
| 102 | + |
| 103 | + main = "com.codacy.CodacyCoverageReporter" |
| 104 | + classpath = codacy |
| 105 | + args = listOf( |
| 106 | + "report", |
| 107 | + "-l", |
| 108 | + "Java", |
| 109 | + "-r", |
| 110 | + "${buildDir}/reports/jacoco/test/jacocoTestReport.xml" |
| 111 | + ) |
| 112 | +} |
0 commit comments