Skip to content

Commit 457bc03

Browse files
committed
修改gradle配置
1 parent dd70261 commit 457bc03

8 files changed

Lines changed: 99 additions & 132 deletions

File tree

app/build.gradle

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
apply plugin: 'com.android.application'
2-
3-
apply plugin: 'kotlin-android'
4-
5-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
}
65

76
android {
87
compileSdkVersion 31
@@ -31,20 +30,20 @@ def isMaven = false
3130

3231
dependencies {
3332
implementation fileTree(include: ['*.jar'], dir: 'libs')
34-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
35-
implementation "org.jetbrains.anko:anko:$anko_version"
36-
implementation "org.jetbrains.anko:anko-commons:$anko_version"
33+
implementation libs.kotlin.stdlib8
34+
// implementation "org.jetbrains.anko:anko:$anko_version"
35+
// implementation "org.jetbrains.anko:anko-commons:$anko_version"
3736

38-
implementation "io.github.ayvytr:ktx-androidx:3.0.6"
37+
implementation libs.ktx.androidx
3938

40-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
41-
implementation 'androidx.recyclerview:recyclerview:1.0.0'
42-
implementation 'androidx.appcompat:appcompat:1.3.0'
43-
testImplementation 'junit:junit:4.12'
44-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
45-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
39+
implementation libs.constraintlayout
40+
implementation libs.recyclerview
41+
implementation libs.androidx.appcompat
42+
testImplementation libs.junit
43+
androidTestImplementation libs.androidx.junit
44+
androidTestImplementation libs.androidx.espresso.core
4645

47-
implementation 'com.github.bumptech.glide:glide:4.8.0'
46+
implementation libs.glide
4847
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
4948

5049
if(isMaven) {

build.gradle

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
3-
buildscript {
4-
ext.kotlin_version = '1.5.30'
5-
ext.anko_version = '0.10.5'
6-
ext.espressoVersion = '3.0.1'
7-
ext.rulesVersion = '1.0.1'
8-
ext.dokka_version = '1.6.0'
9-
10-
repositories {
11-
google()
12-
jcenter()
13-
mavenCentral()
14-
}
15-
dependencies {
16-
classpath 'com.android.tools.build:gradle:4.1.3'
17-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18-
19-
// NOTE: Do not place your application dependencies here; they belong
20-
// in the individual module build.gradle files
21-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
22-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
23-
}
24-
}
25-
26-
allprojects {
27-
repositories {
28-
google()
29-
jcenter()
30-
mavenCentral()
31-
}
32-
}
33-
34-
task clean(type: Delete) {
35-
delete rootProject.buildDir
36-
}
1+
plugins {
2+
alias(libs.plugins.android.application) apply false
3+
alias(libs.plugins.android.library) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
}

cardviewpager/build.gradle

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
}
5+
46
android {
57
compileSdkVersion 31
68

@@ -31,17 +33,16 @@ android {
3133

3234
dependencies {
3335
implementation fileTree(dir: 'libs', include: ['*.jar'])
34-
implementation 'androidx.appcompat:appcompat:1.0.0'
36+
implementation libs.androidx.appcompat
3537

36-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
37-
implementation "org.jetbrains.anko:anko:$anko_version"
38-
implementation "org.jetbrains.anko:anko-commons:$anko_version"
38+
implementation libs.kotlin.stdlib8
39+
// implementation "org.jetbrains.anko:anko:$anko_version"
40+
// implementation "org.jetbrains.anko:anko-commons:$anko_version"
3941

40-
implementation 'com.github.bumptech.glide:glide:4.8.0'
42+
implementation libs.glide
4143
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
4244

43-
implementation 'androidx.cardview:cardview:1.0.0'
44-
implementation "io.github.ayvytr:ktx-androidx:3.0.6"
45+
implementation libs.cardview
46+
implementation libs.ktx.androidx
4547

46-
implementation "io.github.ayvytr:ktx-androidx:3.0.6"
4748
}

custom-views-androidx/build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
apply plugin: 'com.android.library'
2-
apply from: '../kotlin_maven_push.gradle'
1+
plugins {
2+
alias(libs.plugins.android.library)
3+
}
34

45
android {
56
compileSdkVersion 31
@@ -33,13 +34,11 @@ android {
3334
dependencies {
3435
implementation fileTree(dir: 'libs', include: ['*.jar'])
3536

36-
implementation 'androidx.appcompat:appcompat:1.3.1'
37-
implementation 'androidx.annotation:annotation:1.2.0'
38-
39-
testImplementation 'junit:junit:4.12'
40-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
41-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
37+
implementation libs.androidx.appcompat
38+
implementation libs.androidx.annotation
4239

43-
dokkaJavadocPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.0")
40+
testImplementation libs.junit
41+
androidTestImplementation libs.androidx.junit
42+
androidTestImplementation libs.androidx.espresso.core
4443

4544
}

gradle/libs.versions.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[versions]
2+
agp = "8.13.0"
3+
kotlin = "2.2.21"
4+
coreKtx = "1.15.0"
5+
junit = "4.13.2"
6+
junitVersion = "1.1.5"
7+
espressoCore = "3.5.1"
8+
appcompat = "1.3.0"
9+
material = "1.10.0"
10+
11+
[libraries]
12+
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
13+
junit = { group = "junit", name = "junit", version.ref = "junit" }
14+
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
15+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
16+
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
17+
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
18+
constraintlayout = 'androidx.constraintlayout:constraintlayout:2.0.4'
19+
kotlin-stdlib8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.2.0"
20+
recyclerview = 'androidx.recyclerview:recyclerview:1.0.0'
21+
cardview = 'androidx.cardview:cardview:1.0.0'
22+
androidx-annotation = "androidx.annotation:annotation:1.2.0"
23+
24+
logger = 'io.github.ayvytr:logger:+'
25+
flow = 'io.github.ayvytr:flow:+'
26+
27+
leakcanary = 'com.squareup.leakcanary:leakcanary-android:+'
28+
crashreport = 'com.tencent.bugly:crashreport:+'
29+
glide = "com.github.bumptech.glide:glide:4.8.0"
30+
31+
ktx-androidx = 'io.github.ayvytr:ktx-androidx:+'
32+
33+
[plugins]
34+
android-application = { id = "com.android.application", version.ref = "agp" }
35+
android-library= { id = "com.android.library", version.ref = "agp" }
36+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip

kotlin_maven_push.gradle

Lines changed: 0 additions & 59 deletions
This file was deleted.

settings.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1+
pluginManagement {
2+
repositories {
3+
google {
4+
content {
5+
includeGroupByRegex("com\\.android.*")
6+
includeGroupByRegex("com\\.google.*")
7+
includeGroupByRegex("androidx.*")
8+
}
9+
}
10+
mavenCentral()
11+
gradlePluginPortal()
12+
}
13+
}
14+
dependencyResolutionManagement {
15+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16+
repositories {
17+
google()
18+
mavenCentral()
19+
}
20+
}
21+
22+
123
include ':app', ':cardviewpager'
224
include ':custom-views-androidx'

0 commit comments

Comments
 (0)