Skip to content

Commit

Permalink
Move Gradle dependencies to Gradle version catalog (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Apr 4, 2024
1 parent f9defa4 commit 202cdac
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 172 deletions.
1 change: 1 addition & 0 deletions benchmark/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gradle/
38 changes: 19 additions & 19 deletions platform/android/MapLibreAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ apply from: "${rootDir}/gradle/native-build.gradle"

dependencies {
lintChecks project(":MapLibreAndroidLint")
api dependenciesList.mapboxJavaGeoJSON
api dependenciesList.mapboxAndroidGestures

implementation dependenciesList.mapboxJavaTurf
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
implementation dependenciesList.okhttp3
implementation dependenciesList.timber
implementation dependenciesList.interpolator

testImplementation dependenciesList.junit
testImplementation dependenciesList.mockito
testImplementation dependenciesList.mockk
testImplementation dependenciesList.robolectric
testImplementation dependenciesList.commonsIO
testImplementation dependenciesList.assertjcore

androidTestImplementation dependenciesList.testRunner
androidTestImplementation dependenciesList.testRules
api libs.maplibreJavaGeoJSON
api libs.mapboxAndroidGestures

implementation libs.maplibreJavaTurf
implementation libs.supportAnnotations
implementation libs.supportFragmentV4
implementation libs.okhttp3
implementation libs.timber
implementation libs.interpolator

testImplementation libs.junit
testImplementation libs.mockito
testImplementation libs.mockk
testImplementation libs.robolectric
testImplementation libs.commonsIO
testImplementation libs.assertjcore

androidTestImplementation libs.testRunner
androidTestImplementation libs.testRules
}

tasks.withType(DokkaTask.class) {
Expand Down
16 changes: 8 additions & 8 deletions platform/android/MapLibreAndroidLint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ apply plugin: 'kotlin'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

compileOnly dependenciesList.lint
compileOnly dependenciesList.lintApi
compileOnly dependenciesList.lintChecks
compileOnly dependenciesList.supportAnnotations

testImplementation dependenciesList.junit
testImplementation dependenciesList.robolectric
testImplementation dependenciesList.lintTests
compileOnly libs.lint
compileOnly libs.lintApi
compileOnly libs.lintChecks
compileOnly libs.supportAnnotations

testImplementation libs.junit
testImplementation libs.robolectric
testImplementation libs.lintTests
}

sourceCompatibility = "1.8"
Expand Down
40 changes: 20 additions & 20 deletions platform/android/MapLibreAndroidTestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,32 @@ android {

dependencies {
implementation project(':MapLibreAndroid')
implementation dependenciesList.mapboxJavaTurf
implementation libs.maplibreJavaTurf

implementation dependenciesList.supportAppcompatV7
implementation dependenciesList.supportRecyclerView
implementation dependenciesList.supportDesign
implementation dependenciesList.supportConstraintLayout
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0'
implementation libs.supportAppcompatV7
implementation libs.supportRecyclerView
implementation libs.supportDesign
implementation libs.supportConstraintLayout
implementation libs.kotlinxSerializationJson

implementation dependenciesList.multidex
implementation libs.multidex

implementation dependenciesList.timber
implementation libs.timber

implementation dependenciesList.okhttp3
implementation libs.okhttp3

debugImplementation dependenciesList.leakCanary
debugImplementation libs.leakCanary

androidTestImplementation dependenciesList.supportAnnotations
androidTestImplementation dependenciesList.testRunner
androidTestImplementation dependenciesList.testRules
androidTestImplementation dependenciesList.testEspressoCore
androidTestImplementation dependenciesList.testEspressoIntents
androidTestImplementation dependenciesList.testEspressoContrib
androidTestImplementation dependenciesList.testUiAutomator
androidTestImplementation dependenciesList.appCenter
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:core-ktx:1.5.0'
androidTestImplementation libs.supportAnnotations
androidTestImplementation libs.testRunner
androidTestImplementation libs.testRules
androidTestImplementation libs.testEspressoCore
androidTestImplementation libs.testEspressoIntents
androidTestImplementation libs.testEspressoContrib
androidTestImplementation libs.testUiAutomator
androidTestImplementation libs.appCenter
androidTestImplementation libs.androidxTestExtJUnit
androidTestImplementation libs.androidxTestCoreKtx

}

Expand Down
4 changes: 2 additions & 2 deletions platform/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath dependenciesList.licensesPlugin
classpath libs.licensesPlugin
// classpath dependenciesList.jacocoPlugin
classpath dependenciesList.gradleNexus
classpath libs.gradleNexus
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21"
}
}
Expand Down
45 changes: 1 addition & 44 deletions platform/android/gradle/android-nitpick.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,17 @@
apply from: "${rootDir}/gradle/dependencies.gradle"

//def MAPBOX_JAVA_DIR = 'maplibre-java'
//def MAPBOX_JAVA_TAG_PREFIX = 'v'

def MAPBOX_GESTURES_DIR = 'mapbox-gestures-android'
def MAPBOX_GESTURES_TAG_PREFIX = 'v'

task androidNitpick {
doLast {
println "Running android nitpick script"

println "Verify vendor submodule pins"
// Will enter a task to re-evaluate and restore if needed verifyVendorSubmodulePin(MAPBOX_JAVA_DIR, MAPBOX_JAVA_TAG_PREFIX, versions.mapLibreServices)
verifyVendorSubmodulePin(MAPBOX_GESTURES_DIR, MAPBOX_GESTURES_TAG_PREFIX, versions.mapboxGestures)

verifyLicenseGeneration()
}
}

private def verifyVendorSubmodulePin(def dir, def prefix, def version) {
println "Verify vendor submodule pin: ${dir} (${prefix + version})"
exec {
workingDir = "${rootDir}/vendor/${dir}"
commandLine "git", "fetch", "-t"
}

def output = new ByteArrayOutputStream()
exec {
workingDir = "${rootDir}/vendor/${dir}"
commandLine "git", "rev-list", "-n", "1", "tags/${prefix + version}"
standardOutput = output
}
def expectedCommit = output.toString().trim()
output.reset()

exec {
workingDir = "${rootDir}/vendor/${dir}"
commandLine "git", "rev-parse", "HEAD"
standardOutput = output
}
def actualCommit = output.toString().trim()

if (actualCommit != expectedCommit) {
throw new IllegalStateException("${dir} vendor repository is not checked out on the consumed binary's tag.\n" +
"Expected commit: " + expectedCommit + "(${prefix + version} tag).\n" +
"Actual commit: " + actualCommit + ".\n" +
"If you've updated the version in the dependencies.gradle file, make sure to bump the submodule pin in the /vendor directory to match the release tag.\n" +
"If you've bumped the pin, make sure to verify the version tag prefix in the android-nitpick.gradle file.")
}
output.close()
}

private def verifyLicenseGeneration() {
println "Verify license generation with git diff..."
exec {
workingDir = "${rootDir}"
commandLine "python", "scripts/validate-license.py"
commandLine "python3", "scripts/validate-license.py"
}
}
79 changes: 0 additions & 79 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ext {

androidVersions = [
minSdkVersion : 21,
targetSdkVersion : 33,
Expand All @@ -11,82 +10,4 @@ ext {
ndkVersion : '25.1.8937393',
cmakeVersion : '3.18.1+',
]

versions = [
mapLibreServices: '5.9.0',
mapboxCore : '2.0.1',
mapboxGestures : '0.7.0',
appCompat : '1.5.1',
constraintLayout: '2.1.4',
interpolator : '1.0.0',
recyclerView : '1.2.1',
material : '1.7.0',
uiAutomator : '2.2.0',
espresso : '3.5.0',
testRunner : '1.1.4',
testRules : '1.5.0',
fragment : '1.5.5',
annotation : '1.5.0',
leakCanary : '2.10',
junit : '4.13.2',
mockito : '4.10.0',
mockk : '1.13.3',
robolectric : '4.9.1',
timber : '5.0.1',
okhttp : '4.11.0',
kotlin : '1.9.21',
licenses : '0.8.80',
lint : '30.3.1',
// jacoco : '0.8.5',
appcenter : '1.5',
commonsIO : '2.11.0',
assertj : '3.23.1',
gradleNexus : "1.1.0",
multidex : "2.0.1"
]

dependenciesList = [
mapboxJavaGeoJSON : "org.maplibre.gl:android-sdk-geojson:${versions.mapLibreServices}",
mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}",
mapboxJavaTurf : "org.maplibre.gl:android-sdk-turf:${versions.mapLibreServices}",

junit : "junit:junit:${versions.junit}",
amdroidxJunit : "androidx.test.ext:junit:1.1.4",
mockito : "org.mockito:mockito-core:${versions.mockito}",
mockk : "io.mockk:mockk:${versions.mockk}",
robolectric : "org.robolectric:robolectric:${versions.robolectric}",
assertjcore : "org.assertj:assertj-core:${versions.assertj}",

testRunner : "androidx.test.ext:junit:${versions.testRunner}",
testRules : "androidx.test:rules:${versions.testRules}",
testEspressoCore : "androidx.test.espresso:espresso-core:${versions.espresso}",
testEspressoIntents : "androidx.test.espresso:espresso-intents:${versions.espresso}",
testEspressoContrib : "androidx.test.espresso:espresso-contrib:${versions.espresso}",
testUiAutomator : "androidx.test.uiautomator:uiautomator:${versions.uiAutomator}",
supportAnnotations : "androidx.annotation:annotation:${versions.annotation}",
supportAppcompatV7 : "androidx.appcompat:appcompat:${versions.appCompat}",
supportFragmentV4 : "androidx.fragment:fragment:${versions.fragment}",
supportRecyclerView : "androidx.recyclerview:recyclerview:${versions.recyclerView}",
supportConstraintLayout: "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}",
interpolator : "androidx.interpolator:interpolator:${versions.interpolator}",
supportDesign : "com.google.android.material:material:${versions.material}",
multidex : "androidx.multidex:multidex:${versions.multidex}",

appCenter : "com.microsoft.appcenter:espresso-test-extension:${versions.appcenter}",
commonsIO : "commons-io:commons-io:${versions.commonsIO}",
timber : "com.jakewharton.timber:timber:${versions.timber}",
okhttp3 : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}",

kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
licensesPlugin : "com.jaredsburrows:gradle-license-plugin:${versions.licenses}",
// jacocoPlugin : "org.jacoco:org.jacoco.core:${versions.jacoco}",

lint : "com.android.tools.lint:lint:${versions.lint}",
lintApi : "com.android.tools.lint:lint-api:${versions.lint}",
lintChecks : "com.android.tools.lint:lint-checks:${versions.lint}",
lintTests : "com.android.tools.lint:lint-tests:${versions.lint}",

gradleNexus : "io.github.gradle-nexus:publish-plugin:${versions.gradleNexus}"
]
}
83 changes: 83 additions & 0 deletions platform/android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[versions]
mapLibreServices = "5.9.0"
mapboxGestures = "0.7.0"
appCompat = "1.5.1"
constraintLayout = "2.1.4"
interpolator = "1.0.0"
recyclerView = "1.2.1"
material = "1.7.0"
uiAutomator = "2.2.0"
espresso = "3.5.0"
testRunner = "1.1.4"
testRules = "1.5.0"
fragment = "1.5.5"
annotation = "1.5.0"
leakCanary = "2.10"
junit = "4.13.2"
mockito = "4.10.0"
mockk = "1.13.3"
robolectric = "4.9.1"
timber = "5.0.1"
okhttp = "4.11.0"
kotlin = "1.9.21"
licenses = "0.8.80"
lint = "30.3.1"
appcenter = "1.5"
commonsIO = "2.11.0"
assertj = "3.23.1"
gradleNexus = "1.1.0"
multidex = "2.0.1"

