diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-11-26 23:48:18 +0530 |
---|---|---|
committer | Aditya Wasan <adityawasan55@gmail.com> | 2019-11-26 23:48:18 +0530 |
commit | df0c886152f9792c1856c96984e6d775656c42dc (patch) | |
tree | 40b555687eb2ad6cb9f2a53dbe69664f7f0fa4fa | |
parent | bf9892c0471e4d4c1e7bde4325a514d1a47ca1b4 (diff) |
Rewrite Gradle configuration to simplify further (#581)
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
-rw-r--r-- | app/build.gradle | 59 | ||||
-rw-r--r-- | build.gradle | 19 | ||||
-rw-r--r-- | dependencies.gradle | 59 | ||||
-rw-r--r-- | versions.gradle | 41 |
4 files changed, 97 insertions, 81 deletions
diff --git a/app/build.gradle b/app/build.gradle index 563b1a0d..6145fe13 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,8 +2,6 @@ * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. * SPDX-License-Identifier: GPL-3.0-only */ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { id 'kotlin-android' id 'kotlin-kapt' @@ -68,43 +66,34 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:' + versions.appcompat - implementation 'androidx.cardview:cardview:' + versions.cardview - implementation 'androidx.core:core-ktx:' + versions.coreKtx - implementation 'androidx.constraintlayout:constraintlayout:' + versions.constraintLayout - implementation 'androidx.documentfile:documentfile:' + versions.documentfile - implementation 'androidx.preference:preference:' + versions.preference - implementation ('androidx.recyclerview:recyclerview:' + versions.recyclerview) { + implementation deps.androidx.annotation + implementation deps.androidx.appcompat + implementation deps.androidx.biometric + implementation deps.androidx.cardview + implementation deps.androidx.core_ktx + implementation deps.androidx.constraint_layout + implementation deps.androidx.documentfile + implementation deps.androidx.preference + implementation (deps.androidx.recycler_view) { force = true } - implementation 'com.google.android.material:material:' + versions.material - implementation 'androidx.annotation:annotation:' + versions.annotation - implementation 'androidx.biometric:biometric:' + versions.biometric - implementation 'com.github.android-password-store:openpgp-ktx:' + versions.openpgp - implementation('org.eclipse.jgit:org.eclipse.jgit:' + versions.jgit) { + implementation deps.androidx.material + implementation deps.third_party.commons_io + implementation deps.third_party.commons_codec + + implementation(deps.third_party.jgit) { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - implementation 'com.jcraft:jsch:' + versions.jsch - implementation 'commons-io:commons-io:' + versions.commons_io - implementation 'commons-codec:commons-codec:' + versions.commons_codec - implementation 'org.sufficientlysecure:sshauthentication-api:' + versions.sshauth + implementation deps.third_party.jsch + implementation deps.third_party.openpgp_ktx + implementation deps.third_party.ssh_auth // Testing-only dependencies - androidTestImplementation 'junit:junit:4.13-rc-1' - androidTestImplementation 'org.mockito:mockito-core:3.1.0' - androidTestImplementation 'androidx.test:runner:1.3.0-alpha02' - androidTestImplementation 'androidx.test:rules:1.3.0-alpha02' - androidTestImplementation 'androidx.test.ext:junit:1.1.2-alpha02' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02' - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0-alpha02' -} - -tasks.withType(JavaCompile) { - options.compilerArgs << '-Xlint:unchecked' - options.deprecation = true -} -tasks.withType(KotlinCompile) { - kotlinOptions { - jvmTarget = '1.8' - } + androidTestImplementation deps.testing.junit + androidTestImplementation deps.testing.mockito_core + androidTestImplementation deps.testing.androidx.runner + androidTestImplementation deps.testing.androidx.rules + androidTestImplementation deps.testing.androidx.junit + androidTestImplementation deps.testing.androidx.espresso_core + androidTestImplementation deps.testing.androidx.espresso_intents } diff --git a/build.gradle b/build.gradle index a8e3e30b..dae64bea 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-only */ buildscript { - apply from: rootProject.file('versions.gradle') + apply from: rootProject.file('dependencies.gradle') repositories { google() jcenter() @@ -11,9 +11,9 @@ buildscript { maven { url 'https://plugins.gradle.org/m2/' } } dependencies { - classpath 'com.android.tools.build:gradle:' + versions.gradlePlugin - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + versions.kotlin - classpath 'com.diffplug.spotless:spotless-plugin-gradle:' + versions.spotless + classpath deps.gradle_plugin.android + classpath deps.gradle_plugin.kotlin + classpath deps.gradle_plugin.spotless } } @@ -26,7 +26,7 @@ allprojects { } subprojects { - apply from: rootProject.file('versions.gradle') + apply from: rootProject.file('dependencies.gradle') apply from: rootProject.file('spotless.gradle') repositories { google() @@ -56,6 +56,15 @@ subprojects { targetCompatibility = JavaVersion.VERSION_1_8 } } + tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true + } + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { + kotlinOptions { + jvmTarget = '1.8' + } + } } apply from: rootProject.file('spotless.root.gradle') diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 00000000..43f94708 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,59 @@ +/* + * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ +ext.versions = [ + minSdk: 21, + targetSdk: 29, + compileSdk: 29, + versionCode: 10303, + versionName: '1.3.3', + buildTools: '29.0.2' +] + +ext.deps = [ + gradle_plugin: [ + android: 'com.android.tools.build:gradle:3.5.2', + kotlin: 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.60', + spotless: 'com.diffplug.spotless:spotless-plugin-gradle:3.26.0' + ], + + kotlin: [ + stdlib8: 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' + ], + + androidx: [ + annotation: 'androidx.annotation:annotation:1.1.0', + appcompat: 'androidx.appcompat:appcompat:1.1.0', + biometric: 'androidx.biometric:biometric:1.0.0', + cardview: 'androidx.cardview:cardview:1.0.0', + constraint_layout: 'androidx.constraintlayout:constraintlayout:2.0.0-beta3', + core_ktx: 'androidx.core:core-ktx:1.2.0-beta02', + documentfile: 'androidx.documentfile:documentfile:1.0.1', + material: 'com.google.android.material:material:1.2.0-alpha01', + preference: 'androidx.preference:preference:1.1.0', + recycler_view: 'androidx.recyclerview:recyclerview:1.0.0' + ], + + third_party: [ + commons_io: 'commons-io:commons-io:2.5', + commons_codec: 'commons-codec:commons-codec:1.13', + jsch: 'com.jcraft:jsch:0.1.55', + jgit: 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r', + openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:0.1.0', + ssh_auth: 'org.sufficientlysecure:sshauthentication-api:1.0' + ], + + testing: [ + junit: 'junit:junit:4.13-rc-1', + koin_test: 'org.koin:koin-test:2.0.1', + mockito_core: 'org.mockito:mockito-core:3.1.0', + androidx: [ + runner: 'androidx.test:runner:1.3.0-alpha02', + rules: 'androidx.test:rules:1.3.0-alpha02', + junit: 'androidx.test.ext:junit:1.1.2-alpha02', + espresso_core: 'androidx.test.espresso:espresso-core:3.3.0-alpha02', + espresso_intents: 'androidx.test.espresso:espresso-intents:3.3.0-alpha02' + ] + ] +] diff --git a/versions.gradle b/versions.gradle deleted file mode 100644 index c82e8874..00000000 --- a/versions.gradle +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ -ext { - versions = [ - // Project - minSdk: 21, - targetSdk: 29, - compileSdk: 29, - versionCode: 10303, - versionName: '1.3.3', - buildTools: '29.0.2', - - // Plugins - gradlePlugin: '3.5.2', - kotlin: '1.3.60', - spotless: '3.26.0', - - // AndroidX - annotation: '1.1.0', - appcompat: '1.1.0', - biometric: '1.0.0', - cardview: '1.0.0', - constraintLayout: '2.0.0-beta3', - coreKtx: '1.2.0-beta02', - documentfile: '1.0.1', - fragmentKtx: '1.2.0-rc02', - material: '1.2.0-alpha01', - preference: '1.1.0', - recyclerview: '1.0.0', - - // Third party - commons_io: '2.5', - commons_codec: '1.13', - jgit: '3.7.1.201504261725-r', - jsch: '0.1.55', - openpgp: '0.1.0', - sshauth: '1.0' - ] -} |