Skip to content

Commit

Permalink
refactor: change the project indentation to 4 spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
whitescent committed Feb 14, 2025
1 parent 9cd673e commit 11a59f4
Show file tree
Hide file tree
Showing 74 changed files with 2,717 additions and 2,713 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ root = true

[*]
charset = utf-8
indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
Expand Down
90 changes: 47 additions & 43 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
import com.diffplug.gradle.spotless.SpotlessExtension

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.spotless) apply false
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.spotless) apply false
}

subprojects {
version = findProperty("storytale.deploy.version")
?: error("'storytale.deploy.version' was not set")
version = findProperty("storytale.deploy.version")
?: error("'storytale.deploy.version' was not set")

plugins.withId("maven-publish") {
configureIfExists<PublishingExtension> {
repositories {
maven {
name = "ComposeRepo"
setUrl(System.getenv("COMPOSE_REPO_URL"))
credentials {
username = System.getenv("COMPOSE_REPO_USERNAME")
password = System.getenv("COMPOSE_REPO_KEY")
}
plugins.withId("maven-publish") {
configureIfExists<PublishingExtension> {
repositories {
maven {
name = "ComposeRepo"
setUrl(System.getenv("COMPOSE_REPO_URL"))
credentials {
username = System.getenv("COMPOSE_REPO_USERNAME")
password = System.getenv("COMPOSE_REPO_KEY")
}
}
}
}
}
}
}
plugins.apply(rootProject.libs.plugins.spotless.get().pluginId)
extensions.configure<SpotlessExtension> {
kotlin {
target("src/**/*.kt")
targetExclude("src/test/resources/**")
ktlint(libs.ktlint.get().version)
.editorConfigOverride(
mapOf(
"ktlint_compose_modifier-missing-check" to "disabled",
"ktlint_compose_compositionlocal-allowlist" to "disabled",
),
)
.customRuleSets(listOf(libs.composeRules.get().toString()))
}
kotlinGradle {
ktlint(libs.ktlint.get().version)
plugins.apply(rootProject.libs.plugins.spotless.get().pluginId)
extensions.configure<SpotlessExtension> {
kotlin {
target("src/**/*.kt")
targetExclude("src/test/resources/**")
ktlint(libs.ktlint.get().version)
.editorConfigOverride(
mapOf(
"indent_size" to "4",
"ktlint_compose_modifier-missing-check" to "disabled",
"ktlint_compose_compositionlocal-allowlist" to "disabled",
),
)
.customRuleSets(listOf(libs.composeRules.get().toString()))
}
kotlinGradle {
target("*.gradle.kts")
ktlint(libs.ktlint.get().version)
.editorConfigOverride(
mapOf("indent_size" to "4"),
)
}
}
}
}

inline fun <reified T> Project.configureIfExists(fn: T.() -> Unit) {
extensions.findByType(T::class.java)?.fn()
extensions.findByType(T::class.java)?.fn()
}

36 changes: 18 additions & 18 deletions modules/compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
`kotlin-dsl`
`maven-publish`
kotlin("jvm")
`kotlin-dsl`
`maven-publish`
kotlin("jvm")
}

dependencies {
implementation(kotlin("compiler-embeddable"))
implementation(kotlin("compiler-embeddable"))
}

sourceSets {
val main by getting {
java.srcDirs("src")
resources.srcDir("src/resources")
}
val main by getting {
java.srcDirs("src")
resources.srcDir("src/resources")
}
}

group = "org.jetbrains.compose.storytale"

val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
archiveClassifier.set("javadoc")
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "compiler-plugin"
from(components["kotlin"])
}
withType<MavenPublication> {
artifact(emptyJavadocJar)
publications {
create<MavenPublication>("maven") {
artifactId = "compiler-plugin"
from(components["kotlin"])
}
withType<MavenPublication> {
artifact(emptyJavadocJar)
}
}
}
}

tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions.optIn.add("org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi")
compilerOptions.optIn.add("org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi")
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.config.CompilerConfiguration

class StorytaleComponentRegistrar : CompilerPluginRegistrar() {
override val supportsK2: Boolean get() = true
override val supportsK2: Boolean get() = true

override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
Companion.registerExtensions(this)
}
override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
Companion.registerExtensions(this)
}

companion object {
fun registerExtensions(extensionStorage: ExtensionStorage) = with(extensionStorage) {
IrGenerationExtension.registerExtension(StorytaleLoweringExtension())
companion object {
fun registerExtensions(extensionStorage: ExtensionStorage) = with(extensionStorage) {
IrGenerationExtension.registerExtension(StorytaleLoweringExtension())
}
}
}
}
Loading

0 comments on commit 11a59f4

Please sign in to comment.