forked from JetBrains/ideavim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
133 lines (118 loc) · 3.06 KB
/
build.gradle
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'org.jetbrains.intellij' version '0.4.18'
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
sourceSets {
main {
java.srcDir 'src'
resources.srcDir 'resources'
}
test {
java.srcDir 'test'
}
}
intellij {
version ideaVersion
pluginName 'IdeaVim'
updateSinceUntilBuild false
downloadSources Boolean.valueOf(downloadIdeaSources)
instrumentCode Boolean.valueOf(instrumentPluginCode)
intellijRepo = "https://www.jetbrains.com/intellij-repository"
plugins = ['java']
publishPlugin {
channels publishChannels.split(',')
username publishUsername
token publishToken
}
}
repositories {
mavenCentral()
}
dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compileOnly "org.jetbrains:annotations:19.0.0"
// https://mvnrepository.com/artifact/com.ensarsarajcic.neovim.java/neovim-api
compile group: 'com.ensarsarajcic.neovim.java', name: 'neovim-api', version: '0.1.16'
}
compileKotlin {
kotlinOptions {
jvmTarget = javaVersion
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = javaVersion
}
}
task testWithNeovim(type : Test) {
group = "verification"
systemProperty "ideavim.neovim.test", 'true'
}
tasks.register("slackEapNotification") {
doLast {
if (!slackUrl) return
def post = new URL(slackUrl).openConnection()
def changeLog = extractChangelog()
changeLog = changeLog.replace("* ", "• ") // Replace stars with bullets
changeLog = changeLog.replace("**", "*") // Enable bold text
changeLog = changeLog.replaceAll("\\[([^]]+)]\\(([^)]+)\\)", '<$2|$1>') // Enable links
def message ="""
{
"text": "New version of IdeaVim",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "IdeaVim EAP $version has been released\\n$changeLog"
}
}
]
}
"""
post.setRequestMethod("POST")
post.setDoOutput(true)
post.setRequestProperty("Content-Type", "application/json")
post.getOutputStream().write(message.getBytes("UTF-8"))
def postRC = post.getResponseCode()
println(postRC)
if(postRC == 200) {
println(post.getInputStream().getText())
}
}
}
// Very primitive changelog extraction code
def extractChangelog() {
def startLine = "_Available since $version EAP:_"
def endLine = "_To Be Released..._"
def startSaving = false
def res = new StringBuilder()
new File("./CHANGES.md").eachLine { line ->
if (startSaving) {
if (line == endLine) {
startSaving = false
}
else {
res.append(line).append('\n')
}
}
else {
if (line == startLine) {
startSaving = true
}
}
}
return res.toString()
}