Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Backport #13806 and #13816 to release-java #13815

Merged
merged 4 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,8 @@ android-style-code:
node platform/android/scripts/generate-style-code.js
style-code: android-style-code

# Vendor submodules configuration for Android.
.PHONY: platform/android/vendor
platform/android/vendor:
git submodule update --init --recursive platform/android/vendor

# Configuration file for running CMake from Gradle within Android Studio.
platform/android/gradle/configuration.gradle: platform/android/vendor
platform/android/gradle/configuration.gradle:
@printf "ext {\n node = '`command -v node || command -v nodejs`'\n npm = '`command -v npm`'\n ccache = '`command -v ccache`'\n}" > $@

define ANDROID_RULES
Expand Down Expand Up @@ -768,6 +763,11 @@ android-configuration: platform/android/gradle/configuration.gradle
android-update-vendor: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none updateVendorSubmodules

# Run android nitpick script
.PHONY: run-android-nitpick
run-android-nitpick: android-update-vendor
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none androidNitpick

# Creates a dependency graph using Graphviz
.PHONY: android-graph
android-graph: platform/android/gradle/configuration.gradle
Expand Down
6 changes: 6 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ jobs:
MBGL_ANDROID_STL: << parameters.stl >>
steps:
- install-dependencies: { gradle: true }
- run:
name: Android nitpick
command: make run-android-nitpick
- run:
name: Check code style
command: make android-check
Expand Down Expand Up @@ -596,6 +599,9 @@ jobs:
IS_LOCAL_DEVELOPMENT: false
steps:
- install-dependencies: { gradle: true }
- run:
name: Android nitpick
command: make run-android-nitpick
- run:
name: Generate Maven credentials
command: |
Expand Down
48 changes: 48 additions & 0 deletions platform/android/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

