Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Improvements #2311

Merged
merged 10 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android-device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
testSpecArn: ${{ matrix.test.testSpecArn }}

- name: Upload benchmark results to S3
if: env.run_device_test == 'true' && matrix.test.name == 'Android Benchmark'
if: always() && env.run_device_test == 'true' && matrix.test.name == 'Android Benchmark'
run: |
npm install --ignore-scripts
node scripts/aws-device-farm/download-benchmark-results.mjs ${{ steps.aws_device_farm_run.outputs.runArn }}
Expand Down
7 changes: 4 additions & 3 deletions benchmark/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
}

android {
compileSdkVersion androidVersions.compileSdkVersion
ndkVersion androidSdkVersions.ndkVersion
buildToolsVersion androidSdkVersions.buildToolsVersion

defaultConfig {
applicationId = 'com.mapbox.mapboxsdk.maps.benchmark_runner'
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
def abi = 'all'
Expand Down
8 changes: 3 additions & 5 deletions platform/android/MapLibreAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ tasks.withType(DokkaTask.class) {
}

android {
compileSdkVersion androidVersions.compileSdkVersion
buildToolsVersion androidSdkVersions.buildToolsVersion

defaultConfig {
minSdkVersion androidVersions.minSdkVersion
targetSdkVersion androidVersions.targetSdkVersion
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision())
buildConfigField "String", "GIT_REVISION", String.format("\"%s\"", getGitRevision(false))
buildConfigField "String", "MAPBOX_SDK_IDENTIFIER", String.format("\"%s\"", "mapbox-maps-android")
Expand Down
13 changes: 2 additions & 11 deletions platform/android/MapLibreAndroidLint/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,14 @@ dependencies {
testImplementation libs.lintTests
}

sourceCompatibility = "1.8"
targetCompatibility = "1.8"

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

jar {
manifest {
attributes("Lint-Registry-v2": "com.mapbox.mapboxsdk.lint.MapboxIssueRegistry")
jvmTarget = "17"
}
}
7 changes: 3 additions & 4 deletions platform/android/MapLibreAndroidTestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ def obtainTestBuildType() {
}

android {
compileSdkVersion androidVersions.compileSdkVersion

defaultConfig {
applicationId "org.maplibre.android.testapp"
minSdkVersion androidVersions.minSdkVersion
targetSdkVersion androidVersions.targetSdkVersion
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
versionCode 14
versionName "6.0.1"
testInstrumentationRunner "org.maplibre.android.InstrumentationRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class BenchmarkActivity : AppCompatActivity() {

private fun getBenchmarkInputData(): BenchmarkInputData {
// read input for benchmark from JSON file (on CI)
val jsonFile = File("${Environment.getExternalStorageDirectory()}/instrumentation-test-input")
val jsonFile = File("${Environment.getExternalStorageDirectory()}/instrumentation-test-input.json")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager() && jsonFile.isFile) {
val jsonFileContents = jsonFile.readText()
val jsonElement = Json.parseToJsonElement(jsonFileContents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ class OverlayMapActivity : AppCompatActivity() {
private lateinit var paint: Paint

@SuppressLint("DrawAllocation") // only happens once
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)

canvas?.let {
canvas.let {
if (!::paint.isInitialized) {
paint = Paint()
paint.color = Color.BLACK
Expand Down
2 changes: 1 addition & 1 deletion platform/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ buildscript {
apply from: "${rootDir}/gradle/dependencies.gradle"

repositories {
google()
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
google()
}
dependencies {
classpath libs.androidGradlePlugin
Expand Down
7 changes: 0 additions & 7 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
ext {
androidVersions = [
minSdkVersion : 21,
targetSdkVersion : 33,
compileSdkVersion: 33,
]

androidSdkVersions = [
buildToolsVersion: '33.0.1',
ndkVersion : '25.1.8937393',
cmakeVersion : '3.18.1+',
]
Expand Down
22 changes: 11 additions & 11 deletions platform/android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[versions]
mapLibreServices = "6.0.0"
mapboxGestures = "0.7.0"
appCompat = "1.5.1"
appCompat = "1.6.1"
constraintLayout = "2.1.4"
interpolator = "1.0.0"
recyclerView = "1.2.1"
material = "1.7.0"
uiAutomator = "2.2.0"
recyclerView = "1.3.2"
material = "1.11.0"
uiAutomator = "2.3.0"
espresso = "3.5.1"
testRunner = "1.1.4"
testRunner = "1.1.5"
testRules = "1.5.0"
fragment = "1.5.5"
annotation = "1.5.0"
fragment = "1.6.2"
annotation = "1.7.1"
leakCanary = "2.10"
junit = "4.13.2"
mockito = "4.10.0"
mockito = "5.11.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"
lint = "31.3.2"
appcenter = "1.5"
commonsIO = "2.11.0"
commonsIO = "2.13.0"
assertj = "3.25.3"
gradleNexus = "1.1.0"
gradleNexus = "1.3.0"
multidex = "2.0.1"

androidxTestExtJUnit = "1.1.5"
Expand Down
1 change: 0 additions & 1 deletion platform/android/gradle/native-build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ext.nativeBuild = { nativeTargets ->
android {
ndkVersion androidSdkVersions.ndkVersion
buildToolsVersion androidSdkVersions.buildToolsVersion

// We sometimes want to invoke Gradle without building a native dependency, e.g. when we just want
// to invoke the Java tests. When we explicitly specify an ABI of 'none', no native dependencies are
Expand Down
3 changes: 1 addition & 2 deletions render-test/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33

sourceSets {
test {
assets.srcDirs += ['../../../metrics']
Expand All @@ -11,6 +9,7 @@ android {

defaultConfig {
applicationId = 'org.maplibre.render_test_runner'
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
def abi = 'all'
Expand Down
Loading