diff --git a/.github/workflows/publish_artifacts_on_release.yaml b/.github/workflows/publish_artifacts_on_release.yaml
index 85ecb96f..a48a70a9 100644
--- a/.github/workflows/publish_artifacts_on_release.yaml
+++ b/.github/workflows/publish_artifacts_on_release.yaml
@@ -10,11 +10,19 @@ name: Publish package to Maven Central and JetBrains Marketplace
on:
release:
types: [created]
+ workflow_dispatch:
+ inputs:
+ release_tag:
+ description: 'Release tag'
+ required: true
+ type: stringe
jobs:
publish:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ github.events.release.tag_name || inputs.release_tag || github.ref }}
- name: Set up Maven Central Repository
uses: actions/setup-java@v1
with:
diff --git a/core/pom.xml b/core/pom.xml
index e027c791..e892ae32 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -11,7 +11,7 @@
com.facebook
ktfmt-parent
- 0.48
+ 0.49
diff --git a/core/src/main/java/com/facebook/ktfmt/format/TrailingCommas.kt b/core/src/main/java/com/facebook/ktfmt/format/TrailingCommas.kt
index 4ee63750..e19337c2 100644
--- a/core/src/main/java/com/facebook/ktfmt/format/TrailingCommas.kt
+++ b/core/src/main/java/com/facebook/ktfmt/format/TrailingCommas.kt
@@ -82,6 +82,7 @@ object TrailingCommas {
}
when (element) {
+ is KtEnumEntry, // Only suggest on the KtClassBody container
is KtWhenEntry -> return
is KtParameterList -> {
if (element.parent is KtFunctionLiteral && element.parent.parent is KtLambdaExpression) {
diff --git a/core/src/test/java/com/facebook/ktfmt/format/GoogleStyleFormatterKtTest.kt b/core/src/test/java/com/facebook/ktfmt/format/GoogleStyleFormatterKtTest.kt
index 48ca5d1c..f5440bd4 100644
--- a/core/src/test/java/com/facebook/ktfmt/format/GoogleStyleFormatterKtTest.kt
+++ b/core/src/test/java/com/facebook/ktfmt/format/GoogleStyleFormatterKtTest.kt
@@ -1714,6 +1714,25 @@ class GoogleStyleFormatterKtTest {
formattingOptions = Formatter.GOOGLE_FORMAT,
deduceMaxWidth = true)
+ @Test
+ fun `trailing commas on multline enum entries`() =
+ assertFormatted(
+ """
+ |enum class MultilineEntries {
+ | A(
+ | arg = 0, //
+ | arg = 0,
+ | ),
+ | /* Comment */
+ | B,
+ | C {
+ | fun foo() {}
+ | },
+ |}
+ |"""
+ .trimMargin(),
+ formattingOptions = Formatter.GOOGLE_FORMAT)
+
@Test
fun `trailing commas in enums`() {
val code =
diff --git a/ktfmt_idea_plugin/build.gradle.kts b/ktfmt_idea_plugin/build.gradle.kts
index 585fba8f..45683788 100644
--- a/ktfmt_idea_plugin/build.gradle.kts
+++ b/ktfmt_idea_plugin/build.gradle.kts
@@ -20,12 +20,13 @@ plugins {
id("com.diffplug.spotless") version "5.10.2"
}
-val ktfmtVersion = rootProject.file("../version.txt").readText().trim().replace("-SNAPSHOT", "")
+val currentKtfmtVersion = rootProject.file("../version.txt").readText().trim()
+val stableKtfmtVersion = rootProject.file("../stable_version.txt").readText().trim()
val pluginVersion = "1.1"
group = "com.facebook"
-version = "$pluginVersion.$ktfmtVersion"
+version = "$pluginVersion.$currentKtfmtVersion"
repositories {
mavenCentral()
@@ -38,8 +39,8 @@ java {
}
dependencies {
- implementation("com.facebook", "ktfmt", ktfmtVersion)
- implementation("com.google.googlejavaformat", "google-java-format", "1.8")
+ implementation("com.facebook", "ktfmt", stableKtfmtVersion)
+ implementation("com.google.googlejavaformat", "google-java-format", "1.22.0")
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
@@ -59,4 +60,4 @@ tasks {
runPluginVerifier { ideVersions.set(listOf("221")) }
}
-spotless { java { googleJavaFormat("1.21.0") } }
+spotless { java { googleJavaFormat("1.22.0") } }
diff --git a/ktfmt_idea_plugin/gradle/wrapper/gradle-wrapper.properties b/ktfmt_idea_plugin/gradle/wrapper/gradle-wrapper.properties
index 9f4197d5..ac72c34e 100644
--- a/ktfmt_idea_plugin/gradle/wrapper/gradle-wrapper.properties
+++ b/ktfmt_idea_plugin/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/online_formatter/build.gradle.kts b/online_formatter/build.gradle.kts
index 60d07a40..0d8f3f88 100644
--- a/online_formatter/build.gradle.kts
+++ b/online_formatter/build.gradle.kts
@@ -21,7 +21,7 @@ repositories {
mavenCentral()
}
-val ktfmtVersion = rootProject.file("../version.txt").readText().trim()
+val ktfmtVersion = rootProject.file("../stable_version.txt").readText().trim()
dependencies {
implementation("com.facebook:ktfmt:$ktfmtVersion")
diff --git a/online_formatter/gradle/wrapper/gradle-wrapper.properties b/online_formatter/gradle/wrapper/gradle-wrapper.properties
index db9a6b82..ac72c34e 100644
--- a/online_formatter/gradle/wrapper/gradle-wrapper.properties
+++ b/online_formatter/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/pom.xml b/pom.xml
index 5c6517c6..e3791709 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.facebook
ktfmt-parent
- 0.48
+ 0.49
pom
Ktfmt Parent
diff --git a/stable_version.txt b/stable_version.txt
new file mode 100644
index 00000000..a2ff373b
--- /dev/null
+++ b/stable_version.txt
@@ -0,0 +1 @@
+0.49
diff --git a/version.txt b/version.txt
index 8ae5e618..a2ff373b 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.48
+0.49