-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.gradle.kts
115 lines (99 loc) · 3.93 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
105
106
107
108
109
110
111
112
113
114
115
import com.jetbrains.plugin.structure.intellij.version.IdeVersion
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel
val name: String by project
val changenotesFile: String by project
val descriptionFile: String by project
val ideaVersion: String by project
val javaVersion: String by project
val pluginVerifierIdeVersions: String by project
plugins {
id("org.jetbrains.intellij") version "1.4.0"
java
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("junit", "junit", "4.12")
testImplementation("com.sksamuel.scrimage", "scrimage-core", "4.0.22")
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set(ideaVersion)
pluginName.set(name)
downloadSources.set(true)
updateSinceUntilBuild.set(false)
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks {
register("genDocs", JavaExec::class) {
group = "pokemon-progress"
description = "generate documentation"
classpath = java.sourceSets["test"].runtimeClasspath
mainClass.set("com.kagof.intellij.plugins.pokeprogress.DocumentationGenerator")
}
register("testProgressBar", JavaExec::class) {
group = "pokemon-progress"
description = "test progress bar"
classpath = java.sourceSets["test"].runtimeClasspath
mainClass.set("com.kagof.intellij.plugins.pokeprogress.TestProgressBar")
}
register("indexColors", DefaultTask::class) {
group = "pokemon-progress"
description = "create index file for color schemes"
doFirst {
File("src/main/resources/com/kagof/intellij/plugins/pokeprogress/colors").let { dir ->
if (dir.exists() && dir.isDirectory && dir.canRead()) {
val strb = StringBuilder()
dir.listFiles()
?.filter { it.isFile }
?.filter { it.name.endsWith(".csv") }
?.forEach { strb.append(it.name).append("\n") }
val index = File(dir, ".cscheme.index")
index.delete()
index.createNewFile()
index.writeText(strb.toString())
} else throw IllegalStateException("unable to read color schemes")
}
}
}
withType<JavaCompile> {
options.encoding = "UTF-8"
dependsOn("indexColors")
}
patchPluginXml {
untilBuild.set(null as String?)
sinceBuild.convention(project.provider {
val ideVersion = IdeVersion.createIdeVersion(setupDependencies.get().idea.get().buildNumber)
"${ideVersion.baselineVersion}.${ideVersion.build}"
})
File(changenotesFile).let {
if (it.exists() && it.isFile && it.canRead()) changeNotes.set(it.readText())
else throw IllegalStateException("unable to read $changenotesFile")
}
File(descriptionFile).let {
if (it.exists() && it.isFile && it.canRead()) pluginDescription.set(it.readText())
else throw IllegalStateException("unable to read $descriptionFile")
}
}
buildPlugin {
dependsOn(patchPluginXml)
}
runPluginVerifier {
ideVersions.set(pluginVerifierIdeVersions.split(",").map { it.trim() }.toList())
failureLevel.set(listOf(FailureLevel.COMPATIBILITY_PROBLEMS,
FailureLevel.NOT_DYNAMIC))
}
signPlugin {
System.getenv("JETBRAINS_REPO_SIGNING_KEY")?.let { privateKey.set(it) }
System.getenv("JETBRAINS_REPO_SIGNING_KEY_PASSWORD")?.let { password.set(it) }
System.getenv("JETBRAINS_REPO_CERTIFICATE_CHAIN")?.let { certificateChain.set(it) }
}
publishPlugin {
System.getenv("JETBRAINS_REPO_TOKEN")?.let { token.set(it) }
System.getenv("PLUGIN_DEPLOYMENT_CHANNELS")?.let { channels.set(it.split(",").map { s -> s.trim() }.toList()) }
}
}