-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
164 lines (144 loc) · 5.04 KB
/
build.gradle.kts
File metadata and controls
164 lines (144 loc) · 5.04 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("java")
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.kotlin.jvm") version "2.0.0"
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.0"
}
group = "ai.devchat"
version = "0.3.9"
repositories {
mavenCentral()
}
val ktorVersion = "2.3.12"
dependencies {
implementation("com.alibaba:fastjson:2.0.51")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-server-cors:$ktorVersion")
implementation("io.ktor:ktor-features:1.6.8")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
}
configurations.all {
exclude("org.slf4j", "slf4j-api")
}
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2022.3.3")
type.set("IC") // Target IDE Platform
plugins.set(listOf(/* Plugin Dependencies */))
}
tasks.register<Copy>("copyTools") {
from(layout.projectDirectory.dir("tools")) {
include(
"gpt-token/**",
"micromamba-*/**",
"python-3.11.6-embed-amd64/**",
"site-packages/**",
"sonar-rspec/**",
"code-editor/**",
"replace.sh"
)
}
into(layout.buildDirectory.dir("tmp/copyTools/tools"))
}
tasks.register<Copy>("copyWorkflows") {
from(layout.projectDirectory.dir("workflows")) { exclude(".git/**", ".gitignore") }
into(layout.buildDirectory.dir("tmp/copyWorkflows/workflows"))
}
tasks.register<Exec>("buildGUI") {
commandLine("yarn", "idea")
workingDir(layout.projectDirectory.dir("gui"))
}
sourceSets {
main {
resources {
srcDir(layout.buildDirectory.dir("tmp/copyTools"))
srcDir(layout.buildDirectory.dir("tmp/copyWorkflows"))
}
}
}
val pluginID: String? by project
val assistantNameZH: String? by project
val assistantNameEN: String? by project
val pluginIcon: String? by project
val pluginIconDark: String? by project
val toolWindowIcon: String? by project
tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
options.encoding = "UTF-8"
}
withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
patchPluginXml {
sinceBuild.set("223")
untilBuild.set("243.*")
}
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
processResources {
dependsOn("copyTools", "copyWorkflows")
pluginIcon?.takeIf { it.isNotBlank() }?.let {
from(it) {
rename { "META-INF/pluginIcon.svg" }
}
}
pluginIconDark?.takeIf { it.isNotBlank() }?.let {
from(it) {
rename { "META-INF/pluginIcon_dark.svg" }
}
}
toolWindowIcon?.takeIf { it.isNotBlank() }?.let {
from(it) {
rename { "icons/toolWindowIcon.svg" }
}
}
filesMatching("plugin.xml") {
expand(
"PLUGIN_ID" to (pluginID?.takeIf { it.isNotBlank() } ?: "ai.devchat.plugin"),
"ASSISTANT_NAME_ZH" to (assistantNameZH?.takeIf { it.isNotBlank() } ?: "DevChat"),
"ASSISTANT_NAME_EN" to (assistantNameEN?.takeIf { it.isNotBlank() } ?: "DevChat"),
"default" to "\$default"
)
}
filesMatching("intentionDescriptions/AskIssueIntention/description.html") {
expand(
"ASSISTANT_NAME_EN" to (assistantNameEN?.takeIf { it.isNotBlank() } ?: "DevChat"),
)
}
filesMatching("intentionDescriptions/FixIssueIntention/description.html") {
expand(
"ASSISTANT_NAME_EN" to (assistantNameEN?.takeIf { it.isNotBlank() } ?: "DevChat"),
)
}
filesMatching("messages/DevChatBundle.properties") {
expand(
"PLUGIN_ID" to (pluginID?.takeIf { it.isNotBlank() } ?: "ai.devchat.plugin"),
"ASSISTANT_NAME_ZH" to (assistantNameZH?.takeIf { it.isNotBlank() } ?: "DevChat"),
"ASSISTANT_NAME_EN" to (assistantNameEN?.takeIf { it.isNotBlank() } ?: "DevChat"),
)
}
}
publishPlugin {
token.set(System.getenv("INTELLIJ_PUBLISH_TOKEN"))
channels.set(listOf("eap", "stable"))
}
buildSearchableOptions {
enabled = false
}
}