-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle.kts
75 lines (68 loc) · 2.4 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:8.5.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0")
classpath("com.google.gms:google-services:4.4.2")
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.21.0")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.7.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle.kts files
}
}
plugins {
id("com.google.devtools.ksp") version "2.0.0-1.0.21" apply false
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
}
allprojects {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven {
name = "google-android-fhir"
url = uri("https://maven.pkg.github.com/google/android-fhir")
credentials {
username = localPropertyOrEnv(providers, "gpr.user", "USERNAME")
password = localPropertyOrEnv(providers, "gpr.key", "TOKEN")
}
}
}
configureSpotless()
}
fun Project.configureSpotless() {
val ktlintVersion = "0.50.0"
val ktlintOptions = mapOf("indent_size" to "2", "continuation_indent_size" to "2")
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("**/build/")
ktlint(ktlintVersion).userData(ktlintOptions)
ktfmt().googleStyle()
licenseHeaderFile(
"${project.rootProject.projectDir}/license-header.txt",
"^\\s*(package|import|class|object|sealed|open|interface|abstract).*",
)
}
kotlinGradle {
target("*.gradle.kts")
ktlint(ktlintVersion).userData(ktlintOptions)
ktfmt().googleStyle()
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/", ".idea/")
prettier(mapOf("prettier" to "2.0.5", "@prettier/plugin-xml" to "0.13.0"))
.config(mapOf("parser" to "xml", "tabWidth" to 4))
}
}
}
fun localPropertyOrEnv(providers: ProviderFactory, propertyName: String, envName: String): String? =
gradleLocalProperties(rootDir, providers).getProperty(propertyName) ?: System.getenv(envName)