Skip to content

Commit f83a082

Browse files
author
Cameron Mace
committed
Fixed nullability on voiceUnit
1 parent 6bcedcd commit f83a082

43 files changed

Lines changed: 336 additions & 875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ checkstyle:
22
./gradlew checkstyle
33

44
sonarqube:
5+
./gradlew JacocoTestReport
56
./gradlew sonarqube
67

78
test:
@@ -88,6 +89,10 @@ directions-fixtures:
8889
curl "https://api.mapbox.com/directions/v5/mapbox/driving/-77.04014240930304,38.91313201360546;-77.04573453985853,38.90725177816208.json?steps=true&overview=full&geometries=polyline6&roundabout_exits=true&voice_instructions=true&banner_instructions=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
8990
-o services-directions/src/test/resources/directions_v5_voice_banner.json
9091

92+
# Directions: No route found
93+
curl "https://api.mapbox.com/directions/v5/mapbox/driving/149.72227,-37.59764;170.72975,-42.96489.json?steps=true&overview=full&geometries=polyline6&roundabout_exits=true&voice_instructions=true&banner_instructions=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
94+
-o services-directions/src/test/resources/directions_v5_no_route.json
95+
9196
mapmatching-fixtures:
9297
curl "https://api.mapbox.com/matching/v5/mapbox/driving/$(MAP_MATCHING_COORDINATES)?geometries=polyline&language=sv&steps=true&access_token=$(MAPBOX_ACCESS_TOKEN)" \
9398
-o services-matching/src/test/resources/mapmatching_v5_polyline.json
@@ -101,4 +106,4 @@ optimization-fixtures:
101106
-o services-optimization/src/test/resources/optimized_trip_steps.json
102107

103108
curl "https://api.mapbox.com/optimized-trips/v1/mapbox/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219;13.418555,52.523215?roundtrip=true&distributions=3,1&access_token=$(MAPBOX_ACCESS_TOKEN)" \
104-
-o services-optimization/src/test/resources/optimized_trip_distributions.json
109+
-o services-optimization/src/test/resources/optimized_trip_distributions.json

circle.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ jobs:
2222
paths:
2323
- ~/.gradle
2424
key: jars-{{ checksum "build.gradle" }}
25-
- run:
26-
name: Jacoco test report
27-
command: ./gradlew jacocoTestReport
28-
- run:
29-
name: Sonarcloud upload
30-
command: make sonarqube
3125
- run:
3226
name: Check Java code style
3327
command: make checkstyle
28+
- run:
29+
name: Jacoco test report
30+
command: ./gradlew jacocoTestReport
3431
- run:
3532
name: Run unit-test for all modules
3633
command: make test
34+
- run:
35+
name: SonarQube upload
36+
command: make sonarqube
3737
- run:
3838
name: Update Transifex
3939
command: |

config/checkstyle/checkstyle.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC
3-
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4-
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
55

66
<module name="Checker">
77
<property name="fileExtensions" value="java, properties, xml"/>
@@ -17,6 +17,9 @@
1717
<!-- Default severity is error -->
1818
<property name="severity" value="error"/>
1919

20+
<!-- Checks whether files end with a new line -->
21+
<module name="NewlineAtEndOfFile"/>
22+
2023
<!-- Report every line containing a tab character" -->
2124
<module name="FileTabCharacter">
2225
<property name="eachLine" value="true"/>

gradle/developer-config.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
task accessToken {
2+
def tokenFile = new File("${projectDir}/src/main/res/values/developer-config.xml")
3+
if (!tokenFile.exists()) {
4+
String mapboxAccessToken = "$System.env.MAPBOX_ACCESS_TOKEN"
5+
6+
if (mapboxAccessToken == "null") {
7+
logger.error("warning: MAPBOX_ACCESS_TOKEN environment variable is not set.")
8+
logger.error("Note: It is recommended to edit the value in res/values/developer-config.xml file.")
9+
mapboxAccessToken = "YOUR_MAPBOX_ACCESS_TOKEN_GOES_HERE";
10+
}
11+
12+
String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
13+
"<resources>\n" +
14+
" <string name=\"mapbox_access_token\">" + mapboxAccessToken + "</string>\n" +
15+
"</resources>"
16+
17+
tokenFile.write(tokenFileContents)
18+
}
19+
}
20+
21+
gradle.projectsEvaluated {
22+
preBuild.dependsOn('accessToken')
23+
}

gradle/sonarqube.gradle

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,24 @@ apply plugin: 'org.sonarqube'
22

33
sonarqube {
44
properties {
5+
// Project Configuration
6+
property "sonar.projectKey", "mapbox-java-services:master"
7+
property "sonar.host.url", "https://mb-sonarqube-staging.tilestream.net"
8+
9+
// Project identity
10+
property "sonar.projectName", "Mapbox Java"
11+
12+
// Test reports
513
property "sonar.java.coveragePlugin", "jacoco"
6-
property "sonar.host.url", "https://sonarcloud.io"
7-
property "sonar.login", System.env.SONARQUBE_API_TOKEN
8-
property "sonar.organization", "mapbox"
9-
property "sonar.projectName", "mapbox-java"
10-
property "sonar.projectKey", "mapbox-java-services"
1114
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
15+
16+
// Authentication
17+
property "sonar.login", System.env.SONARQUBE_API_TOKEN
18+
19+
// Project information
20+
property "sonar.projectDescription", "Contains both a lightwight wrappers for many of Mapbox's APIs and utilities such as Turf for geo-calculations"
1221
property "sonar.links.homepage", "https://github.com/mapbox/mapbox-java"
22+
property "sonar.links.ci", "https://circleci.com/gh/mapbox/mapbox-java"
23+
property "sonar.links.issue", "https://github.com/mapbox/mapbox-java/issues"
1324
}
1425
}

samples/src/main/java/com/mapbox/samples/BasicDirections.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static MapboxDirections buildMapboxDirections() {
5454
.addBearing(null, null)
5555
.radiuses(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY)
5656
.steps(true)
57-
.voiceUnits(DirectionsCriteria.METRIC)
57+
// .voiceUnits(DirectionsCriteria.METRIC)
5858
.build();
5959
}
6060
}

services-core/src/main/java/com/mapbox/services/MapboxService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ public OkHttpClient getOkHttpClient() {
110110

111111
return okHttpClient;
112112
}
113-
}
113+
}

services-core/src/main/java/com/mapbox/services/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
*
44
* @since 3.0.0
55
*/
6-
package com.mapbox.services;
6+
package com.mapbox.services;

services-directions/src/main/java/com/mapbox/directions/v5/DirectionsAdapterFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ public abstract class DirectionsAdapterFactory implements TypeAdapterFactory {
2121
public static TypeAdapterFactory create() {
2222
return new AutoValueGson_DirectionsAdapterFactory();
2323
}
24-
}
24+
}

0 commit comments

Comments
 (0)