mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-29 13:27:46 +00:00
buildSrc: properly apply ktfmt plugin and reformat
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
fbfe7dcb1e
commit
c85a31f885
@ -3,7 +3,10 @@
|
|||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
plugins { `kotlin-dsl` }
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
id("com.ncorti.ktfmt.gradle") version "0.4.0"
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@ -13,6 +16,11 @@ repositories {
|
|||||||
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
|
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ktfmt {
|
||||||
|
googleStyle()
|
||||||
|
maxWidth.set(120)
|
||||||
|
}
|
||||||
|
|
||||||
kotlinDslPluginOptions { experimentalWarning.set(false) }
|
kotlinDslPluginOptions { experimentalWarning.set(false) }
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
@ -78,8 +78,7 @@ fun Project.isSnapshot(): Boolean {
|
|||||||
/** Apply configurations for app module */
|
/** Apply configurations for app module */
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: Project) {
|
internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: Project) {
|
||||||
val minifySwitch =
|
val minifySwitch = project.providers.environmentVariable("DISABLE_MINIFY").forUseAtConfigurationTime()
|
||||||
project.providers.environmentVariable("DISABLE_MINIFY").forUseAtConfigurationTime()
|
|
||||||
|
|
||||||
adbOptions.installOptions("--user 0")
|
adbOptions.installOptions("--user 0")
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ import org.gradle.api.tasks.Copy
|
|||||||
import org.gradle.kotlin.dsl.create
|
import org.gradle.kotlin.dsl.create
|
||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
|
|
||||||
|
private const val EXCEPTION_MESSAGE =
|
||||||
|
"""Applying `crowdin-plugin` requires a projectName to be configured via the "crowdin" extension."""
|
||||||
|
|
||||||
class CrowdinDownloadPlugin : Plugin<Project> {
|
class CrowdinDownloadPlugin : Plugin<Project> {
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
@ -20,10 +23,7 @@ class CrowdinDownloadPlugin : Plugin<Project> {
|
|||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
val projectName = extension.projectName
|
val projectName = extension.projectName
|
||||||
if (projectName.isEmpty()) {
|
if (projectName.isEmpty()) {
|
||||||
throw GradleException(
|
throw GradleException(EXCEPTION_MESSAGE)
|
||||||
"""
|
|
||||||
Applying `crowdin-plugin` requires a projectName to be configured via the "crowdin" extension.
|
|
||||||
""".trimIndent())
|
|
||||||
}
|
}
|
||||||
tasks.register<Download>("downloadCrowdin") {
|
tasks.register<Download>("downloadCrowdin") {
|
||||||
src("https://crowdin.com/backend/download/project/$projectName.zip")
|
src("https://crowdin.com/backend/download/project/$projectName.zip")
|
||||||
|
@ -7,8 +7,7 @@ private const val KOTLIN_VERSION = "1.4.31"
|
|||||||
|
|
||||||
object Plugins {
|
object Plugins {
|
||||||
const val androidGradlePlugin = "com.android.tools.build:gradle:4.1.2"
|
const val androidGradlePlugin = "com.android.tools.build:gradle:4.1.2"
|
||||||
const val binaryCompatibilityValidator =
|
const val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4"
|
||||||
"org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4"
|
|
||||||
const val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.4.20"
|
const val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.4.20"
|
||||||
const val downloadTaskPlugin = "de.undercouch:gradle-download-task:4.1.1"
|
const val downloadTaskPlugin = "de.undercouch:gradle-download-task:4.1.1"
|
||||||
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
||||||
@ -42,8 +41,7 @@ object Dependencies {
|
|||||||
const val fragment_ktx = "androidx.fragment:fragment-ktx:1.3.0"
|
const val fragment_ktx = "androidx.fragment:fragment-ktx:1.3.0"
|
||||||
const val lifecycle_common = "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
const val lifecycle_common = "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
||||||
const val lifecycle_livedata_ktx = "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
const val lifecycle_livedata_ktx = "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
||||||
const val lifecycle_viewmodel_ktx =
|
const val lifecycle_viewmodel_ktx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
|
||||||
"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
|
|
||||||
const val material = "com.google.android.material:material:1.3.0"
|
const val material = "com.google.android.material:material:1.3.0"
|
||||||
const val preference = "androidx.preference:preference:1.1.1"
|
const val preference = "androidx.preference:preference:1.1.1"
|
||||||
const val recycler_view = "androidx.recyclerview:recyclerview:1.2.0-beta02"
|
const val recycler_view = "androidx.recyclerview:recyclerview:1.2.0-beta02"
|
||||||
@ -54,8 +52,7 @@ object Dependencies {
|
|||||||
|
|
||||||
object FirstParty {
|
object FirstParty {
|
||||||
|
|
||||||
const val zxing_android_embedded =
|
const val zxing_android_embedded = "com.github.android-password-store:zxing-android-embedded:4.1.0-aps"
|
||||||
"com.github.android-password-store:zxing-android-embedded:4.1.0-aps"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object ThirdParty {
|
object ThirdParty {
|
||||||
@ -78,8 +75,7 @@ object Dependencies {
|
|||||||
|
|
||||||
object NonFree {
|
object NonFree {
|
||||||
|
|
||||||
const val google_play_auth_api_phone =
|
const val google_play_auth_api_phone = "com.google.android.gms:play-services-auth-api-phone:17.5.0"
|
||||||
"com.google.android.gms:play-services-auth-api-phone:17.5.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Testing {
|
object Testing {
|
||||||
|
@ -38,10 +38,7 @@ class PasswordStorePlugin : Plugin<Project> {
|
|||||||
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
||||||
}
|
}
|
||||||
is AppPlugin -> {
|
is AppPlugin -> {
|
||||||
project
|
project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project)
|
||||||
.extensions
|
|
||||||
.getByType<BaseAppModuleExtension>()
|
|
||||||
.configureAndroidApplicationOptions(project)
|
|
||||||
project.extensions.getByType<BaseAppModuleExtension>().configureBuildSigning(project)
|
project.extensions.getByType<BaseAppModuleExtension>().configureBuildSigning(project)
|
||||||
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
|
||||||
}
|
}
|
||||||
|
@ -69,36 +69,16 @@ class VersioningPlugin : Plugin<Project> {
|
|||||||
doLast { version.withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) }
|
doLast { version.withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) }
|
||||||
}
|
}
|
||||||
tasks.register("bumpMajor") {
|
tasks.register("bumpMajor") {
|
||||||
doLast {
|
doLast { version.withIncMajor().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) }
|
||||||
version
|
|
||||||
.withIncMajor()
|
|
||||||
.withClearedSuffix()
|
|
||||||
.writeForAndroid(propFile.asFile.outputStream())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tasks.register("bumpMinor") {
|
tasks.register("bumpMinor") {
|
||||||
doLast {
|
doLast { version.withIncMinor().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) }
|
||||||
version
|
|
||||||
.withIncMinor()
|
|
||||||
.withClearedSuffix()
|
|
||||||
.writeForAndroid(propFile.asFile.outputStream())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tasks.register("bumpPatch") {
|
tasks.register("bumpPatch") {
|
||||||
doLast {
|
doLast { version.withIncPatch().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) }
|
||||||
version
|
|
||||||
.withIncPatch()
|
|
||||||
.withClearedSuffix()
|
|
||||||
.writeForAndroid(propFile.asFile.outputStream())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tasks.register("bumpSnapshot") {
|
tasks.register("bumpSnapshot") {
|
||||||
doLast {
|
doLast { version.withIncMinor().withSuffix("SNAPSHOT").writeForAndroid(propFile.asFile.outputStream()) }
|
||||||
version
|
|
||||||
.withIncMinor()
|
|
||||||
.withSuffix("SNAPSHOT")
|
|
||||||
.writeForAndroid(propFile.asFile.outputStream())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user