1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-10 03:34:06 +02:00

Move scripts into the separate module

This commit is contained in:
Alex Plate 2022-12-29 09:26:45 +02:00
parent fafa7572d0
commit 1e58ead126
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
6 changed files with 53 additions and 46 deletions

View File

@ -28,4 +28,4 @@ jobs:
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Check new plugins
run: ./gradlew checkNewPluginDependencies
run: ./gradlew scripts:checkNewPluginDependencies

View File

@ -88,25 +88,6 @@ val publishToken: String by project
val slackUrl: String by project
val youtrackToken: String by project
/**
* Okay, now meet the magic of gradle.
*
* The task: I'd like to have a separate folder with several kotlin scripts. These scripts are not
* supposed to be used in IdeaVim plugin, but will provide some handy actions for code maintenance.
*
* As I don't know how to do it perfectly and I didn't find an answer on google, now such scripts
* are called as a separate java applications, what seems fine for me. However, there is a problem
* that the dependencies of the scripts where included in the plugin destribution, what increased the
* package size in 2.5 times.
* To solve this problem and having only "my script scoped dependencies", I found a feature of gradle
* called "configurations". So, here I declare the configuration.
* The scipt-specific dependencies are defined using this configuration.
* The dependencies are added in task using `configurations["scriptsVim"]` syntax.
*
* There is no other goal for this thing except defining script-specific dependencies.
*/
val scriptsVim: Configuration by configurations.creating
repositories {
mavenCentral()
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
@ -135,19 +116,6 @@ dependencies {
api(project(":vim-engine"))
testApi("com.squareup.okhttp3:okhttp:4.10.0")
// Script specific dependencies.
// As IJ doesn't catch these dependencies and shows them as red (must probably because of my misconfiguration)
// I specified the same dependencies twice with a different configuration.
// It seems like it doesn't affect the plugin size or anything else, but just enabled a highlighting in IJ
scriptsVim("io.ktor:ktor-client-core:2.1.3")
scriptsVim("io.ktor:ktor-client-cio:2.1.3")
scriptsVim("io.ktor:ktor-client-content-negotiation:2.1.3")
scriptsVim("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
compileOnly("io.ktor:ktor-client-core:2.1.3")
compileOnly("io.ktor:ktor-client-cio:2.1.3")
compileOnly("io.ktor:ktor-client-content-negotiation:2.1.3")
compileOnly("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
}
configurations {
@ -574,19 +542,6 @@ tasks.register("testUpdateChangelog") {
}
}
tasks.register("generateIdeaVimConfigurations", JavaExec::class) {
description = "This task generates lists of actions and commands for IdeaVim"
mainClass.set("scripts.MainKt")
classpath = sourceSets["main"].runtimeClasspath
}
tasks.register("checkNewPluginDependencies", JavaExec::class) {
group = "verification"
description = "This job tracks if there are any new plugins in marketplace we don't know about"
mainClass.set("scripts.CheckNewPluginDependenciesKt")
classpath = configurations["scriptsVim"] + sourceSets["main"].runtimeClasspath
}
fun addReleaseToYoutrack(name: String): String {
val client = httpClient()
println("Creating new release version in YouTrack: $name")

51
scripts/build.gradle.kts Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright 2003-2022 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
plugins {
java
kotlin("jvm")
application
}
// group 'org.jetbrains.ideavim'
// version 'SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20")
implementation("io.ktor:ktor-client-core:2.1.3")
implementation("io.ktor:ktor-client-cio:2.1.3")
implementation("io.ktor:ktor-client-content-negotiation:2.1.3")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
}
tasks {
compileKotlin {
kotlinOptions {
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}
}
}
tasks.register("generateIdeaVimConfigurations", JavaExec::class) {
group = "verification"
description = "This job tracks if there are any new plugins in marketplace we don't know about"
mainClass.set("scripts.MainKt")
classpath = sourceSets["main"].runtimeClasspath
}
tasks.register("checkNewPluginDependencies", JavaExec::class) {
group = "verification"
description = "This job tracks if there are any new plugins in marketplace we don't know about"
mainClass.set("scripts.CheckNewPluginDependenciesKt")
classpath = sourceSets["main"].runtimeClasspath
}

View File

@ -10,4 +10,5 @@ pluginManagement {
rootProject.name = 'IdeaVIM'
include 'vim-engine'
include 'scripts'