mirror of
https://github.com/ACRA/acra.git
synced 2026-03-13 10:09:46 +08:00
use gradle version catalog
This commit is contained in:
@@ -25,5 +25,5 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
@@ -25,5 +25,5 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":acra-javacore"))
|
||||
api(projects.acraJavacore)
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
|
||||
@@ -19,6 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val androidxAnnotationVersion: String by project
|
||||
api("androidx.annotation:annotation:$androidxAnnotationVersion")
|
||||
api(libs.androidx.annotation)
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
val androidxCoreVersion: String by project
|
||||
implementation("androidx.core:core:$androidxCoreVersion")
|
||||
api(projects.acraCore)
|
||||
implementation(libs.androidx.core)
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
acraCore()
|
||||
api(projects.acraCore)
|
||||
}
|
||||
|
||||
@@ -18,12 +18,11 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.google.auto:auto-common:1.0")
|
||||
implementation("com.squareup:kotlinpoet:1.8.0")
|
||||
implementation(kotlin("reflect"))
|
||||
implementation("org.apache.commons:commons-text:1.9")
|
||||
implementation(project(":annotations"))
|
||||
implementation(project(":acra-javacore"))
|
||||
val autoServiceVersion: String by project
|
||||
implementation("com.google.auto.service:auto-service:$autoServiceVersion")
|
||||
implementation(libs.autoCommon)
|
||||
implementation(libs.kotlinPoet)
|
||||
implementation(libs.kotlin.reflect)
|
||||
implementation(libs.commonsText)
|
||||
implementation(projects.annotations)
|
||||
implementation(projects.acraJavacore)
|
||||
implementation(libs.autoService.processor)
|
||||
}
|
||||
@@ -15,5 +15,5 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
`acra-release`
|
||||
id("acra-release")
|
||||
}
|
||||
|
||||
@@ -27,29 +27,17 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val androidBuildPluginVersion: String by project
|
||||
implementation("com.android.tools.build:gradle:$androidBuildPluginVersion")
|
||||
val kotlinVersion: String by project
|
||||
implementation(kotlin("gradle-plugin:$kotlinVersion"))
|
||||
implementation(kotlin("allopen:$kotlinVersion"))
|
||||
val dokkaVersion: String by project
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
|
||||
implementation("org.jetbrains.dokka:dokka-core:$dokkaVersion")
|
||||
val jgitverVersion: String by project
|
||||
implementation("gradle.plugin.fr.brouillard.oss.gradle:gradle-jgitver-plugin:$jgitverVersion")
|
||||
val nexusPublishVersion: String by project
|
||||
implementation("io.github.gradle-nexus:publish-plugin:$nexusPublishVersion")
|
||||
implementation(libs.android.build)
|
||||
implementation(libs.kotlin.gradle)
|
||||
implementation(libs.kotlin.allopen)
|
||||
implementation(libs.dokka.gradle)
|
||||
implementation(libs.dokka.core)
|
||||
implementation(libs.jgitver)
|
||||
implementation(libs.nexusPublish)
|
||||
}
|
||||
|
||||
val compileKotlin: KotlinCompile by tasks
|
||||
compileKotlin.kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
val compileTestKotlin: KotlinCompile by tasks
|
||||
compileTestKotlin.kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
kotlinDslPluginOptions {
|
||||
experimentalWarning.set(false)
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../gradle.properties
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2020
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import org.gradle.kotlin.dsl.DependencyHandlerScope
|
||||
import org.gradle.kotlin.dsl.project
|
||||
|
||||
fun DependencyHandlerScope.acraCore() {
|
||||
"api"(project(":acra-core"))
|
||||
}
|
||||
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,12 +27,12 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
val androidVersion: String by project
|
||||
val androidMinVersion: String by project
|
||||
compileSdkVersion(Integer.parseInt(androidVersion))
|
||||
val androidTarget: String by Libs.versions
|
||||
val androidMin: String by Libs.versions
|
||||
compileSdkVersion(Integer.parseInt(androidTarget))
|
||||
defaultConfig {
|
||||
minSdkVersion(androidMinVersion)
|
||||
targetSdkVersion(androidVersion)
|
||||
minSdkVersion(androidMin)
|
||||
targetSdkVersion(androidTarget)
|
||||
buildConfigField("String", "VERSION_NAME", "\"$version\"")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -58,26 +58,12 @@ tasks.withType<Test> {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val androidXTestVersion: String by project
|
||||
androidTestImplementation("androidx.test:core:$androidXTestVersion")
|
||||
androidTestImplementation("androidx.test:runner:$androidXTestVersion") {
|
||||
exclude(group = "org.hamcrest")
|
||||
}
|
||||
androidTestImplementation("androidx.test:rules:$androidXTestVersion") {
|
||||
exclude(group = "org.hamcrest")
|
||||
}
|
||||
val androidXJunitVersion: String by project
|
||||
androidTestImplementation("androidx.test.ext:junit:$androidXJunitVersion") {
|
||||
exclude(group = "org.hamcrest")
|
||||
}
|
||||
val hamcrestVersion: String by project
|
||||
androidTestImplementation("org.hamcrest:hamcrest:$hamcrestVersion")
|
||||
androidTestImplementation(Libs.bundles["androidx-test"])
|
||||
val autoServiceVersion: String by project
|
||||
"kaptTest"("com.google.auto.service:auto-service:$autoServiceVersion")
|
||||
testCompileOnly("com.google.auto.service:auto-service-annotations:$autoServiceVersion")
|
||||
"kaptTest"(Libs["autoService-processor"])
|
||||
testCompileOnly(Libs["autoService-annotations"])
|
||||
"kapt"(project(":annotationprocessor"))
|
||||
compileOnly(project(":annotations"))
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import gradle.kotlin.dsl.accessors._f9b7db6b229a578e2a74683274145336.sourceSets
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
|
||||
|
||||
@@ -39,7 +38,10 @@ tasks.register<Jar>("javadocJar") {
|
||||
afterEvaluate {
|
||||
tasks.register<Jar>("sourcesJar") {
|
||||
group = "documentation"
|
||||
from(project.extensions.findByType<LibraryExtension>()?.sourceSets?.get("main")?.java?.srcDirs ?: sourceSets["main"].allSource)
|
||||
from(
|
||||
project.extensions.findByType<LibraryExtension>()?.sourceSets?.get("main")?.java?.srcDirs
|
||||
?: project.extensions.getByType<SourceSetContainer>()["main"].allSource
|
||||
)
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ apply(plugin = "kotlin-kapt")
|
||||
|
||||
dependencies {
|
||||
val autoServiceVersion: String by project
|
||||
"kapt"("com.google.auto.service:auto-service:$autoServiceVersion")
|
||||
"compileOnly"("com.google.auto.service:auto-service-annotations:$autoServiceVersion")
|
||||
"kapt"(Libs["autoService-processor"])
|
||||
"compileOnly"(Libs["autoService-annotations"])
|
||||
}
|
||||
57
buildSrc/src/main/kotlin/catalogUtils.kt
Normal file
57
buildSrc/src/main/kotlin/catalogUtils.kt
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2021
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.ExternalModuleDependencyBundle
|
||||
import org.gradle.api.artifacts.MinimalExternalModuleDependency
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import java.util.*
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
/*
|
||||
VersionCatalog typesafe accessors aren't available in precompiled script plugins - see https://github.com/gradle/gradle/issues/15383
|
||||
These are workarounds
|
||||
*/
|
||||
|
||||
val Project.Libs: VersionCatalog
|
||||
get() = the<VersionCatalogsExtension>().named("libs")
|
||||
|
||||
class Versions(private val versionCatalog: VersionCatalog) {
|
||||
operator fun getValue(receiver: Versions?, property: KProperty<*>): String = get(property.name.replace(Regex("([A-Z])"), "-$1").toLowerCase(Locale.ROOT))
|
||||
|
||||
operator fun get(name: String): String =
|
||||
versionCatalog.findVersion(name).orElse(null)?.toString() ?: throw IllegalArgumentException("Unknown version $name")
|
||||
}
|
||||
|
||||
class Bundles(private val versionCatalog: VersionCatalog) {
|
||||
operator fun getValue(receiver: Bundles?, property: KProperty<*>): Provider<ExternalModuleDependencyBundle> =
|
||||
get(property.name.replace(Regex("([A-Z])"), "-$1").toLowerCase(Locale.ROOT))
|
||||
|
||||
operator fun get(name: String): Provider<ExternalModuleDependencyBundle> =
|
||||
versionCatalog.findBundle(name).orElse(null) ?: throw IllegalArgumentException("Unknown version $name")
|
||||
}
|
||||
|
||||
val VersionCatalog.versions: Versions
|
||||
get() = Versions(this)
|
||||
|
||||
val VersionCatalog.bundles: Bundles
|
||||
get() = Bundles(this)
|
||||
|
||||
operator fun VersionCatalog.get(library: String): Provider<MinimalExternalModuleDependency> = findDependency(library).get()
|
||||
@@ -18,6 +18,4 @@ import org.gradle.kotlin.dsl.repositories
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
//TODO: Remove when kotlinx.html is available in maven central
|
||||
maven { setUrl("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
|
||||
}
|
||||
@@ -29,18 +29,3 @@ kapt.use.worker.api=false
|
||||
|
||||
# upload properties
|
||||
group=ch.acra
|
||||
# versions
|
||||
androidVersion=30
|
||||
androidMinVersion=14
|
||||
androidBuildPluginVersion=4.1.3
|
||||
autoServiceVersion=1.0
|
||||
junitVersion=4.12
|
||||
androidxCoreVersion=1.3.2
|
||||
androidxAnnotationVersion=1.2.0
|
||||
kotlinVersion=1.4.32
|
||||
dokkaVersion=1.4.32
|
||||
hamcrestVersion=2.2
|
||||
androidXTestVersion=1.3.0
|
||||
androidXJunitVersion=1.1.2
|
||||
jgitverVersion=0.10.0-rc03
|
||||
nexusPublishVersion=1.0.0
|
||||
|
||||
43
gradle/libs.versions.toml
Normal file
43
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,43 @@
|
||||
[versions]
|
||||
android-target = "30"
|
||||
android-min = "14"
|
||||
android-build = "4.1.3"
|
||||
autoService = "1.0"
|
||||
junit = "4.12"
|
||||
androidx-core = "1.3.2"
|
||||
androidx-annotation = "1.2.0"
|
||||
kotlin = "1.5.10"
|
||||
dokka = "1.4.32"
|
||||
hamcrest = "2.2"
|
||||
androidx-test = "1.3.0"
|
||||
androidx-junit = "1.1.2"
|
||||
jgitver = "0.10.0-rc03"
|
||||
nexusPublish = "1.0.0"
|
||||
autoCommon = "1.0"
|
||||
kotlinPoet = "1.8.0"
|
||||
commonsText = "1.9"
|
||||
|
||||
[libraries]
|
||||
android-build = { module = "com.android.tools.build:gradle", version.ref = "android-build" }
|
||||
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
kotlin-allopen = { module = "org.jetbrains.kotlin:kotlin-allopen", version.ref = "kotlin" }
|
||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
||||
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
||||
dokka-core = { module = "org.jetbrains.dokka:dokka-core", version.ref = "dokka" }
|
||||
jgitver = { module = "gradle.plugin.fr.brouillard.oss.gradle:gradle-jgitver-plugin", version.ref = "jgitver" }
|
||||
nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "nexusPublish" }
|
||||
androidx-core = { module = "androidx.core:core", version.ref = "androidx-core" }
|
||||
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
|
||||
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" }
|
||||
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
|
||||
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }
|
||||
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
|
||||
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
|
||||
autoService-processor = { module = "com.google.auto.service:auto-service", version.ref = "autoService" }
|
||||
autoService-annotations = { module = "com.google.auto.service:auto-service", version.ref = "autoService" }
|
||||
autoCommon = { module = "com.google.auto:auto-common", version.ref = "autoCommon" }
|
||||
kotlinPoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinPoet" }
|
||||
commonsText = { module = "org.apache.commons:commons-text", version.ref = "commonsText" }
|
||||
|
||||
[bundles]
|
||||
androidx-test = ["androidx-test-core", "androidx-test-runner", "androidx-test-rules", "androidx-test-junit", "hamcrest"]
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
||||
|
||||
@@ -26,13 +26,7 @@ include("acra-limiter")
|
||||
include("acra-advanced-scheduler")
|
||||
includeBuild("examples")
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
val kotlinVersion: String by settings
|
||||
kotlin("android") version kotlinVersion
|
||||
}
|
||||
}
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
||||
if(file("acratest").exists()) include("acratest")
|
||||
Reference in New Issue
Block a user