Rework buildSrc and update some dependencies (#1296)

This commit is contained in:
Harsh Shandilya 2021-02-03 21:57:55 +05:30 committed by GitHub
parent 318aeae500
commit 0afd6551aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 42 deletions

View file

@ -2,24 +2,7 @@
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved. * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
buildscript {
apply(from = "buildSrc/buildDependencies.gradle")
val build: Map<Any, Any> by extra
repositories {
google()
jcenter()
// For binary compatibility validator.
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
}
dependencies {
classpath(build.getValue("androidGradlePlugin"))
classpath(build.getValue("binaryCompatibilityValidator"))
classpath(build.getValue("kotlinGradlePlugin"))
}
}
plugins { plugins {
id("com.github.ben-manes.versions") version "0.36.0"
`binary-compatibility-validator` `binary-compatibility-validator`
`aps-plugin` `aps-plugin`
} }

View file

@ -1,6 +1,3 @@
apply(from = "buildDependencies.gradle")
val build: Map<Any, Any> by extra
plugins { plugins {
`kotlin-dsl` `kotlin-dsl`
} }
@ -9,6 +6,8 @@ repositories {
google() google()
gradlePluginPortal() gradlePluginPortal()
jcenter() jcenter()
// For binary compatibility validator.
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
} }
kotlinDslPluginOptions { kotlinDslPluginOptions {
@ -33,9 +32,9 @@ gradlePlugin {
} }
dependencies { dependencies {
implementation(build.getValue("kotlinGradlePlugin")) implementation(Plugins.androidGradlePlugin)
implementation(build.getValue("androidGradlePlugin")) implementation(Plugins.binaryCompatibilityValidator)
implementation(build.getValue("binaryCompatibilityValidator")) implementation(Plugins.downloadTaskPlugin)
implementation(build.getValue("downloadTaskPlugin")) implementation(Plugins.jsemver)
implementation(build.getValue("jsemver")) implementation(Plugins.kotlinGradlePlugin)
} }

View file

@ -1,15 +0,0 @@
rootProject.ext.versions = [
agp : '4.1.1',
kotlin : '1.4.21',
binary_compatibility_validator : '0.2.4',
download_plugin : '4.1.1',
semver : '0.9.0',
]
rootProject.ext.build = [
androidGradlePlugin : "com.android.tools.build:gradle:${versions.agp}",
kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
binaryCompatibilityValidator : "org.jetbrains.kotlinx:binary-compatibility-validator:${versions.binary_compatibility_validator}",
downloadTaskPlugin : "de.undercouch:gradle-download-task:${versions.download_plugin}",
jsemver : "com.github.zafarkhaja:java-semver:${versions.semver}",
]

View file

@ -0,0 +1,21 @@
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
google()
gradlePluginPortal()
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
}
// force compilation of Dependencies.kt so it can be referenced in buildSrc/build.gradle.kts
sourceSets.main {
java {
setSrcDirs(setOf(projectDir.parentFile.resolve("src/main/java")))
include("Dependencies.kt")
}
}

View file

@ -3,7 +3,15 @@
* SPDX-License-Identifier: GPL-3.0-only * SPDX-License-Identifier: GPL-3.0-only
*/ */
private const val KOTLIN_VERSION = "1.4.21" private const val KOTLIN_VERSION = "1.4.30"
object Plugins {
val androidGradlePlugin = "com.android.tools.build:gradle:4.1.1"
val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4"
val downloadTaskPlugin = "de.undercouch:gradle-download-task:4.1.1"
val jsemver = "com.github.zafarkhaja:java-semver:0.9.0"
val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
}
object Dependencies { object Dependencies {
object Kotlin { object Kotlin {
@ -51,7 +59,7 @@ object Dependencies {
const val eddsa = "net.i2p.crypto:eddsa:0.3.0" const val eddsa = "net.i2p.crypto:eddsa:0.3.0"
const val fastscroll = "me.zhanghai.android.fastscroll:library:1.1.5" const val fastscroll = "me.zhanghai.android.fastscroll:library:1.1.5"
const val jgit = "org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r" const val jgit = "org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r"
const val kotlin_result = "com.michael-bull.kotlin-result:kotlin-result:1.1.9" const val kotlin_result = "com.michael-bull.kotlin-result:kotlin-result:1.1.10"
const val leakcanary = "com.squareup.leakcanary:leakcanary-android:2.5" const val leakcanary = "com.squareup.leakcanary:leakcanary-android:2.5"
const val modern_android_prefs = "de.Maxr1998.android:modernpreferences:1.2.0-alpha1" const val modern_android_prefs = "de.Maxr1998.android:modernpreferences:1.2.0-alpha1"
const val plumber = "com.squareup.leakcanary:plumber-android:2.5" const val plumber = "com.squareup.leakcanary:plumber-android:2.5"