Skip to content

Commit

Permalink
Format .kts files with ktfmt
Browse files Browse the repository at this point in the history
Summary:
I'm extending ktfmt setup to run on kotlin script files as well.

Changelog:
[Internal] [Changed] - Reformat .kts files with ktfmt

skip-linter-coverage-verification

Reviewed By: zertosh

Differential Revision: D36967010

fbshipit-source-id: a83f3facbb5f30b935b69fc70a5588e4da5996b2
  • Loading branch information
cortinico authored and facebook-github-bot committed Jun 9, 2022
1 parent 4a0c2d4 commit 0b5d3d1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 48 deletions.
49 changes: 21 additions & 28 deletions ktfmt_idea_plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,48 @@
*/

plugins {
id("org.jetbrains.intellij") version "0.7.2"
java
id("com.diffplug.spotless") version "5.10.2"
id("org.jetbrains.intellij") version "0.7.2"
java
id("com.diffplug.spotless") version "5.10.2"
}

val ktfmtVersion = rootProject.file("../version.txt").readText().trim()
val pluginVersion = "1.1"

group = "com.facebook"

version = "$pluginVersion.$ktfmtVersion"

repositories {
mavenCentral()
mavenLocal()
mavenCentral()
mavenLocal()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
implementation("com.facebook", "ktfmt", ktfmtVersion)
implementation("com.google.googlejavaformat", "google-java-format", "1.8")
implementation("com.facebook", "ktfmt", ktfmtVersion)
implementation("com.google.googlejavaformat", "google-java-format", "1.8")
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
// Version with which to build (and run; unless alternativeIdePath is specified)
version = "2020.3"
// To run on a different IDE, uncomment and specify a path.
// alternativeIdePath = "/Applications/Android Studio.app"
// Version with which to build (and run; unless alternativeIdePath is specified)
version = "2020.3"
// To run on a different IDE, uncomment and specify a path.
// alternativeIdePath = "/Applications/Android Studio.app"
}

tasks {
patchPluginXml {
sinceBuild("201")
untilBuild("")
}
publishPlugin {
token(System.getenv("JETBRAINS_MARKETPLACE_TOKEN"))
}
runPluginVerifier {
ideVersions(listOf("211.6432.7"))
}
patchPluginXml {
sinceBuild("201")
untilBuild("")
}
publishPlugin { token(System.getenv("JETBRAINS_MARKETPLACE_TOKEN")) }
runPluginVerifier { ideVersions(listOf("211.6432.7")) }
}

spotless {
java {
googleJavaFormat()
}
}
spotless { java { googleJavaFormat() } }
1 change: 0 additions & 1 deletion ktfmt_idea_plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
*/

rootProject.name = "ktfmt_idea_plugin"

39 changes: 21 additions & 18 deletions online_formatter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,27 @@ tasks {

withType<KotlinCompile>() { kotlinOptions.jvmTarget = "11" }

val packageFat by creating(Zip::class) {
from(compileKotlin)
from(processResources)
into("lib") { from(configurations.runtimeClasspath) }
dirMode = 0b111101101 // 0755
fileMode = 0b111101101 // 0755
}

val packageLibs by creating(Zip::class) {
into("java/lib") { from(configurations.runtimeClasspath) }
dirMode = 0b111101101 // 0755
fileMode = 0b111101101 // 0755
}

val packageSkinny by creating(Zip::class) {
from(compileKotlin)
from(processResources)
}
val packageFat by
creating(Zip::class) {
from(compileKotlin)
from(processResources)
into("lib") { from(configurations.runtimeClasspath) }
dirMode = 0b111101101 // 0755
fileMode = 0b111101101 // 0755
}

val packageLibs by
creating(Zip::class) {
into("java/lib") { from(configurations.runtimeClasspath) }
dirMode = 0b111101101 // 0755
fileMode = 0b111101101 // 0755
}

val packageSkinny by
creating(Zip::class) {
from(compileKotlin)
from(processResources)
}

build { dependsOn(packageSkinny) }
}
1 change: 0 additions & 1 deletion online_formatter/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
*/

rootProject.name = "lambda"

0 comments on commit 0b5d3d1

Please sign in to comment.