Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.36.0 #135

Closed
wants to merge 14 commits into from
Closed
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
39 changes: 38 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fun prop(name: String): String =
?: error("Property `$name` is not defined in gradle.properties for environment `$shortPlatformVersion`")

val shortPlatformVersion = prop("shortPlatformVersion")
val codeVersion = "1.35.0"
val codeVersion = "1.36.0"
val pluginVersion = "$codeVersion.$shortPlatformVersion"
val pluginGroup = "org.move"
val javaVersion = JavaVersion.VERSION_17
Expand All @@ -21,6 +21,8 @@ val pluginJarName = "intellij-move-$pluginVersion"
val kotlinReflectVersion = "1.8.10"
val aptosVersion = "3.1.0"

val remoteRobotVersion = "0.11.22"

group = pluginGroup
version = pluginVersion

Expand Down Expand Up @@ -254,6 +256,41 @@ project(":plugin") {
}
}
}

downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}

runIdeForUiTests {
systemProperty("robot-server.port", "8082")
// systemProperty "ide.mac.message.dialogs.as.sheets", "false"
// systemProperty "jb.privacy.policy.text", "<!--999.999-->"
// 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>("test") {
useJUnitPlatform()
}
}

Expand Down
5 changes: 4 additions & 1 deletion plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
<idea-plugin
require-restart="true"
xmlns:xi="http://www.w3.org/2001/XInclude">

<id>org.move.lang</id>
<name>Move Language</name>

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pluginManagement {
}

include("plugin")
include("ui-tests")
6 changes: 4 additions & 2 deletions src/main/kotlin/org/move/cli/LibraryRootsProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ private val MoveProject.ideaLibraries: Collection<SyntheticLibrary>
}
.map {
val sourceRoots = it.layoutPaths().mapNotNull { p -> p.toVirtualFile() }.toMutableSet()
it.moveToml.tomlFile
?.virtualFile?.let { f -> sourceRoots.add(f) }
val tomlFile = it.moveToml.tomlFile.virtualFile
sourceRoots.add(tomlFile)
// it.moveToml.tomlFile
// .virtualFile.let { f -> sourceRoots.add(f) }
MoveLangLibrary(it.packageName, sourceRoots, emptySet(), MoveIcons.MOVE_LOGO, null)
}

Expand Down
40 changes: 20 additions & 20 deletions src/main/kotlin/org/move/cli/MovePackage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.intellij.openapi.vfs.VirtualFile
import org.move.cli.manifest.AptosConfigYaml
import org.move.cli.manifest.MoveToml
import org.move.lang.toNioPathOrNull
import org.move.openapiext.checkReadAccessAllowed
import org.move.openapiext.pathAsPath
import org.move.openapiext.resolveExisting
import java.nio.file.Path
Expand All @@ -14,13 +13,29 @@ data class MovePackage(
val project: Project,
val contentRoot: VirtualFile,
val moveToml: MoveToml,
val aptosConfigYaml: AptosConfigYaml?,
) {
val packageName = this.moveToml.packageName ?: ""

val sourcesFolder: VirtualFile? get() = contentRoot.takeIf { it.isValid }?.findChild("sources")
val testsFolder: VirtualFile? get() = contentRoot.takeIf { it.isValid }?.findChild("tests")

val aptosConfigYaml: AptosConfigYaml?
get() {
var root: VirtualFile? = contentRoot
while (true) {
if (root == null) break
val candidatePath = root
.findChild(".aptos")
?.takeIf { it.isDirectory }
?.findChild("config.yaml")
if (candidatePath != null) {
return AptosConfigYaml.fromPath(candidatePath.pathAsPath)
}
root = root.parent
}
return null
}

fun moveFolders(): List<VirtualFile> = listOfNotNull(sourcesFolder, testsFolder)

fun layoutPaths(): List<Path> {
Expand Down Expand Up @@ -48,24 +63,9 @@ data class MovePackage(
}

companion object {
fun fromMoveToml(moveToml: MoveToml): MovePackage? {
checkReadAccessAllowed()
val contentRoot = moveToml.tomlFile?.parent?.virtualFile ?: return null

var aptosConfigYaml: AptosConfigYaml? = null
var root: VirtualFile? = contentRoot
while (true) {
if (root == null) break
val candidatePath = root
.findChild(".aptos")
?.takeIf { it.isDirectory }
?.findChild("config.yaml")
if (candidatePath != null) {
aptosConfigYaml = AptosConfigYaml.fromPath(candidatePath.pathAsPath) ?: break
}
root = root.parent
}
return MovePackage(moveToml.project, contentRoot, moveToml, aptosConfigYaml)
fun fromMoveToml(moveToml: MoveToml): MovePackage {
val contentRoot = moveToml.tomlFile.virtualFile.parent
return MovePackage(moveToml.project, contentRoot, moveToml)
}
}
}
19 changes: 16 additions & 3 deletions src/main/kotlin/org/move/cli/MoveProject.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.move.cli
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.UserDataHolderBase
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.GlobalSearchScopes
import com.intellij.psi.util.CachedValueProvider
Expand All @@ -20,13 +21,15 @@ import org.move.openapiext.contentRoots
import org.move.stdext.chain
import org.move.stdext.iterateMoveVirtualFiles
import org.move.stdext.wrapWithList
import org.toml.lang.TomlLanguage
import org.toml.lang.psi.TomlFile
import java.nio.file.Path

data class MoveProject(
val project: Project,
val currentPackage: MovePackage,
val dependencies: List<Pair<MovePackage, RawAddressMap>>,
) : UserDataHolderBase() {
): UserDataHolderBase() {

val contentRoot: VirtualFile get() = this.currentPackage.contentRoot
val contentRootPath: Path? get() = this.currentPackage.contentRoot.toNioPathOrNull()
Expand Down Expand Up @@ -129,8 +132,18 @@ data class MoveProject(
fun forTests(project: Project): MoveProject {
checkUnitTestMode()
val contentRoot = project.contentRoots.first()
val moveToml = MoveToml(project)
val movePackage = MovePackage(project, contentRoot, moveToml, null)
val tomlFile =
PsiFileFactory.getInstance(project)
.createFileFromText(
TomlLanguage,
"""
[package]
name = "MyPackage"
"""
) as TomlFile

val moveToml = MoveToml(project, tomlFile)
val movePackage = MovePackage(project, contentRoot, moveToml)
return MoveProject(
project,
movePackage,
Expand Down
Loading
Loading