androidxTestExtJUnit = "1.1.5"
androidxTestCoreKtx = "1.5.0"
kotlinxSerializationJson = "1.6.0"


[libraries]
maplibreJavaGeoJSON = { group = "org.maplibre.gl", name = "android-sdk-geojson", version.ref = "mapLibreServices" }
mapboxAndroidGestures = { group = "com.mapbox.mapboxsdk", name = "mapbox-android-gestures", version.ref = "mapboxGestures" }
maplibreJavaTurf = { group = "org.maplibre.gl", name = "android-sdk-turf", version.ref = "mapLibreServices" }

junit = { group = "junit", name = "junit", version.ref = "junit" }
amdroidxJunit = { group = "androidx.test.ext", name = "junit", version.ref = "testRunner" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
assertjcore = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" }

testRunner = { group = "androidx.test.ext", name = "junit", version.ref = "testRunner" }
testRules = { group = "androidx.test", name = "rules", version.ref = "testRules" }
testEspressoCore = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
testEspressoIntents = { group = "androidx.test.espresso", name = "espresso-intents", version.ref = "espresso" }
testEspressoContrib = { group = "androidx.test.espresso", name = "espresso-contrib", version.ref = "espresso" }
testUiAutomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiAutomator" }
supportAnnotations = { group = "androidx.annotation", name = "annotation", version.ref = "annotation" }
supportAppcompatV7 = { group = "androidx.appcompat", name = "appcompat", version.ref = "appCompat" }
supportFragmentV4 = { group = "androidx.fragment", name = "fragment", version.ref = "fragment" }
supportRecyclerView = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerView" }
supportConstraintLayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" }
interpolator = { group = "androidx.interpolator", name = "interpolator", version.ref = "interpolator" }
supportDesign = { group = "com.google.android.material", name = "material", version.ref = "material" }
multidex = { group = "androidx.multidex", name = "multidex", version.ref = "multidex" }

appCenter = { group = "com.microsoft.appcenter", name = "espresso-test-extension", version.ref = "appcenter" }
commonsIO = { group = "commons-io", name = "commons-io", version.ref = "commonsIO" }
timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" }
okhttp3 = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
leakCanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakCanary" }

kotlinPlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
licensesPlugin = { group = "com.jaredsburrows", name = "gradle-license-plugin", version.ref = "licenses" }

lint = { group = "com.android.tools.lint", name = "lint", version.ref = "lint" }
lintApi = { group = "com.android.tools.lint", name = "lint-api", version.ref = "lint" }
lintChecks = { group = "com.android.tools.lint", name = "lint-checks", version.ref = "lint" }
lintTests = { group = "com.android.tools.lint", name = "lint-tests", version.ref = "lint" }

gradleNexus = { group = "io.github.gradle-nexus", name = "publish-plugin", version.ref = "gradleNexus" }

androidxTestExtJUnit = { group = "androidx.test.ext", name = "junit", version = "1.1.5" }
androidxTestCoreKtx = { group = "androidx.test", name = "core-ktx", version = "1.5.0" }
kotlinxSerializationJson = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = "1.6.0" }

[plugins]
1 change: 1 addition & 0 deletions test/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gradle/

0 comments on commit 202cdac

Please sign in to comment.