Advertisement
Guest User

Untitled

a guest
Jan 15th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 2.79 KB | None | 0 0
  1. import com.google.protobuf.gradle.*
  2. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  3.  
  4. group = "pl.dwojciechowski"
  5. version = "0.4.0"
  6. val protobufVersion = "3.11.1"
  7. val rsocketVersion = "1.0.0-RC5"
  8. val rsocketRpcVersion = "0.2.18"
  9.  
  10. plugins {
  11.     id("org.jetbrains.intellij") version "0.4.15"
  12.     id("com.google.protobuf") version "0.8.11"
  13.     kotlin("jvm") version "1.3.61"
  14.     java
  15.     idea
  16. }
  17.  
  18. apply(plugin = "org.jetbrains.intellij")
  19.  
  20. repositories {
  21.     mavenCentral()
  22.     jcenter()
  23.     maven("https://dl.bintray.com/kittinunf/maven")
  24. }
  25.  
  26. dependencies {
  27.     implementation(kotlin("stdlib-jdk8"))
  28.     implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
  29.     implementation("com.github.kittinunf.fuel", "fuel", "2.2.1")
  30.     implementation("io.reactivex.rxjava3:rxjava:3.0.0-RC7")
  31.  
  32.     implementation("com.google.protobuf:protobuf-java:$protobufVersion")
  33.     implementation("io.rsocket.rpc:rsocket-rpc-core:$rsocketRpcVersion")
  34.     implementation("io.rsocket:rsocket-transport-netty:$rsocketVersion")
  35.     implementation("io.rsocket:rsocket-core:$rsocketVersion")
  36.  
  37. }
  38.  
  39. intellij {
  40.     version = "2019.3"
  41.     updateSinceUntilBuild = true
  42.     pluginName = "PLM Companion"
  43. }
  44.  
  45. tasks {
  46.     withType<KotlinCompile>{
  47.         kotlinOptions.jvmTarget = "1.8"
  48.     }
  49.  
  50.     create("myClean",Delete::class){
  51.         delete("src/generated")
  52.     }
  53.  
  54.     clean{
  55.         dependsOn("myClean")
  56.     }
  57. }
  58.  
  59. idea {
  60.     module {
  61.         sourceDirs.add(file("src/main/proto"))
  62.         sourceDirs.add(file("src/main/kotlin"))
  63.  
  64.         generatedSourceDirs.add(file("src/generated/main/java"))
  65.         generatedSourceDirs.add(file("src/generated/main/rsocketRpc"))
  66.     }
  67. }
  68.  
  69.  
  70. protobuf {
  71.  
  72.     generatedFilesBaseDir = "${projectDir}/src/generated"
  73.  
  74.     protoc {
  75.         artifact = "com.google.protobuf:protoc:$protobufVersion"
  76.     }
  77.  
  78.     plugins {
  79.         id("rsocketRpc") {
  80.             artifact = "io.rsocket.rpc:rsocket-rpc-protobuf:$rsocketRpcVersion"
  81.         }
  82.     }
  83.  
  84.     generateProtoTasks {
  85.         ofSourceSet("main").forEach {
  86.             it.plugins {
  87.                 id("rsocketRpc")
  88.             }
  89.         }
  90.     }
  91. }
  92.  
  93. /**
  94.  * KeyPromoterX function, visit its github: https://github.com/halirutan/IntelliJ-Key-Promoter-X
  95.  */
  96. fun htmlFixer(filename: String): String {
  97.     if (!File(filename).exists()) {
  98.         logger.error("File $filename not found.")
  99.     } else {
  100.         return File(filename).readText().replace("<html>", "").replace("</html>", "")
  101.     }
  102.     return ""
  103. }
  104.  
  105. tasks {
  106.     named<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
  107.         changeNotes(htmlFixer("src/main/resources/META-INF/change-notes.html"))
  108.         pluginDescription(htmlFixer("src/main/resources/META-INF/description.html"))
  109.         sinceBuild("192")
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement