diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fe5b367e7..2f9453a35 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,7 +10,7 @@ jobs: tests: strategy: matrix: - gradle-properties-version: [ 233, 241 ] + gradle-properties-version: [ 233, 241, 242 ] runs-on: ubuntu-latest env: @@ -60,7 +60,7 @@ jobs: uses: gradle/gradle-build-action@v2.7.0 with: gradle-version: wrapper - arguments: ":plugin:verifyPluginConfiguration -Pkotlin.incremental=false --no-daemon" + arguments: ":verifyPluginConfiguration -Pkotlin.incremental=false --no-daemon" gradle-home-cache-excludes: | caches/modules-2/files-2.1/com.jetbrains.intellij.pycharm caches/modules-2/files-2.1/com.jetbrains.intellij.idea @@ -70,7 +70,7 @@ jobs: uses: gradle/gradle-build-action@v2.7.0 with: gradle-version: wrapper - arguments: ":plugin:runPluginVerifier -Pkotlin.incremental=false --no-daemon" + arguments: ":verifyPlugin -Pkotlin.incremental=false --no-daemon" gradle-home-cache-excludes: | caches/modules-2/files-2.1/com.jetbrains.intellij.pycharm caches/modules-2/files-2.1/com.jetbrains.intellij.idea diff --git a/.gitignore b/.gitignore index 8e5aadc6b..e6e326446 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ src/main/gen/ /dove deps/ bin/ +.intellijPlatform \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d17a3fbaf..75171ecf0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,12 @@ -import org.jetbrains.intellij.tasks.PrepareSandboxTask -import org.jetbrains.intellij.tasks.RunPluginVerifierTask +import org.jetbrains.intellij.platform.gradle.TestFrameworkType +import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.ByteArrayOutputStream import java.util.* val publishingToken = System.getenv("JB_PUB_TOKEN") ?: null val publishingChannel = System.getenv("JB_PUB_CHANNEL") ?: "default" + // set by default in Github Actions val isCI = System.getenv("CI") != null @@ -13,6 +14,8 @@ fun prop(name: String): String = extra.properties[name] as? String ?: error("Property `$name` is not defined in gradle.properties for environment `$shortPlatformVersion`") +fun propOrNull(name: String): String? = extra.properties[name] as? String + fun gitCommitHash(): String { val byteOut = ByteArrayOutputStream() project.exec { @@ -40,7 +43,8 @@ fun gitTimestamp(): String { } val shortPlatformVersion = prop("shortPlatformVersion") -val codeVersion = "1.37.0" +val useInstaller = prop("useInstaller").toBooleanStrict() +val codeVersion = "1.37.1" var pluginVersion = "$codeVersion.$shortPlatformVersion" if (publishingChannel != "default") { @@ -52,6 +56,7 @@ if (publishingChannel != "default") { val pluginGroup = "org.move" val javaVersion = JavaVersion.VERSION_17 +val pluginName = "intellij-move" val pluginJarName = "intellij-move-$pluginVersion" val kotlinReflectVersion = "1.9.10" @@ -65,50 +70,46 @@ version = pluginVersion plugins { id("java") kotlin("jvm") version "1.9.22" - id("org.jetbrains.intellij") version "1.17.3" + id("org.jetbrains.intellij.platform") version "2.0.0-rc1" id("org.jetbrains.grammarkit") version "2022.3.2.2" id("net.saliman.properties") version "1.5.2" id("org.gradle.idea") id("de.undercouch.download") version "5.5.0" } -dependencies { - implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinReflectVersion") - - implementation("io.sentry:sentry:7.2.0") { - exclude("org.slf4j") - } - implementation("com.github.ajalt.clikt:clikt:3.5.2") -} - allprojects { apply { plugin("kotlin") plugin("org.jetbrains.grammarkit") - plugin("org.jetbrains.intellij") + plugin("org.jetbrains.intellij.platform") plugin("de.undercouch.download") } repositories { mavenCentral() - maven("https://cache-redirector.jetbrains.com/intellij-dependencies") gradlePluginPortal() + intellijPlatform { + defaultRepositories() + jetbrainsRuntime() + } } - intellij { - pluginName.set(pluginJarName) - type.set(prop("platformType")) - - downloadSources.set(!isCI) - instrumentCode.set(false) - ideaDependencyCachePath.set(dependencyCachePath) - - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins.set(prop("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + dependencies { + implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinReflectVersion") - version.set(prop("platformVersion")) -// localPath.set("/home/mkurnikov/pontem-ide/pontem-ide-2023.2/") -// localSourcesPath.set("/home/mkurnikov/pontem-ide/pontem-232.SNAPSHOT-source") + implementation("io.sentry:sentry:7.2.0") { + exclude("org.slf4j") + } + implementation("com.github.ajalt.clikt:clikt:3.5.2") + testImplementation("junit:junit:4.13.2") + + intellijPlatform { + create(prop("platformType"), prop("platformVersion"), useInstaller = useInstaller) + testFramework(TestFrameworkType.Platform) + pluginVerifier() + bundledPlugin("org.toml.lang") + jetbrainsRuntimeExplicit("jbr_jcef-17.0.11-linux-x64-b1207.30") + } } configure { @@ -132,6 +133,55 @@ allprojects { } } + intellijPlatform { + pluginConfiguration { + version.set(pluginVersion) + ideaVersion { + sinceBuild.set(prop("pluginSinceBuild")) + untilBuild.set(prop("pluginUntilBuild")) + } + + val codeVersionForUrl = codeVersion.replace('.', '-') + changeNotes.set( + """ + +

+ Changelog for the Intellij-Move $codeVersion +

+ + """ + ) + } + + instrumentCode.set(false) + + publishing { + token.set(publishingToken) + channels.set(listOf(publishingChannel)) + } + + verifyPlugin { + ides { + recommended() + } +// if ("SNAPSHOT" !in shortPlatformVersion) { +// ides { +// ide(prop("verifierIdeVersion").trim()) +// } +// } + failureLevel.set( + EnumSet.complementOf( + EnumSet.of( + // these are the only issues we tolerate + VerifyPluginTask.FailureLevel.DEPRECATED_API_USAGES, + VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES, + VerifyPluginTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES, + ) + ) + ) + } + } + tasks { withType { kotlinOptions { @@ -142,12 +192,6 @@ allprojects { } } - // All these tasks don't make sense for non-root subprojects - // Root project (i.e. `:plugin`) enables them itself if needed - runIde { enabled = false } - prepareSandbox { enabled = false } - buildSearchableOptions { enabled = false } - withType { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } @@ -188,12 +232,7 @@ allprojects { } } } - } -} - -project(":") { - tasks { generateLexer { sourceFile.set(file("src/main/grammars/MoveLexer.flex")) targetOutputDir.set(file("src/main/gen/org/move/lang")) @@ -209,153 +248,84 @@ project(":") { withType { dependsOn(generateLexer, generateParser) } - } - - task("resolveDependencies") { - doLast { - rootProject.allprojects - .map { it.configurations } - .flatMap { it.filter { c -> c.isCanBeResolved } } - .forEach { it.resolve() } - } - } - - idea { - pathVariables(mapOf("USER_HOME" to file("/home/mkurnikov"))) - module { - name = "intellij-move.main" - } - } -} - -project(":plugin") { - dependencies { - implementation(project(":")) - } - - tasks { - patchPluginXml { - version.set(pluginVersion) - val codeVersionForUrl = codeVersion.replace('.', '-') - changeNotes.set( - """ - -

- Changelog for the Intellij-Move $codeVersion -

