Skip to content
Open
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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*.{kt,kts}]
indent_size = 4
max_line_length = 160
ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_standard_backing-property-naming = disabled
ktlint_standard_property-naming = disabled
145 changes: 81 additions & 64 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML

fun properties(key: String) = providers.gradleProperty(key)

fun environment(key: String) = providers.environmentVariable(key)

plugins {
kotlin("jvm") version libs.versions.kotlin.get()
id("org.jetbrains.compose") version "1.10.0" // must align with jewel https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/gradle/libs.versions.toml
// must align with jewel:
// https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/gradle/libs.versions.toml
id("org.jetbrains.compose") version libs.versions.compose.get()
alias(libs.plugins.gradleIntelliJPlugin) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.compose) // Gradle Compose Compiler Plugin
Expand Down Expand Up @@ -41,7 +44,7 @@ repositories {
}

apply(
from = "gradle/spotless.gradle"
from = "gradle/spotless.gradle",
)

sourceSets {
Expand All @@ -63,7 +66,7 @@ dependencies {
"uiTestImplementation"(libs.junit)
"uiTestImplementation"("com.squareup.okhttp3:okhttp:4.12.0")
// The Compose compiler plugin applies to all source sets; uiTest needs the runtime on its classpath
"uiTestImplementation"("org.jetbrains.compose.runtime:runtime-desktop:1.7.3")
"uiTestImplementation"("org.jetbrains.compose.runtime:runtime-desktop:${libs.versions.compose.get()}")

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
Expand Down Expand Up @@ -94,7 +97,11 @@ dependencies {
}

kotlin {
jvmToolchain(libs.versions.jdk.get().toInt())
jvmToolchain(
libs.versions.jdk
.get()
.toInt(),
)
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
Expand All @@ -114,30 +121,32 @@ tasks {
// untilBuild = properties("pluginUntilBuild").get()

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
pluginDescription =
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML
)
changeNotes =
properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}
}

signPlugin {
Expand Down Expand Up @@ -169,29 +178,34 @@ intellijPlatformTesting {
runIde {
register("runIdeForUiTests") {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
// Skip the "Trust Project?" dialog that blocks the IDE frame from appearing
"-Didea.trust.all.projects=true",
"-Didea.initially.ask.config=never",
// Suppress Tip of the Day, What's New, and other first-run dialogs
"-Dide.show.tips.on.startup.default.value=false",
"-Didea.is.internal=false",
"-Dide.no.platform.update=true",
// Skip import settings dialog
"-Didea.config.imported.in.current.session=true",
// Force the Swing menu bar so remote-robot can find menu items.
// Without this, macOS uses the native system menu bar which is
// invisible to the Swing component hierarchy that remote-robot inspects.
"-Dapple.laf.useScreenMenuBar=false"
)
}
jvmArgumentProviders +=
CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
// Skip the "Trust Project?" dialog that blocks the IDE frame from appearing
"-Didea.trust.all.projects=true",
"-Didea.initially.ask.config=never",
// Suppress Tip of the Day, What's New, and other first-run dialogs
"-Dide.show.tips.on.startup.default.value=false",
"-Didea.is.internal=false",
"-Dide.no.platform.update=true",
// Skip import settings dialog
"-Didea.config.imported.in.current.session=true",
// Force the Swing menu bar so remote-robot can find menu items.
// Without this, macOS uses the native system menu bar which is
// invisible to the Swing component hierarchy that remote-robot inspects.
"-Dapple.laf.useScreenMenuBar=false",
)
}
// Open the test project so settings.gradle.kts is available for module creation
args(layout.projectDirectory.dir("src/uiTest/testProject").asFile.absolutePath)
args(
layout.projectDirectory
.dir("src/uiTest/testProject")
.asFile.absolutePath,
)
}

plugins {
Expand All @@ -207,30 +221,32 @@ intellijPlatform {
version = properties("pluginVersion").get()

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
description =
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML
)
changeNotes =
properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}

ideaVersion {
sinceBuild = properties("pluginSinceBuild").get()
Expand All @@ -249,8 +265,9 @@ intellijPlatform {
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion")
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
channels =
properties("pluginVersion")
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

pluginVerification {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pluginSinceBuild = 253
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = AI
# AS version and patch at the end
platformVersion = 2025.3.1.1
platformVersion = 2025.3.4.7

# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins = com.intellij.java
Expand All @@ -27,7 +27,7 @@ platformPlugins =

# Gradle Releases -> https://github.com/gradle/gradle/releases
# update gradle-wrapper.properties and run ./gradlew wrapper
gradleVersion = 8.13
gradleVersion = 9.5.0

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
Expand Down
15 changes: 8 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[versions]
freemarker = "2.3.30"
serialization = "1.5.1"
freemarker = "2.3.34"
serialization = "1.11.0"
jdk = "17"
kotlin = "2.2.20"
changelog = "2.0.0"
gradleIntelliJPlugin = "2.10.5"
spotless = "6.8.0"
segment = "1.13.2"
kotlin = "2.4.10"
compose = "1.10.3"
changelog = "2.5.0"
gradleIntelliJPlugin = "2.18.1"
spotless = "8.9.0"
segment = "1.26.0"
junit = "4.13.2"
remoteRobot = "0.11.23"

Expand Down
17 changes: 9 additions & 8 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@ apply plugin: "com.diffplug.spotless"

spotless {
java {
target '**/*.java'
target 'src/**/*.java'
googleJavaFormat().aosp()
removeUnusedImports()
trimTrailingWhitespace()
indentWithSpaces()
leadingTabsToSpaces()
endWithNewline()
}

kotlinGradle {
ktlint("0.46.0")
target '*.gradle.kts', 'settings.gradle.kts'
ktlint()
trimTrailingWhitespace()
endWithNewline()
}

kotlin {
target '**/*.kt'
ktlint("0.46.0")
target 'src/**/*.kt'
ktlint()
trimTrailingWhitespace()
indentWithSpaces()
leadingTabsToSpaces()
endWithNewline()
}

format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
indentWithSpaces()
target '*.gradle', '*.md', '.gitignore', 'gradle/**/*.gradle'
leadingTabsToSpaces()
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions src/main/kotlin/com/joetr/modulemaker/MessageDialogWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import javax.swing.JTextArea
private const val WINDOW_WIDTH = 100
private const val WINDOW_HEIGHT = 100

class MessageDialogWrapper(private val message: String) : DialogWrapper(true) {

class MessageDialogWrapper(
private val message: String,
) : DialogWrapper(true) {
init {
init()
}
Expand All @@ -30,12 +31,11 @@ class MessageDialogWrapper(private val message: String) : DialogWrapper(true) {
return dialogPanel
}

override fun createActions(): Array<Action> {
return arrayOf(
override fun createActions(): Array<Action> =
arrayOf(
DialogWrapperExitAction(
"Okay",
2
)
2,
),
)
}
}
2 changes: 1 addition & 1 deletion src/main/kotlin/com/joetr/modulemaker/ModuleMakerAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ModuleMakerAction : AnAction() {

ModuleMakerDialogWrapper(
project = project,
startingLocation = if (shouldUseStartingLocation) startingLocation else null
startingLocation = if (shouldUseStartingLocation) startingLocation else null,
).show()
}
}
Loading
Loading