You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle.kts 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import org.jetbrains.dokka.gradle.DokkaTask
  2. import org.jetbrains.dokka.gradle.LinkMapping
  3. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  4. version = "1.1.1"
  5. group = "com.dmdirc.ktirc"
  6. plugins {
  7. `maven-publish`
  8. jacoco
  9. kotlin("jvm") version "1.3.31"
  10. id("com.jfrog.bintray") version "1.8.4"
  11. id("org.jetbrains.dokka") version "0.9.18"
  12. id("name.remal.check-updates") version "1.0.130"
  13. }
  14. jacoco {
  15. toolVersion = "0.8.3"
  16. }
  17. configurations {
  18. create("itestImplementation") { extendsFrom(getByName("testImplementation")) }
  19. create("itestRuntime") { extendsFrom(getByName("testRuntime")) }
  20. all {
  21. resolutionStrategy.eachDependency {
  22. if (requested.group == "org.jetbrains.kotlin") {
  23. useVersion("1.3.31")
  24. }
  25. }
  26. }
  27. }
  28. repositories {
  29. jcenter()
  30. mavenCentral()
  31. }
  32. dependencies {
  33. implementation(kotlin("stdlib-jdk8", "1.3.31"))
  34. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1")
  35. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-io-jvm:0.1.8")
  36. compile(kotlin("reflect"))
  37. testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
  38. testImplementation("org.junit.jupiter:junit-jupiter-params:5.4.2")
  39. testImplementation("io.mockk:mockk:1.9.3")
  40. testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.2")
  41. }
  42. java {
  43. sourceCompatibility = JavaVersion.VERSION_1_8
  44. targetCompatibility = JavaVersion.VERSION_1_8
  45. sourceSets {
  46. create("itest") {
  47. compileClasspath += getByName("main").output
  48. runtimeClasspath += getByName("main").output
  49. java.srcDirs("src/itest/kotlin")
  50. }
  51. }
  52. }
  53. tasks {
  54. create<Test>("itest") {
  55. group = "verification"
  56. testClassesDirs = sourceSets["itest"].output.classesDirs
  57. classpath = sourceSets["itest"].runtimeClasspath
  58. }
  59. create<Jar>("sourceJar") {
  60. description = "Creates a JAR that contains the source code."
  61. from(sourceSets["main"].allSource)
  62. archiveClassifier.set("sources")
  63. }
  64. create<JacocoReport>("codeCoverageReport") {
  65. executionData(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
  66. sourceSets(sourceSets["main"])
  67. reports {
  68. xml.isEnabled = true
  69. xml.destination = File("$buildDir/reports/jacoco/report.xml")
  70. html.isEnabled = true
  71. csv.isEnabled = false
  72. }
  73. dependsOn("test")
  74. }
  75. withType<Wrapper> {
  76. gradleVersion = "5.4.1"
  77. }
  78. withType<KotlinCompile> {
  79. kotlinOptions {
  80. jvmTarget = "1.8"
  81. }
  82. }
  83. withType<Test> {
  84. useJUnitPlatform()
  85. testLogging {
  86. events("passed", "skipped", "failed")
  87. }
  88. }
  89. withType<DokkaTask> {
  90. moduleName = "ktirc"
  91. includes = listOf("src/docs/manual.md")
  92. linkMappings = arrayListOf(LinkMapping().apply {
  93. dir = "src/main/kotlin"
  94. url = "https://github.com/csmith/ktirc/blob/master/src/main/kotlin"
  95. suffix = "#L"
  96. })
  97. }
  98. }
  99. publishing {
  100. publications {
  101. create<MavenPublication>("Publication") {
  102. groupId = "com.dmdirc"
  103. artifactId = "ktirc"
  104. version = project.version as String
  105. artifact(tasks["jar"])
  106. artifact(tasks["sourceJar"])
  107. pom.withXml {
  108. val root = asNode()
  109. root.appendNode("name", "KtIrc")
  110. root.appendNode("description", "Kotlin library for connecting to and interacting with IRC")
  111. val dependenciesNode = root.appendNode("dependencies")
  112. configurations.implementation.get().allDependencies.forEach {
  113. val dependencyNode = dependenciesNode.appendNode("dependency")
  114. dependencyNode.appendNode("groupId", it.group)
  115. dependencyNode.appendNode("artifactId", it.name)
  116. dependencyNode.appendNode("version", it.version)
  117. }
  118. }
  119. }
  120. }
  121. }
  122. bintray {
  123. user = System.getenv("BINTRAY_USER")
  124. key = System.getenv("BINTRAY_API_KEY")
  125. setPublications("Publication")
  126. with(pkg) {
  127. userOrg = "dmdirc"
  128. repo = "releases"
  129. name = "ktirc"
  130. publish = true
  131. desc = "A kotlin library for connecting to and interacting with IRC"
  132. setLicenses("MIT")
  133. vcsUrl = "https://g.c5h.io/public/ktirc"
  134. }
  135. }