-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
82 lines (70 loc) · 2.11 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
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
group = "org.dandoh.favacts"
version = "0.0.2"
val pluginGroup = group
val pluginVersion = version
val isCI = !System.getenv("CI").isNullOrBlank()
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50")
}
}
fun fromToolbox(root: String, ide: String) = file(root)
.resolve(ide)
.takeIf { it.exists() }
?.resolve("ch-0")
?.listFiles()
.orEmpty()
.asSequence()
.filterNotNull()
.filter { it.isDirectory }
.filterNot { it.name.endsWith(".plugins") }
.maxBy {
val (major, minor, patch) = it.name.split('.')
String.format("%5s%5s%5s", major, minor, patch)
}
?.also { println("Picked: $it") }
plugins {
java
id("org.jetbrains.intellij") version "0.4.10"
kotlin("jvm") version "1.3.50"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
intellij {
updateSinceUntilBuild = false
instrumentCode = true
val user = System.getProperty("user.name")
val os = System.getProperty("os.name")
val root = when {
os.startsWith("Windows") -> "C:\\Users\\$user\\AppData\\Local\\JetBrains\\Toolbox\\apps"
os == "Linux" -> "/home/$user/.local/share/JetBrains/Toolbox/apps"
else -> return@intellij
}
val intellijPath = sequenceOf("IDEA-C-JDK11", "IDEA-C", "IDEA-JDK11", "IDEA-U")
.mapNotNull { fromToolbox(root, it) }.firstOrNull()
intellijPath?.absolutePath?.let { localPath = it }
val pycharmPath = sequenceOf("PyCharm-C", "IDEA-C-JDK11", "IDEA-C", "IDEA-JDK11", "IDEA-U")
.mapNotNull { fromToolbox(root, it) }.firstOrNull()
pycharmPath?.absolutePath?.let { alternativeIdePath = it }
}
tasks.withType<PatchPluginXmlTask> {
changeNotes(file("info/change-notes.html").readText())
pluginDescription(file("info/description.html").readText())
version(pluginVersion)
pluginId(pluginGroup)
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile(kotlin("stdlib-jdk8"))
testCompile(kotlin("test-junit"))
testCompile("junit", "junit", "4.12")
}