Skip to content

feat: elide intellij plugin #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ project/docs/apidocs
packages/cli/README.md.br
README.md.br
node_modules
.intellijPlatform/
cosign.key
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ buildEmbedded = false
buildDocs = false
buildBenchmarks = false
buildExperimentalEntrypoint = false
buildIdePlugins = false

enableSigning = false
enableSigstore = false
Expand Down
4 changes: 4 additions & 0 deletions gradle/elide.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ hibernate = "5.6.11.Final"
highlights = "1.0.0"
hikari = "4.0.3"
hoplite = "2.9.0"
intellij-platform = "2.5.0"
intellij-target-ide = "2025.1"
intellij-target-build = "251"
inquirer = "0.1.0"
j4rs = "0.22.0"
jackson = "2.19.1"
Expand Down Expand Up @@ -290,6 +293,7 @@ gr8 = { id = "com.gradleup.gr8", version.ref = "gr8" }
graalvm = { id = "org.graalvm.buildtools.native" }
gradle-checksum = { id = "org.gradle.crypto.checksum", version.ref = "gradleChecksum" }
gradle-testretry = { id = "org.gradle.test-retry", version.ref = "gradleTestRetry" }
intellij-platform = { id = "org.jetbrains.intellij.platform", version.ref = "intellij-platform" }
jetbrains-compose = { id = "org.jetbrains.compose" }
jmh = { id = "me.champeau.jmh", version.ref = "jmh-plugin" }
jprofiler = { id = "com.jprofiler", version.ref = "jprofiler" }
Expand Down
5 changes: 5 additions & 0 deletions packages/base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* License for the specific language governing permissions and limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import elide.internal.conventions.kotlin.*

