forked from elpassion/mainframer-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
104 lines (88 loc) · 3.02 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import org.gradle.api.tasks.SourceSet
import java.util.regex.Pattern
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.intellij.tasks.PublishTask
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
buildscript {
repositories {
jcenter()
maven { setUrl("http://dl.bintray.com/jetbrains/intellij-plugin-service") }
}
}
plugins {
jacoco
id("org.jetbrains.intellij") version "0.4.8"
kotlin("jvm") version "1.3.30"
}
val kotlinVersion = plugins.getPlugin(KotlinPluginWrapper::class.java).kotlinPluginVersion
group = "com.elpassion.mainframerplugin"
version = readVersion()
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets[SourceSet.MAIN_SOURCE_SET_NAME].java {
srcDir("src/main/kotlin")
}
}
tasks.withType<JacocoReport> {
reports {
xml.isEnabled = true
html.isEnabled = true
}
val check by tasks
check.dependsOn(this)
}
repositories {
jcenter()
}
intellij {
version = "IC-2019.1"
pluginName = "mainframer-integration"
updateSinceUntilBuild = true
}
val publishPlugin: PublishTask by tasks
val patchPluginXml: PatchPluginXmlTask by tasks
publishPlugin {
username(project.findProperty("MF_PUBLISH_USER_NAME") as String?)
password(project.findProperty("MF_PUBLISH_PASSWORD") as String?)
channels(listOf(project.findProperty("publishChannel") as String?))
}
patchPluginXml {
sinceBuild("145")
untilBuild("192.*")
}
fun readVersion(): String {
val versionFile = File("version.gradle.properties")
val matcher = Pattern.compile("version=(\\d+.\\d+.\\d+)").matcher(versionFile.readText())
if (matcher.find()) {
return matcher.group(1)
} else {
throw RuntimeException("Version not found!")
}
}
val versionName by project
task("updateVersion") {
doLast {
val versionFile = File("version.gradle.properties")
val matcher = Pattern.compile("version=(\\d+.\\d+.\\d+)").matcher(versionFile.readText())
if (matcher.find()) {
val versionText = StringBuilder(versionFile.readText()).replace(matcher.start(1), matcher.end(1), versionName.toString())
versionFile.writeText(versionText.toString())
}
}
}
dependencies {
compile(kotlin("stdlib", kotlinVersion))
compile(kotlin("reflect", kotlinVersion))
compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0")
compile("com.fasterxml.jackson.core:jackson-databind:2.8.6")
compile("com.squareup.retrofit2:retrofit:2.1.0")
compile("com.squareup.retrofit2:converter-jackson:2.1.0")
compile("io.reactivex.rxjava2:rxjava:2.0.5")
compile("com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0")
testCompile("com.nhaarman:mockito-kotlin:1.2.0")
testCompile("com.squareup.okhttp3:mockwebserver:3.6.0")
testCompile("junit:junit:4.11")
testCompile("org.assertj:assertj-core:3.6.1")
}
inline operator fun <T : Task> T.invoke(a: T.() -> Unit): T = apply(a)