Skip to content

Commit 9d9f058

Browse files
authored
feat: Switch to Gradle Version Catalog and Maven Publish plugin (#25)
1 parent 82c24ba commit 9d9f058

File tree

8 files changed

+69
-64
lines changed

8 files changed

+69
-64
lines changed

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

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

build.gradle

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,29 @@ buildscript {
44
"compileSdk" : 29,
55
"minSdk" : 21,
66
"targetSdk" : 29,
7-
"kotlin" : "1.4.0",
8-
"agp" : "4.1.1",
9-
"ktlintPlugin" : "9.1.1",
107
"versionCode" : 1,
118
"versionName" : "0.0.1"
129
]
1310

14-
ext.versions = [
15-
"appCompat" : "1.1.0",
16-
"coreTest" : "2.0.0",
17-
"coreKtx" : "1.3.2",
18-
"materialComponents": "1.2.1",
19-
"fragment" : "1.2.5",
20-
"constraintLayout" : "2.0.4",
21-
"insetter" : "0.4.0",
22-
"junit" : "4.12",
23-
"androidxTestCore" : "1.2.0",
24-
"androidxTestExt" : "1.1.1",
25-
"androidxTestRunner": "1.2.0",
26-
"espressoCore" : "3.2.0",
27-
"mockk" : "1.9.3",
28-
"robolectric" : "4.3.1",
29-
"startup" : "1.0.0",
30-
]
31-
32-
ext.libs = [
33-
"kotlinStdLib" : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${buildConfig.kotlin}",
34-
"appCompat" : "androidx.appcompat:appcompat:${versions.appCompat}",
35-
"coreTest" : "androidx.arch.core:core-testing:${versions.coreTest}",
36-
"coreKtx" : "androidx.core:core-ktx:${versions.coreKtx}",
37-
"materialComponents": "com.google.android.material:material:${versions.materialComponents}",
38-
"constraintLayout" : "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}",
39-
"fragmentKtx" : "androidx.fragment:fragment-ktx:${versions.fragment}",
40-
"startup" : "androidx.startup:startup-runtime:${versions.startup}",
41-
"insetter" : "dev.chrisbanes.insetter:insetter:${versions.insetter}",
42-
43-
"junit" : "junit:junit:${versions.junit}",
44-
"androidxTestCore" : "androidx.test:core:${versions.androidxTestCore}",
45-
"androidxTestExt" : "androidx.test.ext:junit:${versions.androidxTestExt}",
46-
"androidxTestRunner": "androidx.test:runner:${versions.androidxTestRunner}",
47-
"espressoCore" : "androidx.test.espresso:espresso-core:${versions.espressoCore}",
48-
"mockk" : "io.mockk:mockk:${versions.mockk}",
49-
"robolectric" : "org.robolectric:robolectric:${versions.robolectric}"
50-
]
51-
5211
repositories {
12+
mavenCentral()
5313
google()
54-
jcenter()
5514
maven {
5615
url "https://plugins.gradle.org/m2/"
5716
}
5817
}
5918

6019
dependencies {
61-
classpath "com.android.tools.build:gradle:${buildConfig.agp}"
62-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${buildConfig.kotlin}"
63-
classpath "org.jlleitschuh.gradle:ktlint-gradle:${buildConfig.ktlintPlugin}"
64-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
20+
classpath libs.agp
21+
classpath libs.kotlinGradlePlugin
22+
classpath libs.ktlintGradlePlugin
6523
}
6624
}
6725

6826
allprojects {
6927
repositories {
28+
mavenCentral()
7029
google()
71-
jcenter()
7230
}
7331
}
7432

gradle/libs.versions.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[versions]
2+
kotlin = "1.4.0"
3+
agp = "4.1.1"
4+
ktlint = "9.1.1"
5+
appCompat = "1.1.0"
6+
coreTest = "2.0.0"
7+
coreKtx = "1.3.2"
8+
materialComponents = "1.2.1"
9+
fragment = "1.2.5"
10+
constraintLayout = "2.0.4"
11+
insetter = "0.4.0"
12+
junit = "4.12"
13+
androidxTestCore = "1.2.0"
14+
androidxTestExt = "1.1.1"
15+
androidxTestRunner = "1.2.0"
16+
espressoCore = "3.2.0"
17+
mockk = "1.9.3"
18+
robolectric = "4.3.1"
19+
startup = "1.0.0"
20+
21+
[libraries]
22+
23+
agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
24+
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
25+
ktlintGradlePlugin = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint" }
26+
kotlinStdLib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
27+
appCompat = { module = "androidx.appcompat:appcompat", version.ref = "appCompat" }
28+
coreTest = { module = "androidx.arch.core:core-testing", version.ref = "coreTest" }
29+
coreKtx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
30+
materialComponents = { module = "com.google.android.material:material", version.ref = "materialComponents" }
31+
constraintLayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintLayout" }
32+
fragmentKtx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment" }
33+
startup = { module = "androidx.startup:startup-runtime", version.ref = "startup" }
34+
insetter = { module = "dev.chrisbanes.insetter:insetter", version.ref = "insetter" }
35+
junit = { module = "junit:junit", version.ref = "junit" }
36+
androidxTestCore = { module = "androidx.test:core", version.ref = "androidxTestCore" }
37+
androidxTestExt = { module = "androidx.test.ext:junit", version.ref = "androidxTestExt" }
38+
androidxTestRunner = { module = "androidx.test:runner", version.ref = "androidxTestRunner" }
39+
espressoCore = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
40+
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
41+
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }

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.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include ':what-the-stack'
22
include ':app'
33
rootProject.name = "WhatTheStack"
4+
enableFeaturePreview("VERSION_CATALOGS")

what-the-stack/build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
4-
apply plugin: 'com.github.dcendents.android-maven'
5-
6-
group = "com.github.haroldadmin"
4+
apply plugin: 'maven-publish'
75

86
android {
97
compileSdkVersion buildConfig.compileSdk
@@ -60,4 +58,17 @@ dependencies {
6058
androidTestImplementation libs.androidxTestCore
6159
androidTestImplementation libs.androidxTestExt
6260
androidTestImplementation libs.espressoCore
63-
}
61+
}
62+
63+
afterEvaluate {
64+
publishing {
65+
publications {
66+
WhatTheStack(MavenPublication) {
67+
from components.release
68+
groupId = "com.github.haroldadmin"
69+
artifactId = "WhatTheStack"
70+
version = "0.3.0"
71+
}
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)