diff options
Diffstat (limited to 'buildSrc/src')
-rw-r--r-- | buildSrc/src/main/java/BaseProjectConfig.kt | 3 | ||||
-rw-r--r-- | buildSrc/src/main/java/CrowdinDownloadPlugin.kt | 8 | ||||
-rw-r--r-- | buildSrc/src/main/java/Dependencies.kt | 12 | ||||
-rw-r--r-- | buildSrc/src/main/java/PasswordStorePlugin.kt | 5 | ||||
-rw-r--r-- | buildSrc/src/main/java/VersioningPlugin.kt | 48 |
5 files changed, 24 insertions, 52 deletions
diff --git a/buildSrc/src/main/java/BaseProjectConfig.kt b/buildSrc/src/main/java/BaseProjectConfig.kt index 04e3d621..45465c3d 100644 --- a/buildSrc/src/main/java/BaseProjectConfig.kt +++ b/buildSrc/src/main/java/BaseProjectConfig.kt @@ -78,8 +78,7 @@ fun Project.isSnapshot(): Boolean { /** Apply configurations for app module */ @Suppress("UnstableApiUsage") internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: Project) { - val minifySwitch = - project.providers.environmentVariable("DISABLE_MINIFY").forUseAtConfigurationTime() + val minifySwitch = project.providers.environmentVariable("DISABLE_MINIFY").forUseAtConfigurationTime() adbOptions.installOptions("--user 0") diff --git a/buildSrc/src/main/java/CrowdinDownloadPlugin.kt b/buildSrc/src/main/java/CrowdinDownloadPlugin.kt index 44c12ab0..6ec6e33a 100644 --- a/buildSrc/src/main/java/CrowdinDownloadPlugin.kt +++ b/buildSrc/src/main/java/CrowdinDownloadPlugin.kt @@ -12,6 +12,9 @@ import org.gradle.api.tasks.Copy import org.gradle.kotlin.dsl.create 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> { override fun apply(project: Project) { @@ -20,10 +23,7 @@ class CrowdinDownloadPlugin : Plugin<Project> { afterEvaluate { val projectName = extension.projectName if (projectName.isEmpty()) { - throw GradleException( - """ - Applying `crowdin-plugin` requires a projectName to be configured via the "crowdin" extension. - """.trimIndent()) + throw GradleException(EXCEPTION_MESSAGE) } tasks.register<Download>("downloadCrowdin") { src("https://crowdin.com/backend/download/project/$projectName.zip") diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index fa881cef..c82d87fc 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -7,8 +7,7 @@ private const val KOTLIN_VERSION = "1.4.31" object Plugins { const val androidGradlePlugin = "com.android.tools.build:gradle:4.1.2" - const val binaryCompatibilityValidator = - "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4" + const val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4" 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 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 lifecycle_common = "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" const val lifecycle_livedata_ktx = "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" - const val lifecycle_viewmodel_ktx = - "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion" + const val lifecycle_viewmodel_ktx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion" const val material = "com.google.android.material:material:1.3.0" const val preference = "androidx.preference:preference:1.1.1" const val recycler_view = "androidx.recyclerview:recyclerview:1.2.0-beta02" @@ -54,8 +52,7 @@ object Dependencies { object FirstParty { - const val zxing_android_embedded = - "com.github.android-password-store:zxing-android-embedded:4.1.0-aps" + const val zxing_android_embedded = "com.github.android-password-store:zxing-android-embedded:4.1.0-aps" } object ThirdParty { @@ -78,8 +75,7 @@ object Dependencies { object NonFree { - const val google_play_auth_api_phone = - "com.google.android.gms:play-services-auth-api-phone:17.5.0" + const val google_play_auth_api_phone = "com.google.android.gms:play-services-auth-api-phone:17.5.0" } object Testing { diff --git a/buildSrc/src/main/java/PasswordStorePlugin.kt b/buildSrc/src/main/java/PasswordStorePlugin.kt index 5d2d5dd9..c250d981 100644 --- a/buildSrc/src/main/java/PasswordStorePlugin.kt +++ b/buildSrc/src/main/java/PasswordStorePlugin.kt @@ -38,10 +38,7 @@ class PasswordStorePlugin : Plugin<Project> { project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions() } is AppPlugin -> { - project - .extensions - .getByType<BaseAppModuleExtension>() - .configureAndroidApplicationOptions(project) + project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project) project.extensions.getByType<BaseAppModuleExtension>().configureBuildSigning(project) project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions() } diff --git a/buildSrc/src/main/java/VersioningPlugin.kt b/buildSrc/src/main/java/VersioningPlugin.kt index f05aa34e..30ca5895 100644 --- a/buildSrc/src/main/java/VersioningPlugin.kt +++ b/buildSrc/src/main/java/VersioningPlugin.kt @@ -14,7 +14,7 @@ private const val VERSIONING_PROP_FILE = "version.properties" private const val VERSIONING_PROP_VERSION_NAME = "versioning-plugin.versionName" private const val VERSIONING_PROP_VERSION_CODE = "versioning-plugin.versionCode" private const val VERSIONING_PROP_COMMENT = - """ + """ This file was automatically generated by 'versioning-plugin'. DO NOT EDIT MANUALLY. """ @@ -44,9 +44,9 @@ class VersioningPlugin : Plugin<Project> { override fun apply(project: Project) { with(project) { val appPlugin = - requireNotNull(plugins.findPlugin(AppPlugin::class.java)) { - "Plugin 'com.android.application' must be applied to use this plugin" - } + requireNotNull(plugins.findPlugin(AppPlugin::class.java)) { + "Plugin 'com.android.application' must be applied to use this plugin" + } val propFile = layout.projectDirectory.file(VERSIONING_PROP_FILE) require(propFile.asFile.exists()) { "A 'version.properties' file must exist in the project subdirectory to use this plugin" @@ -54,13 +54,13 @@ class VersioningPlugin : Plugin<Project> { val contents = providers.fileContents(propFile).asText.forUseAtConfigurationTime() val versionProps = Properties().also { it.load(contents.get().byteInputStream()) } val versionName = - requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_NAME)) { - "version.properties must contain a '$VERSIONING_PROP_VERSION_NAME' property" - } + requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_NAME)) { + "version.properties must contain a '$VERSIONING_PROP_VERSION_NAME' property" + } val versionCode = - requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_CODE).toInt()) { - "version.properties must contain a '$VERSIONING_PROP_VERSION_CODE' property" - } + requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_CODE).toInt()) { + "version.properties must contain a '$VERSIONING_PROP_VERSION_CODE' property" + } appPlugin.extension.defaultConfig.versionName = versionName appPlugin.extension.defaultConfig.versionCode = versionCode afterEvaluate { @@ -69,36 +69,16 @@ class VersioningPlugin : Plugin<Project> { doLast { version.withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) } } tasks.register("bumpMajor") { - doLast { - version - .withIncMajor() - .withClearedSuffix() - .writeForAndroid(propFile.asFile.outputStream()) - } + doLast { version.withIncMajor().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) } } tasks.register("bumpMinor") { - doLast { - version - .withIncMinor() - .withClearedSuffix() - .writeForAndroid(propFile.asFile.outputStream()) - } + doLast { version.withIncMinor().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) } } tasks.register("bumpPatch") { - doLast { - version - .withIncPatch() - .withClearedSuffix() - .writeForAndroid(propFile.asFile.outputStream()) - } + doLast { version.withIncPatch().withClearedSuffix().writeForAndroid(propFile.asFile.outputStream()) } } tasks.register("bumpSnapshot") { - doLast { - version - .withIncMinor() - .withSuffix("SNAPSHOT") - .writeForAndroid(propFile.asFile.outputStream()) - } + doLast { version.withIncMinor().withSuffix("SNAPSHOT").writeForAndroid(propFile.asFile.outputStream()) } } } } |