plugins {
Expand All @@ -34,6 +35,10 @@ elide {
explicitApi = true
}

jvm {
target = JvmTarget.JVM_21
}

checks {
detekt = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,7 @@ import elide.runtime.Logging
import elide.runtime.exec.asExecResult
import elide.runtime.gvm.kotlin.KotlinCompilerConfig
import elide.runtime.gvm.kotlin.KotlinLanguage
import elide.tooling.AbstractTool
import elide.tooling.Argument
import elide.tooling.Arguments
import elide.tooling.Classpath
import elide.tooling.ClasspathSpec
import elide.tooling.Environment
import elide.tooling.MultiPathUsage
import elide.tooling.MutableArguments
import elide.tooling.MutableClasspath
import elide.tooling.Tool
import elide.tooling.*
import elide.tooling.config.BuildConfigurator
import elide.tooling.config.BuildConfigurator.ElideBuildState
import elide.tooling.deps.DependencyResolver
Expand All @@ -64,98 +55,6 @@ private fun srcSetTaskName(srcSet: SourceSet, name: String): String {
return "$name${srcSet.name[0].uppercase()}${srcSet.name.slice(1..srcSet.name.lastIndex)}"
}

/**
* # JVM Libraries
*
* Describes coordinates and versions for built-in libraries which ship with Elide.
*/
public object JvmLibraries {
public const val EMBEDDED_JUNIT_VERSION: String = "5.13.1"
public const val EMBEDDED_JUNIT_PLATFORM_VERSION: String = "1.13.1"
public const val EMBEDDED_APIGUARDIAN_VERSION: String = "1.1.2"
public const val EMBEDDED_OPENTEST_VERSION: String = "1.3.0"
public const val EMBEDDED_COROUTINES_VERSION: String = KotlinLanguage.COROUTINES_VERSION
public const val EMBEDDED_SERIALIZATION_VERSION: String = KotlinLanguage.SERIALIZATION_VERSION
public const val APIGUARDIAN_API: String = "org.apiguardian:apiguardian-api"
public const val JUNIT_JUPITER_API: String = "org.junit.jupiter:junit-jupiter-api"
public const val JUNIT_JUPITER_ENGINE: String = "org.junit.jupiter:junit-jupiter-engine"
public const val JUNIT_PLATFORM_ENGINE: String = "org.junit.platform:junit-platform-engine"
public const val JUNIT_PLATFORM_COMMONS: String = "org.junit.platform:junit-platform-commons"
public const val JUNIT_PLATFORM_CONSOLE: String = "org.junit.platform:junit-platform-console"
public const val JUNIT_JUPITER_PARAMS: String = "org.junit.jupiter:junit-jupiter-params"
public const val OPENTEST: String = "org.opentest4j:opentest4j"
public const val KOTLIN_TEST: String = "org.jetbrains.kotlin:kotlin-test"
public const val KOTLIN_TEST_JUNIT5: String = "org.jetbrains.kotlin:kotlin-test-junit5"
public const val KOTLINX_COROUTINES: String = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm"
public const val KOTLINX_COROUTINES_TEST: String = "org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm"
public const val KOTLINX_SERIALIZATION: String = "org.jetbrains.kotlinx:kotlinx-serialization-core-jvm"
public const val KOTLINX_SERIALIZATION_JSON: String = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm"

internal val baseCoordinates = arrayOf(
jarNamed("kotlin-stdlib"),
jarNamed("kotlin-reflect"),
)

internal val testCoordinates = arrayOf(
OPENTEST to EMBEDDED_OPENTEST_VERSION,
JUNIT_JUPITER_API to EMBEDDED_JUNIT_VERSION,
JUNIT_JUPITER_PARAMS to EMBEDDED_JUNIT_VERSION,
JUNIT_JUPITER_ENGINE to EMBEDDED_JUNIT_VERSION,
JUNIT_PLATFORM_ENGINE to EMBEDDED_JUNIT_PLATFORM_VERSION,
JUNIT_PLATFORM_COMMONS to EMBEDDED_JUNIT_PLATFORM_VERSION,
JUNIT_PLATFORM_CONSOLE to EMBEDDED_JUNIT_PLATFORM_VERSION,
KOTLIN_TEST to KotlinLanguage.VERSION,
KOTLIN_TEST_JUNIT5 to KotlinLanguage.VERSION,
KOTLINX_COROUTINES_TEST to EMBEDDED_COROUTINES_VERSION,
KOTLINX_SERIALIZATION to EMBEDDED_SERIALIZATION_VERSION,
KOTLINX_SERIALIZATION_JSON to EMBEDDED_SERIALIZATION_VERSION,
APIGUARDIAN_API to EMBEDDED_APIGUARDIAN_VERSION,
)

public fun jarNamed(name: String): String = buildString {
append(name)
append('.')
append("jar")
}

public fun jarNameFor(coordinate: String, version: String): String {
val parts = coordinate.split(":")
require(parts.size == 2) { "Invalid built-in coordinate: $coordinate" }
return "${parts[1]}-$version.jar"
}

public fun resolveJarFor(path: Path, coordinate: String, version: String): Path {
return resolveJarFor(path, jarNameFor(coordinate, version))
}

public fun resolveJarFor(path: Path, name: String): Path {
return path
.resolve("kotlin")
.resolve(KotlinLanguage.VERSION)
.resolve("lib")
.resolve(name)
}

public fun builtinClasspath(path: Path, tests: Boolean = false, kotlin: Boolean = true): Classpath {
return Classpath.from(
buildList {
if (kotlin || tests) addAll(
baseCoordinates.map {
resolveJarFor(path, it)
},
)
if (tests) {
addAll(
testCoordinates.map { (coordinate, version) ->
resolveJarFor(path, coordinate, version)
},
)
}
},
)
}
}

/**
* ## JVM Build Configurator
*/
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,6 @@ fun Jar.applyJarSettings() {
}

val intermediateKotlinResources = kotlinHomeRoot.map { it.dir(libs.versions.kotlin.sdk.get()) }
val pklSources = layout.projectDirectory.dir("src/main/pkl")

// note: the traditional KOTLIN_HOME path does not end with `lib`, so it should point to the versioned kotlin root here,
// even though elide's own paths include `lib`.
Expand Down Expand Up @@ -2261,10 +2260,6 @@ tasks {
// include("umbrella.dll")
// into("META-INF/native/")
// }

from(pklSources) {
into("META-INF/elide/pkl/")
}
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sample
import com.google.common.base.Joiner

fun render_greeting(): String {
return Joiner.on(", ").join("Hello", "World")
return Joiner.on(" ").join("Hello", "World")
}

fun main() {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* License for the specific language governing permissions and limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import elide.internal.conventions.kotlin.*

plugins {
Expand All @@ -32,6 +33,10 @@ elide {
target = KotlinTarget.Default
explicitApi = true
}

jvm {
target = JvmTarget.JVM_21
}
}

dependencies {
Expand Down
78 changes: 78 additions & 0 deletions packages/plugin-idea/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2024-2025 Elide Technologies, Inc.
*
* Licensed under the MIT license (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://opensource.org/license/mit/
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.elide.conventions)
alias(libs.plugins.intellij.platform)
kotlin("jvm")
id("java")
}

elide {
jvm {
// Intellij plugins can only target up to JVM 21
target = JvmTarget.JVM_21
}
kotlin {
customKotlinCompilerArgs += "-Xskip-prerelease-check"
}
}

repositories {
intellijPlatform {
defaultRepositories()
}

maven {
name = "elide-snapshots"
url = uri("https://maven.elide.dev")
content {
includeGroup("dev.elide")
includeGroup("org.pkl-lang")
}
}

maven {
name = "oss-snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
content { includeGroup("dev.elide") }
}

mavenCentral()
google()
}

dependencies {
// manifest and lockfile parsing
implementation(projects.packages.tooling) {
// plugins must use the bundled coroutines library
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
}

intellijPlatform {
create("IC", libs.versions.intellij.target.ide.get())
testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
}
}

intellijPlatform {
pluginConfiguration {
ideaVersion {
sinceBuild = libs.versions.intellij.target.build.get()
}

changeNotes = "Initial release."
}
}
Loading