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

Prepare new release #255

Merged
merged 4 commits into from
Nov 28, 2024
Merged
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
84 changes: 0 additions & 84 deletions .github/workflows/publish-eap.yml

This file was deleted.

57 changes: 5 additions & 52 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
import java.util.*

@Suppress("USELESS_ELVIS_RIGHT_IS_NULL")
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
Expand All @@ -17,51 +16,16 @@ 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 {
commandLine = "git rev-parse --short HEAD".split(" ")
// commandLine = "git rev-parse --abbrev-ref HEAD".split(" ")
standardOutput = byteOut
}
return String(byteOut.toByteArray()).trim().also {
if (it == "HEAD")
logger.warn("Unable to determine current branch: Project is checked out with detached head!")
}
}

fun gitTimestamp(): String {
val byteOut = ByteArrayOutputStream()
project.exec {
commandLine = "git show --no-patch --format=%at HEAD".split(" ")
// commandLine = "git rev-parse --abbrev-ref HEAD".split(" ")
standardOutput = byteOut
}
return String(byteOut.toByteArray()).trim().also {
if (it == "HEAD")
logger.warn("Unable to determine current branch: Project is checked out with detached head!")
}
}

val shortPlatformVersion = prop("shortPlatformVersion")
val useInstaller = prop("useInstaller").toBooleanStrict()
val codeVersion = "1.40.0"

var pluginVersion = "$codeVersion.$shortPlatformVersion"
if (publishingChannel != "default") {
// timestamp of the commit with this eaps addition
val start = 1714498465
val commitTimestamp = gitTimestamp().toInt() - start
pluginVersion = "$pluginVersion-$publishingChannel.$commitTimestamp"
}
val codeVersion = "1.41.0"

val pluginVersion = "$codeVersion.$shortPlatformVersion"
val pluginGroup = "org.move"
val pluginName = "intellij-move"

val kotlinReflectVersion = "2.0.21"
val aptosVersion = "4.4.0"
val aptosVersion = "4.5.0"

group = pluginGroup
version = pluginVersion
Expand Down Expand Up @@ -158,7 +122,6 @@ allprojects {

publishing {
token.set(publishingToken)
channels.set(listOf(publishingChannel))
}

pluginVerification {
Expand Down Expand Up @@ -252,6 +215,7 @@ allprojects {
}
}

@Suppress("unused")
val runIdeWithPlugins by intellijPlatformTesting.runIde.registering {
plugins {
plugin("com.google.ide-perf:1.3.2")
Expand Down Expand Up @@ -330,14 +294,3 @@ fun copyDownloadedAptosBinaries(copyTask: AbstractCopyTask) {
}
}

val Project.dependencyCachePath
get(): String {
val cachePath = file("${rootProject.projectDir}/deps")
// If cache path doesn't exist, we need to create it manually
// because otherwise gradle-intellij-plugin will ignore it
if (!cachePath.exists()) {
cachePath.mkdirs()
}
return cachePath.absolutePath
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,29 @@ import org.move.cli.settings.VersionLabel
import org.move.openapiext.pathField

class MovefmtConfigurable(val project: Project): BoundConfigurable("Movefmt") {
private val innerDisposable =
Disposer.newCheckedDisposable("Internal checked disposable for MovefmtConfigurable")

private val movefmtPathField =
pathField(
FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor(),
innerDisposable,
"Movefmt location",
onTextChanged = { it ->
val path = it.toNioPathOrNull() ?: return@pathField
versionLabel.update(path)
})
private val versionLabel = VersionLabel(
innerDisposable,
envs = EnvironmentVariablesData.create(mapOf("MOVEFMT_LOG" to "error"), true)
)

private val additionalArguments: RawCommandLineEditor = RawCommandLineEditor()
private val environmentVariables: EnvironmentVariablesComponent = EnvironmentVariablesComponent()


override fun createPanel(): DialogPanel {
val innerDisposable =
Disposer.newCheckedDisposable("MovefmtConfigurable.innerDisposable")
this.disposable?.let {
Disposer.register(it, innerDisposable)
}

val versionLabel = VersionLabel(
innerDisposable,
envs = EnvironmentVariablesData.create(mapOf("MOVEFMT_LOG" to "error"), true)
)
val movefmtPathField =
pathField(
FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor(),
innerDisposable,
"Movefmt location",
onTextChanged = { it ->
val path = it.toNioPathOrNull() ?: return@pathField
versionLabel.update(path)
})
val additionalArguments: RawCommandLineEditor = RawCommandLineEditor()
val environmentVariables: EnvironmentVariablesComponent = EnvironmentVariablesComponent()

return panel {
val settings = project.movefmtSettings
val state = settings.state.copy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum class AptosExecType {
class ChooseAptosCliPanel(versionUpdateListener: (() -> Unit)?): Disposable {

private val innerDisposable =
Disposer.newCheckedDisposable("Internal checked disposable for ChooseAptosCliPanel")
Disposer.newCheckedDisposable("ChooseAptosCliPanel.innerDisposable")

init {
Disposer.register(this, innerDisposable)
Expand Down
9 changes: 2 additions & 7 deletions src/main/kotlin/org/move/openapiext/ui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ package org.move.openapiext
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.ScrollType
import com.intellij.openapi.fileChooser.FileChooserDescriptor
import com.intellij.openapi.ui.TextComponentAccessor
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.util.CheckedDisposable
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.NlsContexts.DialogTitle
import com.intellij.ui.DocumentAdapter
import com.intellij.ui.components.JBTextField
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.Cell
import com.intellij.ui.dsl.builder.Row
import com.intellij.util.Alarm
import org.move.lang.core.psi.MvElement
import javax.swing.JComponent
import javax.swing.JTextField
import javax.swing.event.DocumentEvent
Expand Down Expand Up @@ -48,11 +43,11 @@ class UiDebouncer(

fun pathField(
fileChooserDescriptor: FileChooserDescriptor,
disposable: Disposable,
parentDisposable: Disposable,
@DialogTitle dialogTitle: String,
onTextChanged: (String) -> Unit = {}
): TextFieldWithBrowseButton {
val component = TextFieldWithBrowseButton(null, disposable)
val component = TextFieldWithBrowseButton(null, parentDisposable)
component.addBrowseFolderListener(
dialogTitle, null, null,
fileChooserDescriptor,
Expand Down