Skip to content
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

Fix #314 - migrate to IntelliJ Platform Gradle Plugin 2.0 #315

Merged
merged 3 commits into from
Aug 28, 2024
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
build/
venv/
tmp/

# IntelliJ Platform Gradle Plugin
.intellijPlatform/
69 changes: 34 additions & 35 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,52 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun config(name: String) = project.findProperty(name).toString()

val ideaVersion = config("ideaVersion")

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

val pluginName = "intellij-micropython"

plugins {
kotlin("jvm") version "1.9.25"
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.intellij.platform") version "2.0.1"
}

dependencies {
intellijPlatform {
val type = project.property("platformType").toString()
val version = project.property("platformVersion").toString()
val pythonPlugin = project.property("pythonPlugin").toString()

create(type, version, useInstaller = false)

bundledPlugin("org.jetbrains.plugins.terminal")

when (type) {
"PC" -> bundledPlugin("PythonCore")
"PY" -> bundledPlugin("Pythonid")
else -> plugin(pythonPlugin)
}
}
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

intellij {
version = ideaVersion
pluginName = "intellij-micropython"
updateSinceUntilBuild = false
intellijPlatform {
pluginConfiguration {
name = pluginName
}

instrumentCode = false
plugins.add("terminal")

if (ideaVersion.contains("PC")) {
plugins.add("python-ce")
} else if (ideaVersion.contains("PY")) {
plugins.add("python")
} else {
plugins.add(config("pythonPlugin"))
publishing {
token = project.property("publishToken").toString()
}
}

Expand All @@ -44,27 +59,11 @@ tasks {
apiVersion = KotlinVersion.KOTLIN_1_9
}
}
val copyStubs = register<Copy>("copyStubs") {
dependsOn("prepareSandbox")
from(projectDir) {
prepareSandbox {
from("$rootDir") {
into(pluginName)
include("typehints/")
include("scripts/")
}
into("${intellij.sandboxDir.get()}/plugins/intellij-micropython")
}
buildSearchableOptions {
dependsOn(copyStubs)
}
buildPlugin {
dependsOn(copyStubs)
}
verifyPlugin {
dependsOn(copyStubs)
}
runIde {
dependsOn(copyStubs)
}
publishPlugin {
token = config("publishToken")
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version=1.4.5-2024.1
ideaVersion=PC-241-EAP-SNAPSHOT
platformType=PC
platformVersion=241-EAP-SNAPSHOT
pythonPlugin=PythonCore:241.18034.55
publishToken=token

Expand Down