33// See License.AGPL.txt in the project root for license information.
44
55import io.gitlab.arturbosch.detekt.Detekt
6+ import org.jetbrains.changelog.date
67import org.jetbrains.changelog.markdownToHTML
78import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
89import org.jetbrains.kotlin.gradle.dsl.JvmTarget
@@ -36,6 +37,8 @@ if (environmentName.isNotBlank()) {
3637 pluginVersion + = " -$environmentName "
3738}
3839
40+ pluginVersion = pluginVersion.replace(" {{LOCAL_VERSION}}" , date(" MMddhhmm" ) + " -local" )
41+
3942project(" :" ) {
4043 kotlin {
4144 val excludedPackage = if (environmentName == " latest" ) " stable" else " latest"
@@ -176,3 +179,38 @@ tasks {
176179 }
177180 }
178181}
182+
183+ tasks.register(" installPlugin" ) {
184+ group = " gitpod"
185+
186+ println (" Building plugin $pluginVersion " )
187+
188+ dependsOn(" buildPlugin" )
189+
190+ doLast {
191+ val pluginTargetPath = " distributions/jetbrains-gateway-gitpod-plugin.zip"
192+ val pluginFile = layout.buildDirectory.file(pluginTargetPath).orNull?.asFile ? : {
193+ throw GradleException (" Plugin file not found at $pluginTargetPath " )
194+ }
195+
196+ // Example for macOS ~/Library/Application Support/JetBrains/JetBrainsGateway2024.3/plugins
197+ //
198+ // JB_GATEWAY_PLUGINS_DIR=/Users/hwen/Library/Application\ Support/JetBrains/JetBrainsGateway2024.3/plugins
199+ val gatewayPluginsDir = System .getenv(" JB_GATEWAY_PLUGINS_DIR" )
200+ if (gatewayPluginsDir.isNullOrEmpty()) {
201+ throw GradleException (" Found no JB_GATEWAY_PLUGINS_DIR environment variable" )
202+ }
203+ println (" Copying plugin from $pluginFile to $gatewayPluginsDir " )
204+
205+ copy {
206+ from(zipTree(pluginFile))
207+ into(file(gatewayPluginsDir))
208+ }
209+
210+ println (" Plugin successfully copied to $gatewayPluginsDir " )
211+
212+ exec {
213+ commandLine(" sh" , " -c" , " pkill -f 'Gateway' || true" )
214+ }
215+ }
216+ }
0 commit comments