- - """ - ) - sinceBuild.set(prop("pluginSinceBuild")) - untilBuild.set(prop("pluginUntilBuild")) - } - - ideaModule { - enabled = false - } - runPluginVerifier { - if ("SNAPSHOT" !in shortPlatformVersion) { - ideVersions.set( - prop("verifierIdeVersions") - .split(',').map(String::trim).filter(String::isNotEmpty) - ) - } - failureLevel.set( - EnumSet.complementOf( - EnumSet.of( - // these are the only issues we tolerate - RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES, - RunPluginVerifierTask.FailureLevel.EXPERIMENTAL_API_USAGES, - RunPluginVerifierTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES, - ) - ) - ) - } - - publishPlugin { - token.set(publishingToken) - channels.set(listOf(publishingChannel)) - } runIde { - enabled = true systemProperty("org.move.debug.enabled", true) // systemProperty("org.move.external.linter.max.duration", 30) // 30 ms // systemProperty("org.move.aptos.bundled.force.unsupported", true) // systemProperty("idea.log.debug.categories", "org.move.cli") } - prepareSandbox { enabled = true } - buildSearchableOptions { - enabled = true - jbrVersion.set(prop("jbrVersion")) - } - buildPlugin { + prepareSandbox { +// enabled = true dependsOn("downloadAptosBinaries") - } - - withType { // copy bin/ directory inside the plugin zip file from("$rootDir/bin") { - into("${pluginName.get()}/bin") + into("$pluginName/bin") include("**") } } - - withType { - jbrVersion.set(prop("jbrVersion")) - - if (environment.getOrDefault("CLION_LOCAL", "false") == "true") { - val clionDir = File("/snap/clion/current") - if (clionDir.exists()) { - ideDir.set(clionDir) - } - } - } - - downloadRobotServerPlugin { - version.set(remoteRobotVersion) - } - - runIdeForUiTests { - systemProperty("robot-server.port", "8082") -// systemProperty "ide.mac.message.dialogs.as.sheets", "false" -// systemProperty "jb.privacy.policy.text", "" -// systemProperty "jb.consents.confirmation.enabled", "false" -// systemProperty "ide.mac.file.chooser.native", "false" -// systemProperty "jbScreenMenuBar.enabled", "false" -// systemProperty "apple.laf.useScreenMenuBar", "false" - systemProperty("idea.trust.all.projects", "true") - systemProperty("ide.show.tips.on.startup.default.value", "false") - } } -} - -project(":ui-tests") { - dependencies { - implementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion") - implementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion") - implementation("org.junit.jupiter:junit-jupiter-api:5.10.0") - - implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2") - testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.0") - - implementation("com.automation-remarks:video-recorder-junit5:2.0") - } - - tasks.named("test") { - useJUnitPlatform() + task("resolveDependencies") { + doLast { + rootProject.allprojects + .map { it.configurations } + .flatMap { it.filter { c -> c.isCanBeResolved } } + .forEach { it.resolve() } + } } - tasks { - ideaModule { - enabled = false + idea { + pathVariables(mapOf("USER_HOME" to file("/home/mkurnikov"))) + module { + name = "intellij-move.main" } } } +//project(":ui-tests") { +// dependencies { +// implementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion") +// implementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion") +// implementation("org.junit.jupiter:junit-jupiter-api:5.10.0") +// +// implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") +// +// testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2") +// testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.0") +// +// implementation("com.automation-remarks:video-recorder-junit5:2.0") +// } +// +// tasks.named("test") { +// useJUnitPlatform() +// } +// +// tasks { +// ideaModule { +// enabled = false +// } +// } + +// downloadRobotServerPlugin { +// version.set(remoteRobotVersion) +// } + +// runIdeForUiTests { +// systemProperty("robot-server.port", "8082") +//// systemProperty "ide.mac.message.dialogs.as.sheets", "false" +//// systemProperty "jb.privacy.policy.text", "" +//// systemProperty "jb.consents.confirmation.enabled", "false" +//// systemProperty "ide.mac.file.chooser.native", "false" +//// systemProperty "jbScreenMenuBar.enabled", "false" +//// systemProperty "apple.laf.useScreenMenuBar", "false" +// systemProperty("idea.trust.all.projects", "true") +// systemProperty("ide.show.tips.on.startup.default.value", "false") +// } + +//} + val Project.dependencyCachePath get(): String { val cachePath = file("${rootProject.projectDir}/deps") diff --git a/gradle-233.properties b/gradle-233.properties index 0483e22d5..f3bb537d3 100644 --- a/gradle-233.properties +++ b/gradle-233.properties @@ -10,4 +10,4 @@ platformVersion = 2023.3 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = org.toml.lang -verifierIdeVersions = PC-2023.3 +verifierIdeVersion = PC-2023.3 diff --git a/gradle-241.properties b/gradle-241.properties index 42e36be1b..d221db4cd 100644 --- a/gradle-241.properties +++ b/gradle-241.properties @@ -9,4 +9,4 @@ platformVersion = 2024.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = org.toml.lang -verifierIdeVersions = PC-2024.1 +verifierIdeVersion = PC-2024.1 diff --git a/gradle-242.properties b/gradle-242.properties new file mode 100644 index 000000000..73ef1cf35 --- /dev/null +++ b/gradle-242.properties @@ -0,0 +1,15 @@ +# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html +# for insight into build numbers and IntelliJ Platform versions. +pluginSinceBuild = 242 +pluginUntilBuild = 242.* + +# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties +platformType = IC +platformVersion = 242.12881.66-EAP-SNAPSHOT +# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html +# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +platformPlugins = org.toml.lang +verifierIdeVersion = PC-2024.2 + +# should be false when using EAP builds +useInstaller=false diff --git a/gradle.properties b/gradle.properties index c1a5c37d8..4069694ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,6 @@ jbrVersion=17.0.7b1000.6 propertiesPluginEnvironmentNameProperty=shortPlatformVersion # properties files # pass ORG_GRADLE_PROJECT_shortPlatformVersion environment variable to overwrite -shortPlatformVersion=233 +shortPlatformVersion=242 + +useInstaller=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4c..e6441136f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..09523c0e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca14..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85be..7101f8e46 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/plugin/src/main/resources/META-INF/plugin.xml b/plugin/src/main/resources/META-INF/plugin.xml deleted file mode 100644 index 879ff8959..000000000 --- a/plugin/src/main/resources/META-INF/plugin.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - org.move.lang - Move on Aptos - - Pontem - - - Support for Move on Aptos, smart-contract language for Aptos and other blockchains.

- -

https://github.com/pontem-network/intellij-move

- ]]> -
- - - -
diff --git a/settings.gradle.kts b/settings.gradle.kts index 886c8a92e..9bfc7a074 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,5 +7,4 @@ pluginManagement { } } -include("plugin") -include("ui-tests") +//include("ui-tests") diff --git a/src/main/kotlin/org/move/cli/MoveProjectsService.kt b/src/main/kotlin/org/move/cli/MoveProjectsService.kt index ab4ef0abb..f2da2f84b 100644 --- a/src/main/kotlin/org/move/cli/MoveProjectsService.kt +++ b/src/main/kotlin/org/move/cli/MoveProjectsService.kt @@ -20,7 +20,7 @@ import com.intellij.openapi.util.EmptyRunnable import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager -import com.intellij.openapi.vfs.ex.temp.TempFileSystem +import com.intellij.openapi.vfs.ex.temp.TempFileSystemMarker import com.intellij.psi.PsiDirectory import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile @@ -166,7 +166,7 @@ class MoveProjectsService(val project: Project): Disposable { val cached = this.fileToMoveProjectCache.get(file) if (cached is CacheEntry.Present) return cached.value - if (isUnitTestMode && file.fileSystem is TempFileSystem) return MoveProject.forTests(project) + if (isUnitTestMode && file.fileSystem is TempFileSystemMarker) return MoveProject.forTests(project) val filePath = file.toNioPathOrNull() ?: return null diff --git a/src/main/kotlin/org/move/cli/MoveProjectsSyncTask.kt b/src/main/kotlin/org/move/cli/MoveProjectsSyncTask.kt index ecfc99d60..9a263d753 100644 --- a/src/main/kotlin/org/move/cli/MoveProjectsSyncTask.kt +++ b/src/main/kotlin/org/move/cli/MoveProjectsSyncTask.kt @@ -15,6 +15,7 @@ import com.intellij.execution.process.ProcessEvent import com.intellij.icons.AllIcons import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.ActionManager +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.runReadAction import com.intellij.openapi.diagnostic.logger @@ -223,9 +224,9 @@ class MoveProjectsSyncTask( e.presentation.isEnabled = progress.isRunning } - override fun actionPerformed(e: AnActionEvent) { - progress.cancel() - } + override fun actionPerformed(e: AnActionEvent) = progress.cancel() + + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT } data class SyncContext( diff --git a/src/main/kotlin/org/move/lang/MoveFile.kt b/src/main/kotlin/org/move/lang/MoveFile.kt index e65dc18d4..054c7caeb 100644 --- a/src/main/kotlin/org/move/lang/MoveFile.kt +++ b/src/main/kotlin/org/move/lang/MoveFile.kt @@ -88,9 +88,5 @@ fun VirtualFile.toMoveFile(project: Project): MoveFile? = this.toPsiFile(project fun VirtualFile.toTomlFile(project: Project): TomlFile? = this.toPsiFile(project) as? TomlFile -fun MoveFile.isTempFile(): Boolean = - this.virtualFile == null - || this.virtualFile.fileSystem is TempFileSystem - inline fun PsiFile.elementAtOffset(offset: Int): T? = this.findElementAt(offset)?.ancestorOrSelf() diff --git a/src/main/resources/META-INF/intellij-move-core.xml b/src/main/resources/META-INF/plugin.xml similarity index 97% rename from src/main/resources/META-INF/intellij-move-core.xml rename to src/main/resources/META-INF/plugin.xml index 5cbb61de6..1348c02cf 100644 --- a/src/main/resources/META-INF/intellij-move-core.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,19 +1,19 @@ - - - + + org.move.lang + Move on Aptos - + Pontem - - - + + Support for Move on Aptos, smart-contract language for Aptos and other blockchains.

- - - +

https://github.com/pontem-network/intellij-move

+ ]]> +
- messages.MvBundle com.intellij.modules.platform diff --git a/plugin/src/main/resources/META-INF/pluginIcon.svg b/src/main/resources/META-INF/pluginIcon.svg similarity index 100% rename from plugin/src/main/resources/META-INF/pluginIcon.svg rename to src/main/resources/META-INF/pluginIcon.svg diff --git a/plugin/src/main/resources/META-INF/pluginIcon_dark.svg b/src/main/resources/META-INF/pluginIcon_dark.svg similarity index 100% rename from plugin/src/main/resources/META-INF/pluginIcon_dark.svg rename to src/main/resources/META-INF/pluginIcon_dark.svg diff --git a/src/test/kotlin/org/move/ide/inspections/compilerV2/ReplaceWithIndexExprInspectionTest.kt b/src/test/kotlin/org/move/ide/inspections/compilerV2/ReplaceWithIndexExprInspectionTest.kt index 6475d0eae..aa3057878 100644 --- a/src/test/kotlin/org/move/ide/inspections/compilerV2/ReplaceWithIndexExprInspectionTest.kt +++ b/src/test/kotlin/org/move/ide/inspections/compilerV2/ReplaceWithIndexExprInspectionTest.kt @@ -1,7 +1,6 @@ package org.move.ide.inspections.compilerV2 import org.intellij.lang.annotations.Language -import org.move.utils.tests.FileTreeBuilder import org.move.utils.tests.annotation.InspectionTestBase class ReplaceWithIndexExprInspectionTest: InspectionTestBase(ReplaceWithIndexExprInspection::class) { diff --git a/src/main/kotlin/org/move/utils/tests/Actions.kt b/src/test/kotlin/org/move/utils/tests/Actions.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/Actions.kt rename to src/test/kotlin/org/move/utils/tests/Actions.kt diff --git a/src/main/kotlin/org/move/utils/tests/AptosCliTestFixture.kt b/src/test/kotlin/org/move/utils/tests/AptosCliTestFixture.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/AptosCliTestFixture.kt rename to src/test/kotlin/org/move/utils/tests/AptosCliTestFixture.kt diff --git a/src/main/kotlin/org/move/utils/tests/FileTree.kt b/src/test/kotlin/org/move/utils/tests/FileTree.kt similarity index 94% rename from src/main/kotlin/org/move/utils/tests/FileTree.kt rename to src/test/kotlin/org/move/utils/tests/FileTree.kt index a8b63a678..7c4e76678 100644 --- a/src/main/kotlin/org/move/utils/tests/FileTree.kt +++ b/src/test/kotlin/org/move/utils/tests/FileTree.kt @@ -22,6 +22,8 @@ import org.move.lang.core.resolve.ref.MvReferenceElement import org.move.openapiext.document import org.move.openapiext.fullyRefreshDirectory import org.move.openapiext.toPsiFile +import org.move.utils.tests.FilesystemEntry.Directory +import org.move.utils.tests.FilesystemEntry.File import org.move.utils.tests.resolve.TestResolveResult import org.move.utils.tests.resolve.checkResolvedFile @@ -45,19 +47,19 @@ fun fileTreeFromText(@Language("Move") text: String): FileTree { "Have you placed `//- filename.rs` markers?" } - fun fillDirectory(dir: FilesystemEntry.Directory, path: List, contents: String) { + fun fillDirectory(dir: Directory, path: List, contents: String) { val name = path.first() if (path.size == 1) { - dir.children[name] = FilesystemEntry.File(contents) + dir.children[name] = File(contents) } else { val childDir = - dir.children.getOrPut(name) { FilesystemEntry.Directory(mutableMapOf()) } as FilesystemEntry.Directory + dir.children.getOrPut(name) { Directory(mutableMapOf()) } as Directory fillDirectory(childDir, path.drop(1), contents) } } val filesInfo = - FilesystemEntry.Directory(mutableMapOf()).apply { + Directory(mutableMapOf()).apply { val dirFiles = fileNames.map { it.split("/") }.zip(fileTexts) for ((path, contents) in dirFiles) { fillDirectory(this, path, contents) @@ -147,20 +149,20 @@ ${profilesYaml.joinToString("\n")} } } -class FileTree(val rootDirInfo: FilesystemEntry.Directory) { +class FileTree(val rootDirInfo: Directory) { fun create(project: Project, directory: VirtualFile): TestProject { val filesWithCaret: MutableList = mutableListOf() val filesWithNamedElement: MutableList = mutableListOf() fun prepareFilesFromInfo( - dirInfo: FilesystemEntry.Directory, + dirInfo: Directory, root: VirtualFile, parentComponents: List = emptyList() ) { for ((name, fsEntry) in dirInfo.children) { val pathComponents = parentComponents + name when (fsEntry) { - is FilesystemEntry.File -> { + is File -> { val vFile = root.findChild(name) ?: root.createChildData(root, name) VfsUtil.saveText(vFile, replaceCaretMarker(fsEntry.text)) @@ -172,7 +174,7 @@ class FileTree(val rootDirInfo: FilesystemEntry.Directory) { filesWithNamedElement += filePath } } - is FilesystemEntry.Directory -> { + is Directory -> { prepareFilesFromInfo(fsEntry, root.createChildDirectory(root, name), pathComponents) } } @@ -272,10 +274,10 @@ private class FileTreeBuilderImpl( override fun file(name: String, code: String) { check('/' !in name && '.' in name) { "Bad file name `$name`" } - directory[name] = FilesystemEntry.File(code.trimIndent()) + directory[name] = File(code.trimIndent()) } - fun intoDirectory() = FilesystemEntry.Directory(directory) + fun intoDirectory() = Directory(directory) } sealed class FilesystemEntry { diff --git a/src/main/kotlin/org/move/utils/tests/HighlightFilterTestBase.kt b/src/test/kotlin/org/move/utils/tests/HighlightFilterTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/HighlightFilterTestBase.kt rename to src/test/kotlin/org/move/utils/tests/HighlightFilterTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/InlineFile.kt b/src/test/kotlin/org/move/utils/tests/InlineFile.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/InlineFile.kt rename to src/test/kotlin/org/move/utils/tests/InlineFile.kt diff --git a/src/main/kotlin/org/move/utils/tests/MoveDocumentationProviderTestCase.kt b/src/test/kotlin/org/move/utils/tests/MoveDocumentationProviderTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MoveDocumentationProviderTestCase.kt rename to src/test/kotlin/org/move/utils/tests/MoveDocumentationProviderTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MoveIntentionTestCase.kt b/src/test/kotlin/org/move/utils/tests/MoveIntentionTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MoveIntentionTestCase.kt rename to src/test/kotlin/org/move/utils/tests/MoveIntentionTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MoveTomlCompletionTestBase.kt b/src/test/kotlin/org/move/utils/tests/MoveTomlCompletionTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MoveTomlCompletionTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MoveTomlCompletionTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MvFormatterTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvFormatterTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MvFormatterTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvFormatterTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MvLexerTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvLexerTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MvLexerTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvLexerTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MvLightTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt similarity index 90% rename from src/main/kotlin/org/move/utils/tests/MvLightTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt index 1aaaf6c31..be36d86c8 100644 --- a/src/main/kotlin/org/move/utils/tests/MvLightTestBase.kt +++ b/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt @@ -1,7 +1,6 @@ package org.move.utils.tests import com.intellij.testFramework.fixtures.BasePlatformTestCase -import org.move.cli.settings.moveSettings abstract class MvLightTestBase: BasePlatformTestCase() { override fun setUp() { diff --git a/src/main/kotlin/org/move/utils/tests/MvProjectTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt similarity index 99% rename from src/main/kotlin/org/move/utils/tests/MvProjectTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt index 4da013c1f..a1c129b85 100644 --- a/src/main/kotlin/org/move/utils/tests/MvProjectTestBase.kt +++ b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt @@ -16,7 +16,6 @@ import com.intellij.util.ui.UIUtil import org.intellij.lang.annotations.Language import org.jetbrains.annotations.TestOnly import org.move.cli.moveProjectsService -import org.move.cli.settings.moveSettings import org.move.openapiext.toPsiDirectory import org.move.openapiext.toPsiFile import org.move.openapiext.toVirtualFile diff --git a/src/main/kotlin/org/move/utils/tests/MvSelectionHandlerTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvSelectionHandlerTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MvSelectionHandlerTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvSelectionHandlerTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MvTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MvTestBase.kt rename to src/test/kotlin/org/move/utils/tests/MvTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/MvTypingTestCase.kt b/src/test/kotlin/org/move/utils/tests/MvTypingTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/MvTypingTestCase.kt rename to src/test/kotlin/org/move/utils/tests/MvTypingTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt b/src/test/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt similarity index 97% rename from src/main/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt rename to src/test/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt index f3a0d46ae..9d8549bb8 100644 --- a/src/main/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt +++ b/src/test/kotlin/org/move/utils/tests/ParameterInfoHandlerTestCase.kt @@ -1,3 +1,4 @@ + package org.move.utils.tests import com.intellij.lang.parameterInfo.ParameterInfoHandler @@ -7,7 +8,7 @@ import com.intellij.testFramework.utils.parameterInfo.MockParameterInfoUIContext import com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext import org.intellij.lang.annotations.Language -open class ParameterInfoHandlerTestCase( +abstract class ParameterInfoHandlerTestCase( private val handler: ParameterInfoHandler, ) : MvTestBase() { protected fun checkByText(@Language("Move") code: String, hint: String, index: Int) = diff --git a/src/main/kotlin/org/move/utils/tests/RunConfigurationProducerTestBase.kt b/src/test/kotlin/org/move/utils/tests/RunConfigurationProducerTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/RunConfigurationProducerTestBase.kt rename to src/test/kotlin/org/move/utils/tests/RunConfigurationProducerTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/RunConfigurationUtils.kt b/src/test/kotlin/org/move/utils/tests/RunConfigurationUtils.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/RunConfigurationUtils.kt rename to src/test/kotlin/org/move/utils/tests/RunConfigurationUtils.kt diff --git a/src/main/kotlin/org/move/utils/tests/Settings.kt b/src/test/kotlin/org/move/utils/tests/Settings.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/Settings.kt rename to src/test/kotlin/org/move/utils/tests/Settings.kt diff --git a/src/main/kotlin/org/move/utils/tests/WithAptosCliTestBase.kt b/src/test/kotlin/org/move/utils/tests/WithAptosCliTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/WithAptosCliTestBase.kt rename to src/test/kotlin/org/move/utils/tests/WithAptosCliTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/AnnotatorTestCase.kt b/src/test/kotlin/org/move/utils/tests/annotation/AnnotatorTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/AnnotatorTestCase.kt rename to src/test/kotlin/org/move/utils/tests/annotation/AnnotatorTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/InspectionProjectTestBase.kt b/src/test/kotlin/org/move/utils/tests/annotation/InspectionProjectTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/InspectionProjectTestBase.kt rename to src/test/kotlin/org/move/utils/tests/annotation/InspectionProjectTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/InspectionTestBase.kt b/src/test/kotlin/org/move/utils/tests/annotation/InspectionTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/InspectionTestBase.kt rename to src/test/kotlin/org/move/utils/tests/annotation/InspectionTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/MvAnnotationTestCase.kt b/src/test/kotlin/org/move/utils/tests/annotation/MvAnnotationTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/MvAnnotationTestCase.kt rename to src/test/kotlin/org/move/utils/tests/annotation/MvAnnotationTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/MvAnnotationTestFixture.kt b/src/test/kotlin/org/move/utils/tests/annotation/MvAnnotationTestFixture.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/MvAnnotationTestFixture.kt rename to src/test/kotlin/org/move/utils/tests/annotation/MvAnnotationTestFixture.kt diff --git a/src/main/kotlin/org/move/utils/tests/annotation/TestSeverityProvider.kt b/src/test/kotlin/org/move/utils/tests/annotation/TestSeverityProvider.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/annotation/TestSeverityProvider.kt rename to src/test/kotlin/org/move/utils/tests/annotation/TestSeverityProvider.kt diff --git a/src/main/kotlin/org/move/utils/tests/base/MoveTestCase.kt b/src/test/kotlin/org/move/utils/tests/base/MoveTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/base/MoveTestCase.kt rename to src/test/kotlin/org/move/utils/tests/base/MoveTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/base/TestCase.kt b/src/test/kotlin/org/move/utils/tests/base/TestCase.kt similarity index 94% rename from src/main/kotlin/org/move/utils/tests/base/TestCase.kt rename to src/test/kotlin/org/move/utils/tests/base/TestCase.kt index a57b1c0f5..6b50d4185 100644 --- a/src/main/kotlin/org/move/utils/tests/base/TestCase.kt +++ b/src/test/kotlin/org/move/utils/tests/base/TestCase.kt @@ -1,5 +1,6 @@ package org.move.utils.tests.base +import org.move.utils.tests.base.TestCase.Companion import java.nio.file.Path import java.nio.file.Paths diff --git a/src/main/kotlin/org/move/utils/tests/common.kt b/src/test/kotlin/org/move/utils/tests/common.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/common.kt rename to src/test/kotlin/org/move/utils/tests/common.kt diff --git a/src/main/kotlin/org/move/utils/tests/completion/CompletionProjectTestCase.kt b/src/test/kotlin/org/move/utils/tests/completion/CompletionProjectTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/completion/CompletionProjectTestCase.kt rename to src/test/kotlin/org/move/utils/tests/completion/CompletionProjectTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/completion/CompletionTestCase.kt b/src/test/kotlin/org/move/utils/tests/completion/CompletionTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/completion/CompletionTestCase.kt rename to src/test/kotlin/org/move/utils/tests/completion/CompletionTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/completion/MoveCompletionTestFixture.kt b/src/test/kotlin/org/move/utils/tests/completion/MoveCompletionTestFixture.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/completion/MoveCompletionTestFixture.kt rename to src/test/kotlin/org/move/utils/tests/completion/MoveCompletionTestFixture.kt diff --git a/src/main/kotlin/org/move/utils/tests/lineMarkers/LineMarkerProviderTestBase.kt b/src/test/kotlin/org/move/utils/tests/lineMarkers/LineMarkerProviderTestBase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/lineMarkers/LineMarkerProviderTestBase.kt rename to src/test/kotlin/org/move/utils/tests/lineMarkers/LineMarkerProviderTestBase.kt diff --git a/src/main/kotlin/org/move/utils/tests/lineMarkers/LineMarkerTestHelper.kt b/src/test/kotlin/org/move/utils/tests/lineMarkers/LineMarkerTestHelper.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/lineMarkers/LineMarkerTestHelper.kt rename to src/test/kotlin/org/move/utils/tests/lineMarkers/LineMarkerTestHelper.kt diff --git a/src/main/kotlin/org/move/utils/tests/parser/MoveParsingTestCase.kt b/src/test/kotlin/org/move/utils/tests/parser/MoveParsingTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/parser/MoveParsingTestCase.kt rename to src/test/kotlin/org/move/utils/tests/parser/MoveParsingTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/resolve/ResolveProjectTestCase.kt b/src/test/kotlin/org/move/utils/tests/resolve/ResolveProjectTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/resolve/ResolveProjectTestCase.kt rename to src/test/kotlin/org/move/utils/tests/resolve/ResolveProjectTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/resolve/ResolveTestCase.kt b/src/test/kotlin/org/move/utils/tests/resolve/ResolveTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/resolve/ResolveTestCase.kt rename to src/test/kotlin/org/move/utils/tests/resolve/ResolveTestCase.kt diff --git a/src/main/kotlin/org/move/utils/tests/resolve/ResolveTestUtils.kt b/src/test/kotlin/org/move/utils/tests/resolve/ResolveTestUtils.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/resolve/ResolveTestUtils.kt rename to src/test/kotlin/org/move/utils/tests/resolve/ResolveTestUtils.kt diff --git a/src/main/kotlin/org/move/utils/tests/types/TypificationTestCase.kt b/src/test/kotlin/org/move/utils/tests/types/TypificationTestCase.kt similarity index 100% rename from src/main/kotlin/org/move/utils/tests/types/TypificationTestCase.kt rename to src/test/kotlin/org/move/utils/tests/types/TypificationTestCase.kt