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

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