Skip to content

Commit

Permalink
Merge pull request #106 from overpas/#105/upgrade
Browse files Browse the repository at this point in the history
Update intellij platform plugin to 2.0.1
  • Loading branch information
overpas authored Sep 18, 2024
2 parents bb6b1b8 + 847cc34 commit 0f3d4c8
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
os:
- macos-latest
- ubuntu-latest
- windows-latest
jdk:
- zulu
- corretto
- adopt
runs-on: ${{ matrix.os }}
steps:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Check IDE compatibility
run: ./gradlew runPluginVerifier
run: ./gradlew verifyPlugin
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local.properties
!.idea/codeStyles
!.idea/saveactions_settings.xml
!.idea/inspectionProfiles
.intellijPlatform

.DS_Store

Expand Down
96 changes: 70 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java")
alias(libs.plugins.intellij)
alias(libs.plugins.intellij.platform)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.detekt)
alias(libs.plugins.compose.desktop)
alias(libs.plugins.compose.compiler)
}

fun environment(key: String) = providers.environmentVariable(key)
Expand All @@ -13,17 +16,29 @@ version = properties["version"].toString()

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
google()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://androidx.dev/storage/compose-compiler/repository/")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
maven(url = "https://maven.google.com")
maven(url = "https://jitpack.io")
maven(url = "https://packages.jetbrains.team/maven/p/kpm/public/")
}

