Skip to content
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
51 changes: 4 additions & 47 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import io.getstream.feeds.android.Configuration
import java.io.FileNotFoundException
import java.util.Calendar

apply(from = "${rootDir}/gradle/scripts/sonar.gradle")

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.stream.project)
alias(libs.plugins.stream.android.library) apply false
alias(libs.plugins.stream.android.application) apply false
alias(libs.plugins.android.application) apply false
Expand All @@ -16,20 +15,15 @@ plugins {
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.arturbosch.detekt) apply true
alias(libs.plugins.spotless) apply true
id("com.google.gms.google-services") version "4.4.3" apply false
alias(libs.plugins.maven.publish)
alias(libs.plugins.sonarqube)
alias(libs.plugins.kover)
}

spotless {
kotlin {
val currentYear = Calendar.getInstance().get(Calendar.YEAR).toString()
target("**/*.kt")
targetExclude("**/build/**/*.kt")
ktfmt().kotlinlangStyle()
licenseHeaderFile(file("./config/license/generated/license-$currentYear.txt"))
streamProject {
spotless {
useKtfmt.set(true)
}
}

Expand All @@ -40,45 +34,8 @@ detekt {
buildUponDefaultConfig = true
}

// License tasks
subprojects {
apply(from = "${rootDir}/gradle/scripts/coverage.gradle")

tasks.register("generateLicense") {
val currentYear = Calendar.getInstance().get(Calendar.YEAR).toString()
val licenseTemplate = file("../config/license/license.template")
val generatedLicense = file("../config/license/generated/license-$currentYear.txt")
val detektFile = file("../config/detekt/detekt.yml")
val projectName = project.findProperty("projectName")?.toString() ?: "stream-feeds-android"

doLast {
if (licenseTemplate.exists()) {
// Generate license
val licenseContent = licenseTemplate.readText()
.replace("{currentYear}", currentYear)
.replace("{project}", projectName)
generatedLicense.writeText(licenseContent)
println("License file generated: ${generatedLicense.absolutePath}")

// Update detekt.yml

if (detektFile.exists()) {
val pattern =
Regex("""licenseTemplateFile:\s*['"]\.\./license/generated/license-\d{4}\.txt['"]""")
val replacement =
"""licenseTemplateFile: '../license/generated/license-$currentYear.txt'"""
val detektContent = detektFile.readText().replace(pattern, replacement)
detektFile.writeText(detektContent)

println("Detekt configuration updated: ${detektFile.absolutePath}")
} else {
throw FileNotFoundException("Detekt configuration file not found: ${detektFile.absolutePath}")
}
} else {
throw FileNotFoundException("Template file not found: ${licenseTemplate.absolutePath}")
}
}
}
}

private val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() == true
Expand Down
15 changes: 0 additions & 15 deletions config/license/generated/license-2025.txt

This file was deleted.

15 changes: 0 additions & 15 deletions config/license/license.template

This file was deleted.

5 changes: 2 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ symbolProcessingApi = "2.2.0-2.0.2"
lifecycleProcess = "2.9.1"
lifecycleViewModelCompose = "2.4.0"
sonarqube = "6.0.1.5171"
spotless = "7.2.1"
streamConventions = "0.1.1"
streamConventions = "0.3.0"
turbine = "1.2.1"
mavenPublish = "0.34.0"

Expand Down Expand Up @@ -104,7 +103,7 @@ kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
stream-project = { id = "io.getstream.project", version.ref = "streamConventions" }
stream-android-library = { id = "io.getstream.android.library", version.ref = "streamConventions" }
stream-android-application = { id = "io.getstream.android.application", version.ref = "streamConventions" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
Loading