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.2KB

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