Mapbox GL uses portions of the Android Lifecycle Extensions.
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Android Lifecycle LiveData.
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Android Lifecycle LiveData Core.
URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand Down Expand Up @@ -94,6 +106,42 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Android Core Library.
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Android Gestures Library.
URL: [https://github.com/mapbox/mapbox-gestures-android](https://github.com/mapbox/mapbox-gestures-android)
License: [BSD 2-Clause "Simplified" License](https://raw.githubusercontent.com/mapbox/mapbox-gestures-android/master/LICENSE.md)

===========================================================================

Mapbox GL uses portions of the Mapbox Android Telemetry Library.
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Services SDK.
URL: [https://github.com/mapbox/mapbox-java](https://github.com/mapbox/mapbox-java)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Services SDK.
URL: [https://github.com/mapbox/mapbox-java](https://github.com/mapbox/mapbox-java)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the Mapbox Services SDK.
URL: [https://github.com/mapbox/mapbox-java](https://github.com/mapbox/mapbox-java)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the OkHttp.
License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

Expand Down
16 changes: 10 additions & 6 deletions platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ apply plugin: 'kotlin-android'

dependencies {
lintChecks project(":MapboxGLAndroidSDKLint")
api project(":libcore")
api project(":libtelemetry")
api project(":MapboxAndroidGestures")
api project(":services-geojson")
implementation project(":services-turf")
api dependenciesList.mapboxAndroidTelemetry
api dependenciesList.mapboxJavaGeoJSON
api (dependenciesList.mapboxAndroidGestures) {
// workaround until https://github.com/mapbox/mapbox-gestures-android/issues/50 is released
exclude group: 'com.jakewharton.timber', module: 'timber'
}
implementation dependenciesList.mapboxJavaTurf
implementation dependenciesList.supportAppcompatV7
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
Expand Down Expand Up @@ -163,4 +165,6 @@ configurations {
apply from: "${rootDir}/gradle/gradle-javadoc.gradle"
apply from: "${rootDir}/gradle/gradle-publish.gradle"
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
apply from: "${rootDir}/gradle/gradle-update-vendor-modules.gradle"
apply from: "${rootDir}/gradle/android-nitpick.gradle"
2 changes: 1 addition & 1 deletion platform/android/MapboxGLAndroidSDKTestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
implementation dependenciesList.kotlinLib

implementation project(':MapboxGLAndroidSDK')
implementation project(":services-turf")
implementation dependenciesList.mapboxJavaTurf

implementation dependenciesList.supportAppcompatV7
implementation dependenciesList.supportRecyclerView
Expand Down
1 change: 0 additions & 1 deletion platform/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
buildscript {
apply from: "${rootDir}/gradle/gradle-update-vendor-modules.gradle"
apply from: "${rootDir}/gradle/dependencies.gradle"

repositories {
Expand Down
52 changes: 52 additions & 0 deletions platform/android/gradle/android-nitpick.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apply from: "${rootDir}/gradle/dependencies.gradle"

def MAPBOX_JAVA_DIR = 'mapbox-java'
def MAPBOX_JAVA_TAG_PREFIX = 'v'

def MAPBOX_TELEMETRY_DIR = 'mapbox-events-android'
def MAPBOX_TELEMETRY_TAG_PREFIX = 'telem-'

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"
exec {
workingDir = "${rootDir}"
commandLine "git", "submodule", "update", "--init", "--recursive", "vendor"
}
verifyVendorSubmodulePin(MAPBOX_JAVA_DIR, MAPBOX_JAVA_TAG_PREFIX, versions.mapboxServices)
verifyVendorSubmodulePin(MAPBOX_TELEMETRY_DIR, MAPBOX_TELEMETRY_TAG_PREFIX, versions.mapboxTelemetry)
verifyVendorSubmodulePin(MAPBOX_GESTURES_DIR, MAPBOX_GESTURES_TAG_PREFIX, versions.mapboxGestures)
}
}

private def verifyVendorSubmodulePin(def dir, def prefix, def version) {
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 platform/android/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()
}
25 changes: 10 additions & 15 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ext {
]

versions = [
mapboxServices : '4.3.0',
mapboxTelemetry : '4.2.0',
mapboxGestures : '0.3.0',
supportLib : '27.1.1',
constraintLayout: '1.1.2',
espresso : '3.0.2',
Expand All @@ -25,23 +28,15 @@ ext {
reLinker : '1.3.1'
]

vendorArtifacts = [
mapboxGestures : 'mapbox-android-gestures',
mapboxJavaCore : 'mapbox-sdk-core',
mapboxJavaTurf : 'mapbox-sdk-turf',
mapboxJavaGeojson: 'mapbox-sdk-geojson',
mapboxTelemetry : 'mapbox-android-telemetry',
mapboxAndroidCore: 'mapbox-android-core'
]
dependenciesList = [
mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}",
mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}",
mapboxAndroidTelemetry : "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}",
mapboxAndroidGestures : "com.mapbox.mapboxsdk:mapbox-android-gestures:${versions.mapboxGestures}",

vendorVersions = [
mapboxGestures : '0.3.0',
mapboxJava : '4.3.0',
mapboxTelemetry : '4.2.0',
mapboxAndroidCore: '1.1.0'
]
// for testApp
mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}",

dependenciesList = [
junit : "junit:junit:${versions.junit}",
mockito : "org.mockito:mockito-core:${versions.mockito}",
mockk : "io.mockk:mockk:${versions.mockk}",
Expand Down
46 changes: 0 additions & 46 deletions platform/android/gradle/gradle-publish.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'maven'
apply plugin: 'signing'
apply from: "${rootDir}/gradle/dependencies.gradle"

allprojects {
group project.GROUP
Expand Down Expand Up @@ -98,21 +97,6 @@ afterEvaluate { project ->
}
}
}

def vendorMap = getVendorMap()
pom.whenConfigured { pom ->
println("Current dependencies ${pom.dependencies}")
pom.dependencies.each { dep ->
println("Processing vendor ${dep}")
if (dep.getGroupId() == rootProject.name) {
Vendor vendor = vendorMap.get(dep.getArtifactId())
dep.setGroupId(project.GROUP)
dep.setArtifactId(vendor.artifactName)
dep.setVersion(vendor.artifactVersion)
println("Updated vendor ${dep}")
}
}
}
}
}
}
Expand Down Expand Up @@ -157,33 +141,3 @@ afterEvaluate { project ->
}
}
}

// this class holds values that will be included in the resulting pom file for vendorized libraries
class Vendor {
private final artifactName
private final artifactVersion

Vendor(artifactName, artifactVersion) {
this.artifactName = artifactName
this.artifactVersion = artifactVersion
}

def getArtifactName() {
return artifactName
}

def getArtifactVersion() {
return artifactVersion
}
}

HashMap<String, Vendor> getVendorMap() {
def map = new HashMap<String, Vendor>()
map.put("mapbox-android-gestures", new Vendor(vendorArtifacts.mapboxGestures, vendorVersions.mapboxGestures))
map.put("services-core", new Vendor(vendorArtifacts.mapboxJavaCore, vendorVersions.mapboxJava))
map.put("services-turf", new Vendor(vendorArtifacts.mapboxJavaTurf, vendorVersions.mapboxJava))
map.put("services-geojson", new Vendor(vendorArtifacts.mapboxJavaGeojson, vendorVersions.mapboxJava))
map.put("libcore", new Vendor(vendorArtifacts.mapboxAndroidCore, vendorVersions.mapboxAndroidCore))
map.put("libtelemetry", new Vendor(vendorArtifacts.mapboxTelemetry, vendorVersions.mapboxTelemetry))
return map
}
4 changes: 3 additions & 1 deletion platform/android/gradle/gradle-update-vendor-modules.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
task updateVendorSubmodules {
"git submodule update --init --recursive vendor".execute()
doLast {
"git submodule update --init --recursive vendor".execute()
}
}
8 changes: 1 addition & 7 deletions platform/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
include ':MapboxGLAndroidSDK', ':MapboxGLAndroidSDKTestApp', ':MapboxGLAndroidSDKLint', ':MapboxAndroidGestures', ':services-core', ':services-geojson', ':services-turf', ':libtelemetry', ':libcore'
project(':MapboxAndroidGestures').projectDir = new File('vendor/mapbox-gestures-android/library')
project(':services-core').projectDir = new File('vendor/mapbox-java/services-core')
project(':services-geojson').projectDir = new File('vendor/mapbox-java/services-geojson')
project(':services-turf').projectDir = new File('vendor/mapbox-java/services-turf')
project(':libtelemetry').projectDir = new File('vendor/mapbox-events-android/libtelemetry')
project(':libcore').projectDir = new File('vendor/mapbox-events-android/libcore')
include ':MapboxGLAndroidSDK', ':MapboxGLAndroidSDKTestApp', ':MapboxGLAndroidSDKLint'
2 changes: 1 addition & 1 deletion platform/android/vendor/mapbox-java
Submodule mapbox-java updated 38 files
+0 −7 CHANGELOG.md
+3 −3 README.md
+1 −33 build.gradle
+2 −2 circle.yml
+1 −1 gradle.properties
+1 −1 gradle/wrapper/gradle-wrapper.properties
+0 −12 samples/build.gradle
+7 −17 services-core/build.gradle
+1 −1 services-core/gradle.properties
+5 −1 services-directions/build.gradle
+3 −3 services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java
+1 −1 services-directions/src/main/java/com/mapbox/api/directions/v5/models/DirectionsResponse.java
+7 −8 services-directions/src/main/java/com/mapbox/api/directions/v5/models/LegStep.java
+5 −1 services-geocoding/build.gradle
+2 −2 services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/MapboxGeocoding.java
+1 −1 services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/CarmenContext.java
+11 −13 services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/CarmenFeature.java
+1 −1 services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/models/GeocodingResponse.java
+7 −5 services-geojson/build.gradle
+1 −1 services-geojson/gradle.properties
+5 −1 services-matching/build.gradle
+4 −4 services-matching/src/main/java/com/mapbox/api/matching/v5/MapboxMapMatching.java
+1 −1 services-matching/src/main/java/com/mapbox/api/matching/v5/models/MapMatchingResponse.java
+5 −1 services-matrix/build.gradle
+1 −1 services-matrix/src/main/java/com/mapbox/api/matrix/v1/MapboxMatrix.java
+5 −1 services-optimization/build.gradle
+5 −5 services-optimization/src/main/java/com/mapbox/api/optimization/v1/MapboxOptimization.java
+5 −1 services-route-tiles/build.gradle
+4 −0 services-speech/build.gradle
+5 −1 services-staticmap/build.gradle
+2 −1 services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java
+4 −0 services-tilequery/build.gradle
+1 −1 services-tilequery/src/main/java/com/mapbox/api/tilequery/MapboxTilequery.java
+7 −5 services-turf/build.gradle
+1 −1 services-turf/gradle.properties
+3 −3 services-turf/src/main/java/com/mapbox/turf/TurfConstants.java
+5 −1 services/build.gradle
+1 −1 services/gradle.properties