Skip to content

Commit

Permalink
Split legacy UI to own branch (#254)
Browse files Browse the repository at this point in the history
* Upgrade minimal IJ version to 2022.1.4

* Make links more prominent

* Add steps to publish android maintainance releases
  • Loading branch information
arturbosch committed Aug 16, 2022
1 parent c4bbdaa commit f500764
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 237 deletions.
10 changes: 8 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
- Manually verify the plugin through `./gradlew runIde`
- Run `./gradlew build`
- Run `./gradlew publishPlugin` (Required system environment variable ORG_GRADLE_PROJECT_intellijPublishToken)
- Visit https://plugins.jetbrains.com/plugin/10761-detekt to verify the plugin is approved and released
- Visit [Marketplace](https://plugins.jetbrains.com/plugin/10761-detekt) to verify the plugin is approved and released
- Run `./gradlew githubRelease` (Required gradle property `github.token`)
- Visit https://github.com/detekt/detekt-intellij-plugin to verify the release is created on Github
- Visit [Github](https://github.com/detekt/detekt-intellij-plugin) to verify the release is created on Github

# Android

- Check out `2021.2.1-android-branch`
- Add `-android` suffix to the version
- Repeat releasing steps
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ intellij {
}

tasks.runPluginVerifier {
ideVersions.set(listOf("2020.3", "2020.3.4", "2021.1.3", "2021.2.4", "2021.3.3", "2022.1.4", "2022.2"))
ideVersions.set(listOf("2022.1.4", "2022.2"))
failureLevel.set(listOf(DEPRECATED_API_USAGES, INVALID_PLUGIN))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import com.intellij.openapi.options.BoundSearchableConfigurable
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import io.gitlab.arturbosch.detekt.idea.DetektBundle
import io.gitlab.arturbosch.detekt.idea.config.ui.LegacyDetektConfigUiProvider
import io.gitlab.arturbosch.detekt.idea.config.ui.NewDetektConfigUiProvider
import io.gitlab.arturbosch.detekt.idea.util.PluginUtils

class DetektConfig(private val project: Project) : BoundSearchableConfigurable(
displayName = DetektBundle.message("detekt.configuration.title"),
Expand All @@ -19,22 +17,11 @@ class DetektConfig(private val project: Project) : BoundSearchableConfigurable(
private val settings = project.service<DetektPluginSettings>()

override fun createPanel(): DialogPanel {
// The Kotlin V2 UI DSL is only available on platform versions 2021.3 and onwards
val ui = if (PluginUtils.isAtLeastIJBuild(MIN_KOTLIN_DSL_V2_IJ_VERSION)) {
NewDetektConfigUiProvider(settings, project)
} else {
LegacyDetektConfigUiProvider(settings, project)
}
return ui.createPanel()
return NewDetektConfigUiProvider(settings, project).createPanel()
}

override fun apply() {
super.apply()
DaemonCodeAnalyzer.getInstance(project).restart()
}

companion object {

private const val MIN_KOTLIN_DSL_V2_IJ_VERSION = "213.5744.223"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import kotlin.reflect.KMutableProperty0
@Suppress("DialogTitleCapitalization") // It gets tripped up by the capitalization of Detekt's name
internal class NewDetektConfigUiProvider(
private val settings: DetektPluginSettings,
private val project: Project
private val project: Project,
) : DetektConfigUiProvider {

override fun createPanel(): DialogPanel = panel {
Expand All @@ -49,14 +49,10 @@ internal class NewDetektConfigUiProvider(
filesGroup(detektEnabledCheckbox.selected)
}

// TODO replace with newer overload once the min IJ version is >= 22.1
// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
@Suppress("UnstableApiUsage", "MissingRecentApi", "Deprecation")
private fun Panel.rulesGroup(enabled: ComponentPredicate) =
group(
title = DetektBundle.message("detekt.configuration.rulesGroup.title"),
indent = false,
topGroupGap = false
) {
row {
checkBox(DetektBundle.message("detekt.configuration.buildUponDefaultConfig"))
Expand All @@ -72,15 +68,10 @@ internal class NewDetektConfigUiProvider(
}
}.enabledIf(enabled)

// TODO replace with newer overload once the min IJ version is >= 22.1
// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
// UnstableApiUsage: some calls have a newer overload in IJ 22.1+
@Suppress("UnstableApiUsage", "MissingRecentApi", "Deprecation")
private fun Panel.filesGroup(enabled: ComponentPredicate) =
group(
title = DetektBundle.message("detekt.configuration.filesGroup.title"),
indent = false,
topGroupGap = false
) {
configurationFilesRow(enabled)

Expand All @@ -89,9 +80,6 @@ internal class NewDetektConfigUiProvider(
pluginJarsRow(enabled)
}

// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
// UnstableApiUsage: some calls have a newer overload in IJ 22.1 and later
@Suppress("MissingRecentApi", "UnstableApiUsage")
private fun Panel.configurationFilesRow(enabled: ComponentPredicate) {
row {
val label = label(DetektBundle.message("detekt.configuration.configurationFiles.title"))
Expand All @@ -108,8 +96,7 @@ internal class NewDetektConfigUiProvider(
descriptorProvider = { FileChooserDescriptorUtil.createYamlChooserDescriptor() }
).decorated()

@Suppress("DEPRECATION") // TODO replace with newer overload once the min IJ version is >= 22.1
cell(filesListPanel, filesListPanel)
cell(filesListPanel)
.horizontalAlign(HorizontalAlign.FILL)
.resizableColumn()
.enabledIf(enabled)
Expand All @@ -123,9 +110,6 @@ internal class NewDetektConfigUiProvider(
}.bottomGap(BottomGap.MEDIUM)
}

// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
// UnstableApiUsage: some calls have a newer overload in IJ 22.1 and later
@Suppress("MissingRecentApi", "UnstableApiUsage")
private fun Panel.baselineFileRow(enabled: ComponentPredicate) {
row(DetektBundle.message("detekt.configuration.baselineFile.title")) {
textFieldWithBrowseButton(
Expand Down Expand Up @@ -155,9 +139,6 @@ internal class NewDetektConfigUiProvider(
}.bottomGap(BottomGap.MEDIUM)
}

// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
// UnstableApiUsage: some calls have a newer overload in IJ 22.1 and later
@Suppress("MissingRecentApi", "UnstableApiUsage")
private fun Panel.pluginJarsRow(enabled: ComponentPredicate) {
row {
val label = label(DetektBundle.message("detekt.configuration.pluginJarFiles.title"))
Expand All @@ -174,8 +155,7 @@ internal class NewDetektConfigUiProvider(
descriptorProvider = { FileChooserDescriptorUtil.createJarsChooserDescriptor() }
).decorated()

@Suppress("DEPRECATION") // TODO replace with newer overload once the min IJ version is >= 22.1
cell(filesListPanel, filesListPanel)
cell(filesListPanel)
.horizontalAlign(HorizontalAlign.FILL)
.resizableColumn()
.enabledIf(enabled)
Expand All @@ -189,11 +169,9 @@ internal class NewDetektConfigUiProvider(
}
}

// MissingRecentApi: this is only meant to be used on IJ 21.3 and later
@Suppress("MissingRecentApi")
private fun Cell<JPanel>.bindItems(
fileSetProperty: KMutableProperty0<MutableSet<String>>,
listModel: FilesListPanel.ListModel
listModel: FilesListPanel.ListModel,
) {
bind(
{ listModel.items },
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<depends>com.intellij.modules.lang</depends>

<idea-version since-build="203.5981.155" />
<idea-version since-build="221.4842.29" />

<extensions defaultExtensionNs="com.intellij">
<errorHandler implementation="io.gitlab.arturbosch.detekt.idea.util.GitHubErrorReporting"/>
Expand Down

0 comments on commit f500764

Please sign in to comment.