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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  2. version = "0.6.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.112"
  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.3.2")
  37. testImplementation("org.junit.jupiter:junit-jupiter-params:5.3.2")
  38. testRuntime("org.junit.jupiter:junit-jupiter-engine:5.3.2")
  39. }
  40. java {
  41. sourceCompatibility = JavaVersion.VERSION_1_8
  42. targetCompatibility = JavaVersion.VERSION_1_8
  43. sourceSets {
  44. create("itest") {
  45. compileClasspath += getByName("main").output
  46. runtimeClasspath += getByName("main").output
  47. java.srcDirs("src/itest/kotlin")
  48. }
  49. }
  50. }
  51. tasks {
  52. create<Test>("itest") {
  53. group = "verification"
  54. testClassesDirs = sourceSets["itest"].output.classesDirs
  55. classpath = sourceSets["itest"].runtimeClasspath
  56. }
  57. create<Jar>("sourceJar") {
  58. description = "Creates a JAR that contains the source code."
  59. from(sourceSets["main"].allSource)
  60. archiveClassifier.set("sources")
  61. }
  62. create<JacocoReport>("codeCoverageReport") {
  63. executionData(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
  64. sourceSets(sourceSets["main"])
  65. reports {
  66. xml.isEnabled = true
  67. xml.destination = File("$buildDir/reports/jacoco/report.xml")
  68. html.isEnabled = true
  69. csv.isEnabled = false
  70. }
  71. dependsOn("test")
  72. }
  73. withType<Wrapper> {
  74. gradleVersion = "5.2"
  75. }
  76. withType<KotlinCompile> {
  77. kotlinOptions {
  78. jvmTarget = "1.8"
  79. }
  80. }
  81. withType<Test> {
  82. useJUnitPlatform()
  83. testLogging {
  84. events("passed", "skipped", "failed")
  85. }
  86. }
  87. }
  88. publishing {
  89. publications {
  90. create<MavenPublication>("Publication") {
  91. groupId = "com.dmdirc"
  92. artifactId = "ktirc"
  93. version = project.version as String
  94. artifact(tasks["jar"])
  95. artifact(tasks["sourceJar"])
  96. pom.withXml {
  97. val root = asNode()
  98. root.appendNode("name", "KtIrc")
  99. root.appendNode("description", "Kotlin library for connecting to and interacting with IRC")
  100. val dependenciesNode = root.appendNode("dependencies")
  101. configurations.implementation.get().allDependencies.forEach {
  102. val dependencyNode = dependenciesNode.appendNode("dependency")
  103. dependencyNode.appendNode("groupId", it.group)
  104. dependencyNode.appendNode("artifactId", it.name)
  105. dependencyNode.appendNode("version", it.version)
  106. }
  107. }
  108. }
  109. }
  110. }
  111. bintray {
  112. user = System.getenv("BINTRAY_USER")
  113. key = System.getenv("BINTRAY_API_KEY")
  114. setPublications("Publication")
  115. with(pkg) {
  116. userOrg = "dmdirc"
  117. repo = "releases"
  118. name = "ktirc"
  119. publish = true
  120. desc = "A kotlin library for connecting to and interacting with IRC"
  121. setLicenses("MIT")
  122. vcsUrl = "https://g.c5h.io/public/ktirc"
  123. }
  124. }