dependencies {
intellijPlatform {
create(properties["platform-type"].toString(), properties["platform-version"].toString())
bundledPlugins(
"com.intellij.java",
"org.jetbrains.kotlin",
)
jetbrainsRuntime()
pluginVerifier()
zipSigner()
instrumentationTools()
testFramework(TestFrameworkType.Platform)
}
implementation(libs.svg.to.compose) {
exclude(group = "org.jetbrains.kotlinx")
exclude(group = "xerces", module = "xercesImpl")
Expand All @@ -41,46 +56,75 @@ dependencies {
exclude(group = "org.jetbrains.compose.material")
}
}
implementation(libs.jewel.ide.laf.bridge.get232()) {
implementation(libs.jewel.ide.laf.bridge.get241()) {
exclude(group = "org.jetbrains.kotlinx")
}
implementation(libs.compose.multiplatform.file.picker) {
exclude(group = "org.jetbrains.kotlinx")
}
detektPlugins(libs.detekt.compose.rules)
testImplementation(kotlin("test"))
testImplementation(libs.junit)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.kotlin.coroutines.test)
testImplementation(libs.turbine)
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set(properties["since-build"].toString())
plugins.set(listOf("java", "Kotlin"))
intellijPlatform {
buildSearchableOptions = true
pluginConfiguration {
id = properties["plugin-id"].toString()
name = properties["plugin-name"].toString()
description = """
<p>Generate Jetpack Compose Vector Icons from SVG files in Intellij IDEA and preview them</p>
<p>This plugin is a wrapper for the <a href="https://github.com/DevSrSouza/svg-to-compose">svg-to-compose tool</a></p>
<p>Use cases:</p>
<ul>
<li>Manipulate dynamic an SVG file in code, you can generate and do source code modifications</li>
<li>Create an Icon pack similar to how Material Icons works on Compose</li>
<li>Preview the generated ImageVector icons
</ul>
""".trimIndent()
changeNotes = properties["change-notes"].toString()
vendor {
name = properties["vendor-name"].toString()
email = properties["vendor-email"].toString()
}
ideaVersion {
sinceBuild = properties["since-build"].toString()
untilBuild = properties["until-build"].toString()
}
}
publishing {
token = environment("PUBLISH_TOKEN")
}
signing {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}
pluginVerification {
ides {
recommended()
}
}
}

kotlin {
jvmToolchain(properties["jvm-version"].toString().toInt())
}

tasks {
signPlugin {
certificateChain.set(environment("CERTIFICATE_CHAIN"))
privateKey.set(environment("PRIVATE_KEY"))
password.set(environment("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
token.set(environment("PUBLISH_TOKEN"))
}
patchPluginXml {
sinceBuild.set(project.properties["since-build"].toString())
untilBuild.set(project.properties["until-build"].toString())
changeNotes.set(project.properties["change-notes"].toString())
}
test {
useJUnit()
compose.desktop {
application {
nativeDistributions {
linux {
modules("jdk.security.auth")
}
}
}
}

tasks {
runIde {
systemProperties["org.jetbrains.jewel.debug"] = "true"
}
Expand Down
24 changes: 24 additions & 0 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,27 @@ style:
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
excludeImports:
- 'java.util.*'

compose:
ReusedModifierInstance:
active: true
UnnecessaryEventHandlerParameter:
active: true
ComposableEventParameterNaming:
active: true
ComposableParametersOrdering:
active: true
ModifierHeightWithText:
active: true
MissingModifierDefaultValue:
active: true
PublicComposablePreview:
active: true
TopLevelComposableFunctions:
active: true
allowInObjects: false
ComposableFunctionName:
active: true
ConditionCouldBeLifted:
active: true
ignoreCallsWithArgumentNames: [ 'modifier', 'contentAlignment' ]
16 changes: 12 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
version=0.16
# Infrastructure
jvm-version=17
since-build=232.8660.185
until-build=242.*
change-notes=Bug fixes
# Plugin
version=0.17
platform-type=IC
platform-version=2024.1
since-build=241
until-build=243.*
change-notes=Update Intellij Platform Plugin to 2.0
plugin-id=by.overpass.svg-to-compose-intellij
plugin-name=Svg to Compose
vendor-name=overpass
vendor-email=[email protected]
21 changes: 11 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
[versions]
kotlin = "1.9.23"
kotlin = "2.0.20"
intellij = "1.17.2"
intellij-platform = "2.0.1"
detekt = "1.23.5"
junit = "4.13.2"
kotlin-coroutines = "1.7.3"
svg-to-compose = "0.8.1"
mockito-kotlin = "5.0.0"
jewel = "0.15.2.2"
jewel-compose-utils = "0.6.3"
compose-desktop = "1.6.1"
jewel = "0.24.2"
compose-desktop = "1.7.0-beta01"
file-picker = "3.1.0"
turbine = "1.0.0"
detekt-compose-rules = "1.4.0"

[libraries]
kotlin-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
svg-to-compose = { group = "com.github.DevSrSouza", name = "svg-to-compose", version.ref = "svg-to-compose" }
jewel-ide-laf-bridge-232 = { group = "org.jetbrains.jewel", name = "jewel-ide-laf-bridge-232", version.ref = "jewel" }
jewel-compose-utils = { group = "org.jetbrains.jewel", name = "jewel-compose-utils", version.ref = "jewel-compose-utils" }
jewel-ide-laf-bridge-241 = { group = "org.jetbrains.jewel", name = "jewel-ide-laf-bridge-241", version.ref = "jewel" }
compose-multiplatform-file-picker = { group = "com.darkrockstudios", name = "mpfilepicker", version.ref = "file-picker" }
detekt-compose-rules = { module = "ru.kode:detekt-rules-compose", version.ref = "detekt-compose-rules" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version.ref = "mockito-kotlin" }
kotlin-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlin-coroutines" }
turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" }

[plugins]
intellij = { id = "org.jetbrains.intellij", version.ref = "intellij" }
intellij-platform = { id = "org.jetbrains.intellij.platform", version.ref = "intellij-platform" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
compose-desktop = { id = "org.jetbrains.compose", version.ref = "compose-desktop" }
compose-desktop = { id = "org.jetbrains.compose", version.ref = "compose-desktop" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import by.overpass.svgtocomposeintellij.generator.presentation.SvgToComposeViewM
import by.overpass.svgtocomposeintellij.generator.presentation.validation.CantBeEmptyStringValidator
import by.overpass.svgtocomposeintellij.generator.presentation.validation.ProperDirValidator
import by.overpass.svgtocomposeintellij.generator.ui.SvgToComposeDialog
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand Down Expand Up @@ -37,6 +38,9 @@ class SvgToComposeAction : AnAction() {
).show()
}

override fun getActionUpdateThread(): ActionUpdateThread =
ActionUpdateThread.BGT

private val AnActionEvent.targetDir: File?
get() {
val dataContext = dataContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface VectorImageTypeDetector {

override fun detect(path: String): VectorImageType? {
val files = File(path)
.listFiles { file -> !file.isHidden }
.listFiles { file -> !file.isHidden && !file.name.startsWith(".") }
?: return null
return if (files.all { file -> file.extension == "svg" }) {
VectorImageType.SVG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.boundsInWindow
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInWindow
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Popup
Expand All @@ -42,19 +41,14 @@ import org.jetbrains.jewel.foundation.theme.OverrideDarkMode
import org.jetbrains.jewel.ui.component.styling.TooltipStyle
import org.jetbrains.jewel.ui.theme.tooltipStyle
import org.jetbrains.jewel.ui.util.isDark
import org.jetbrains.jewel.ui.component.TooltipPlacement as JewelTooltipPlacement

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun OptionalTooltip(
tooltip: (@Composable () -> Unit)?,
modifier: Modifier = Modifier,
style: TooltipStyle = JewelTheme.tooltipStyle,
tooltipPlacement: TooltipPlacement = JewelTooltipPlacement(
contentOffset = style.metrics.tooltipOffset,
alignment = style.metrics.tooltipAlignment,
density = LocalDensity.current,
),
tooltipPlacement: TooltipPlacement = style.metrics.placement,
content: @Composable () -> Unit,
) {
OptionalTooltipArea(
Expand Down
Loading

0 comments on commit 0f3d4c8

Please sign in to comment.