Skip to content

Commit

Permalink
Update MapLibre Android, update Kotlin, update AGP (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Sep 6, 2024
1 parent 792e693 commit 6d85aac
Show file tree
Hide file tree
Showing 34 changed files with 71 additions and 113 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ jobs:
submodules: recursive
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

distribution: "temurin"
java-version: "17"
- name: Download Dependencies
run: ./gradlew androidDependencies

Expand Down
31 changes: 7 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,18 @@ android {
abortOnError false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
viewBinding true
buildConfig true
}
namespace 'org.maplibre.android.plugins.testapp'
}

// Disable Leak Canary for UI and unit test.
configurations.all { config ->
if (config.name.contains('UnitTest') || config.name.contains('AndroidTest')) {
config.resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.squareup.leakcanary'
&& details.requested.name == 'leakcanary-android') {
details.useTarget(group: details.requested.group, name: 'leakcanary-android-no-op',
version: details.requested.version)
}
}
}
kotlin {
jvmToolchain(11)
}

dependencies {
// Kotlin
implementation dependenciesList.kotlin

// MapLibre
implementation(dependenciesList.mapLibreAndroidSdk, {
exclude group: 'android.arch.lifecycle'
Expand Down Expand Up @@ -88,24 +73,22 @@ dependencies {
testImplementation dependenciesList.mockito

// Instrumentation testing
androidTestImplementation dependenciesList.mockitoAndroid
androidTestImplementation "org.mockito:mockito-android:5.13.0"
androidTestImplementation dependenciesList.supportAppcompatV7
androidTestImplementation dependenciesList.testRunner
androidTestImplementation dependenciesList.testRules
androidTestImplementation dependenciesList.testEspressoCore
androidTestImplementation dependenciesList.testRoom
androidTestImplementation dependenciesList.testArchCore
androidTestImplementation(dependenciesList.mockitoCore, {
androidTestImplementation("org.mockito:mockito-core:5.13.0", {
exclude group: 'net.bytebuddy'
})

// Square crew
implementation dependenciesList.timber

// Leak canary
debugImplementation dependenciesList.leakCanaryDebug
releaseImplementation dependenciesList.leakCanaryRelease
testImplementation dependenciesList.leakCanaryTest
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.14"

// Plugin modules
implementation project(':plugin-offline')
Expand Down
3 changes: 1 addition & 2 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.maplibre.android.plugins.testapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="org.maplibre.android.plugins.testapp">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
package org.maplibre.android.plugins.testapp

import android.app.Application
import com.squareup.leakcanary.LeakCanary
import org.maplibre.android.MapLibre
import timber.log.Timber

class PluginApplication : Application() {

override fun onCreate() {
super.onCreate()
if (LeakCanary.isInAnalyzerProcess(this)) {
return
}

LeakCanary.install(this)
initializeLogger()
MapLibre.getInstance(this)
}
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ buildscript {
}

dependencies {
classpath pluginDependencies.gradle
classpath pluginDependencies.kotlin
classpath pluginDependencies.kotlinLint
classpath pluginDependencies.gradleNexus
classpath 'com.android.tools.build:gradle:8.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:8.1.0"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ POM_DEVELOPER_NAME=MapLibre
org.gradle.jvmargs=-Xmx2560M
android.useAndroidX=true
android.enableJetifier=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
31 changes: 4 additions & 27 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
androidVersions = [
minSdkVersion : 21,
targetSdkVersion : 30,
compileSdkVersion: 33,
compileSdkVersion: 34,
]

version = [
mapLibreAndroidSdk : '11.0.0',
mapLibreAndroidSdk : '11.3.0',
mapLibreJava : '5.9.0',
mapLibreTurf : '5.9.0',
playLocation : '16.0.0',
Expand All @@ -18,7 +18,6 @@
constraintLayout : '1.1.2',
mockito : '5.2.0',
mockk : '1.9.3',
leakCanary : '1.6.3',
timber : '4.7.1',
testRunner : '1.0.2',
espresso : '3.0.2',
Expand All @@ -30,15 +29,6 @@
robolectric : '4.10.3'
]

pluginVersion = [
checkstyle: '8.10.1',
gradle : '7.4.0',
kotlin : '1.8.10',
dokka : '0.9.17',
kotlinLint: '8.1.0',
gradleNexus: "1.1.0"
]

dependenciesList = [
// MapLibre
mapLibreAndroidSdk : "org.maplibre.gl:android-sdk:${version.mapLibreAndroidSdk}",
Expand All @@ -57,7 +47,7 @@

// support
supportAnnotation : 'androidx.annotation:annotation:1.0.0',
supportAppcompatV7 : 'androidx.appcompat:appcompat:1.0.0',
supportAppcompatV7 : 'androidx.appcompat:appcompat:1.7.0',
supportV4 : 'androidx.legacy:legacy-support-v4:1.0.0',
supportDesign : 'com.google.android.material:material:1.0.0',
supportRecyclerView : 'androidx.recyclerview:recyclerview:1.0.0',
Expand All @@ -72,9 +62,6 @@

// square crew
timber : "com.jakewharton.timber:timber:${version.timber}",
leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${version.leakCanary}",
leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${version.leakCanary}",
leakCanaryTest : "com.squareup.leakcanary:leakcanary-android-no-op:${version.leakCanary}",

// instrumentation test
testRunner : 'androidx.test.ext:junit:1.1.1',
Expand All @@ -91,16 +78,6 @@
junit : "junit:junit:${version.junit}",
mockito : "org.mockito:mockito-inline:${version.mockito}",
androidArchCore : 'androidx.arch.core:core-testing:2.0.0',
robolectric : "org.robolectric:robolectric:${version.robolectric}",
kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${pluginVersion.kotlin}",
]

pluginDependencies = [
gradle : "com.android.tools.build:gradle:${pluginVersion.gradle}",
checkstyle: "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${pluginVersion.kotlin}",
dokka : "org.jetbrains.dokka:dokka-android-gradle-plugin:${pluginVersion.dokka}",
kotlinLint: "org.jlleitschuh.gradle:ktlint-gradle:${pluginVersion.kotlinLint}",
gradleNexus: "io.github.gradle-nexus:publish-plugin:${pluginVersion.gradleNexus}"
robolectric : "org.robolectric:robolectric:${version.robolectric}"
]
}
6 changes: 3 additions & 3 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ task androidJavadocs(type: Javadoc) {
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'dokka'
archiveClassifier = 'dokka'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

Expand All @@ -35,7 +35,7 @@ afterEvaluate {
groupId this.group
artifactId project.ext.mapLibreArtifactId

from components.release
from components.findByName('release')

artifact androidSourcesJar
artifact androidJavadocsJar
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 9 additions & 4 deletions ktx-mapbox-maps/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
plugins {
id 'com.android.library'
id 'kotlin-android'
}

android {
compileSdkVersion androidVersions.compileSdkVersion
Expand All @@ -21,20 +23,23 @@ android {
testOptions {
unitTests.returnDefaultValues true
}
namespace 'org.maplibre.android.plugins.maps'

tasks.withType(Javadoc).all {
enabled = false
}
}

kotlin {
jvmToolchain(11)
}

dependencies {
implementation dependenciesList.kotlin
implementation dependenciesList.mapLibreAndroidSdk
javadocDeps dependenciesList.mapLibreAndroidSdk
testImplementation dependenciesList.junit
testImplementation dependenciesList.mockito
testImplementation dependenciesList.robolectric
testImplementation dependenciesList.kotlin
}

apply from: "${rootDir}/gradle/javadoc.gradle"
Expand Down
3 changes: 1 addition & 2 deletions ktx-mapbox-maps/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest
package="org.maplibre.android.plugins.maps"/>
<manifest />
10 changes: 0 additions & 10 deletions plugin-annotation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ repositories {
In the app-level `build.gradle` file:

```groovy
android {
// The Annotation Plugin requires Java 8 usage
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.maplibre.maplibresdk:maplibre-android-plugin-annotation-v9:0.9.0'
}
Expand Down
1 change: 1 addition & 0 deletions plugin-annotation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {
testOptions {
unitTests.returnDefaultValues true
}
namespace 'org.maplibre.android.plugins.annotation'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion plugin-annotation/scripts/annotation.java.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.maplibre.android.geometry.LatLng;
import org.maplibre.android.style.layers.Property;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.utils.ColorUtils;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;

import java.util.ArrayList;
Expand Down
2 changes: 1 addition & 1 deletion plugin-annotation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="org.maplibre.android.plugins.annotation" />
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import androidx.annotation.Nullable;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;
import org.maplibre.geojson.Geometry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.maplibre.android.style.layers.Property;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.utils.ColorUtils;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.annotation.VisibleForTesting;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveDistancesObject;
import com.mapbox.android.gestures.MoveGestureDetector;
import org.maplibre.android.gestures.AndroidGesturesManager;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveGestureDetector;
import org.maplibre.android.maps.MapLibreMap;
import org.maplibre.android.maps.MapView;
import org.maplibre.geojson.Geometry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.maplibre.android.style.layers.Property;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.utils.ColorUtils;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.maplibre.android.style.layers.Property;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.utils.ColorUtils;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.maplibre.android.style.layers.Property;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.utils.ColorUtils;
import com.mapbox.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.maps.Projection;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.maplibre.android.plugins.annotation;

import android.graphics.PointF;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveDistancesObject;
import com.mapbox.android.gestures.MoveGestureDetector;
import org.maplibre.android.gestures.AndroidGesturesManager;
import org.maplibre.android.gestures.MoveDistancesObject;
import org.maplibre.android.gestures.MoveGestureDetector;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Loading

0 comments on commit 6d85aac

Please sign in to comment.