Skip to content

Commit

Permalink
Compatibility 233 (open-policy-agent#164)
Browse files Browse the repository at this point in the history
* tests: bump opa version to v0.59.0
* Compatibility 233 upgrade
* clean code: "constructor SoftReference<T : Any" is deprecated.
* clean code: Deprecated method com.intellij.ui.dsl.builder.Cell.horizontalAlign(HorizontalAlign) invocation
* clean code: Deprecated method com.intellij.util.io.isFile

Signed-off-by: Vincent Gramer <vgramer@gmail.com>
  • Loading branch information
vgramer committed Dec 6, 2023
1 parent 793e4e3 commit 2db8a03
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Download OPA
run: |
OPA_VERSION=v0.47.4
OPA_VERSION=v0.59.0
mkdir -p /tmp/opa_bin
curl -L -o /tmp/opa_bin/opa https://github.com/open-policy-agent/opa/releases/download/$OPA_VERSION/opa_linux_amd64
chmod +x /tmp/opa_bin/opa
Expand Down Expand Up @@ -96,10 +96,10 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Verify plugin binany compatibility
- name: Verify plugin binary compatibility
run: ./gradlew :plugin:runPluginVerifier

# This job is successful if all depend jobs are successful. To be able to merge the PR, this job must be successful
# This job is successful if all dependent jobs are successful. To be able to merge the PR, this job must be successful
all-checks:
needs: [build, check-license, check-gradle-wrapper, verify]
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ idea {

plugins {
idea
kotlin("jvm") version "1.9.0"
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.grammarkit") version "2021.2.2"
kotlin("jvm") version "1.9.21"
id("org.jetbrains.intellij") version "1.16.1"
id("org.jetbrains.grammarkit") version "2022.3.1"
}

allprojects {
Expand Down Expand Up @@ -176,15 +176,15 @@ project(":") {
}

val generateRegoLexer = task<GenerateLexerTask>("generateRegoLexer") {
source.set("src/main/grammar/RegoLexer.flex")
sourceFile.set(file("src/main/grammar/RegoLexer.flex"))
targetDir.set("src/main/gen/org/openpolicyagent/ideaplugin/lang/lexer")
targetClass.set("_RegoLexer")
purgeOldFiles.set(true)
}


val generateRegoParser = task<GenerateParserTask>("generateRegoParser") {
source.set("src/main/grammar/Rego.bnf")
sourceFile.set(file("src/main/grammar/Rego.bnf"))
targetRoot.set("src/main/gen")
pathToParser.set("/org/openpolicyagent/ideaplugin/lang/parser/RegoParser.java")
pathToPsiRoot.set("/org/openpolicyagent/ideaplugin/lang/psi")
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ kotlin.code.style=official
baseIDE=idea

# if you change the version of ide, also change psiViewerPluginVersion accordingly (cf https://plugins.jetbrains.com/plugin/227-psiviewer/versions)
ideaVersion=IC-2023.1
pycharmCommunityVersion=PC-2023.1
psiViewerPluginVersion=231-SNAPSHOT
ideaVersion=IC-2023.2
pycharmCommunityVersion=PC-2023.2
psiViewerPluginVersion=232.2

# see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for more information
sinceBuild=231
untilBuild=232.*
sinceBuild=232
untilBuild=233.*

# these two variables will be overwritten by the release process (i.e. the GitHub action) thanks to the env variables:
# - ORG_GRADLE_PROJECT_publishToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import com.intellij.execution.runners.ExecutionEnvironment
import com.intellij.openapi.options.SettingsEditor
import com.intellij.openapi.project.Project
import com.intellij.util.execution.ParametersListUtil
import com.intellij.util.io.isFile
import org.jdom.Element
import org.openpolicyagent.ideaplugin.ide.runconfig.ui.OpaEvalRunCommandEditor
import org.openpolicyagent.ideaplugin.openapiext.readPath
import org.openpolicyagent.ideaplugin.openapiext.readString
import org.openpolicyagent.ideaplugin.openapiext.writePath
import org.openpolicyagent.ideaplugin.openapiext.writeString
import java.nio.file.Path
import kotlin.io.path.isRegularFile

/**
* the opa eval configuration
*
* we don't use the options mechanism to persist configuration like in tutorial because its create another class a bit
* painful to maintain and we had some problems on the restore of parameters
* we don't use the options mechanism to persist configuration like in tutorial because it creates another class a bit
* painful to maintain, and we had some problems on the restore of parameters
*
* @link https://www.jetbrains.org/intellij/sdk/docs/basics/run_configurations.html
*/
Expand Down Expand Up @@ -75,7 +75,7 @@ class OpaEvalRunConfiguration(
throw RuntimeConfigurationError("Query can not be empty")
}

if (input == null || !input!!.isFile()) {
if (input == null || !input!!.isRegularFile()) {
throw RuntimeConfigurationError("Input must be a path to a file")
}

Expand All @@ -90,7 +90,7 @@ class OpaEvalRunConfiguration(
}

bundleDir?.let {
if (it.isFile()) {
if (it.isRegularFile()) {
throw RuntimeConfigurationError("Bundle directory must be a directory")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.intellij.execution.runners.ExecutionEnvironment
import com.intellij.openapi.options.SettingsEditor
import com.intellij.openapi.project.Project
import com.intellij.util.execution.ParametersListUtil
import com.intellij.util.io.isFile
import kotlin.io.path.isRegularFile
import org.jdom.Element
import org.openpolicyagent.ideaplugin.ide.runconfig.test.ui.OpaTestRunCommandEditor
import org.openpolicyagent.ideaplugin.openapiext.readPath
Expand All @@ -23,8 +23,8 @@ import java.nio.file.Path
/**
* the opa test configuration
*
* we don't use the options mechanism to persist configuration like in tutorial because its create another class a bit
* painful to maintain and we had some problems on the restore of parameters
* we don't use the options mechanism to persist configuration like in tutorial because it creates another class a bit
* painful to maintain, and we had some problems on the restore of parameters
*
* @link https://www.jetbrains.org/intellij/sdk/docs/basics/run_configurations.html
*/
Expand Down Expand Up @@ -63,7 +63,7 @@ class OpaTestRunConfiguration(
throw RuntimeConfigurationError("Only format option (-f or --format) = pretty is handle by plugin")
}

if (bundleDir == null || bundleDir!!.isFile()) {
if (bundleDir == null || bundleDir!!.isRegularFile()) {
throw RuntimeConfigurationError("Bundle directory must be a directory")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.ui.TextBrowseFolderListener
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.ui.RawCommandLineEditor
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
import com.intellij.util.text.nullize
import org.openpolicyagent.ideaplugin.ide.runconfig.test.OpaTestRunConfiguration
import java.nio.file.Path
Expand All @@ -42,15 +42,15 @@ class OpaTestRunCommandEditor(private val project: Project) : SettingsEditor<Opa

override fun createEditor() = panel {
row("Bundle:") {
cell(bundle).horizontalAlign(HorizontalAlign.FILL)
cell(bundle).align(AlignX.FILL)
}

row("Additional Args:") {
cell(additionalArgs).horizontalAlign(HorizontalAlign.FILL)
cell(additionalArgs).align(AlignX.FILL)
}

row(environmentVariables.label) {
cell(environmentVariables).horizontalAlign(HorizontalAlign.FILL)
cell(environmentVariables).align(AlignX.FILL)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.intellij.openapi.ui.TextBrowseFolderListener
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.ui.RawCommandLineEditor
import com.intellij.ui.components.JBTextField
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.panel
import com.intellij.util.text.nullize
import org.openpolicyagent.ideaplugin.ide.runconfig.OpaEvalRunConfiguration
Expand Down Expand Up @@ -49,23 +49,23 @@ class OpaEvalRunCommandEditor(private val project: Project) : SettingsEditor<Opa

override fun createEditor() = panel {
row("Query:") {
cell(query).horizontalAlign(HorizontalAlign.FILL)
cell(query).align(AlignX.FILL)
}

row("Input:") {
cell(input).horizontalAlign(HorizontalAlign.FILL)
cell(input).align(AlignX.FILL)
}

row("Bundle:") {
cell(bundle).horizontalAlign(HorizontalAlign.FILL)
cell(bundle).align(AlignX.FILL)
}

row("Additional Args:") {
cell(additionalArgs).horizontalAlign(HorizontalAlign.FILL)
cell(additionalArgs).align(AlignX.FILL)
}

row(environmentVariables.label) {
cell(environmentVariables).horizontalAlign(HorizontalAlign.FILL)
cell(environmentVariables).align(AlignX.FILL)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package org.openpolicyagent.ideaplugin.opa.project.settings
import com.intellij.openapi.options.BoundSearchableConfigurable
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.gridLayout.HorizontalAlign

import com.intellij.ui.dsl.builder.panel

Expand All @@ -27,7 +27,7 @@ class OpaOptionsConfigurable(private val project: Project) :
row("OPA check options:") {
textField()
.bindText(settings::opaCheckOptions)
.horizontalAlign(HorizontalAlign.FILL)
.align(AlignX.FILL)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import com.intellij.psi.*
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StubIndex
import com.intellij.psi.stubs.StubIndexKey
import com.intellij.reference.SoftReference
import org.openpolicyagent.ideaplugin.lang.psi.isNotRegoFile
import java.lang.ref.SoftReference
import java.lang.reflect.Field
import java.nio.file.Path
import java.nio.file.Paths
Expand Down

0 comments on commit 2db8a03

Please sign in to comment.