Merge pull request #849 from mapbox/nightlyBuilds

Nightly Build Process Merge
This commit is contained in:
Brad Leege
2015-02-10 17:19:26 -08:00
59 changed files with 690 additions and 244 deletions

View File

@@ -2,12 +2,11 @@
.gradle/
# IntelliJ files
.idea
.idea/
*.iml
# Build files
build/
*/build/
*.so
*.apk
@@ -18,4 +17,4 @@ lib/src/main/assets/
local.properties
# Token file
app/src/main/res/raw/token.txt
MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt

View File

@@ -0,0 +1,253 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.1'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'signing'
allprojects {
group project.GROUP
version project.VERSION_NAME
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'commons-validator:commons-validator:1.4.1'
compile 'com.android.support:support-annotations:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
repositories {
mavenCentral()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
checkAllWarnings true
disable 'IconMissingDensityFolder'
}
buildTypes {
debug {
jniDebuggable true
}
release {
minifyEnabled false
jniDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
all*.exclude group: 'commons-collections', module: 'commons-collections'
}
android.libraryVariants.all { variant ->
def name = variant.name
task "javadoc$name"(type: Javadoc) {
description = "Generates javadoc for build $name"
failOnError = false
destinationDir = new File(destinationDir, variant.baseName)
source = files(variant.javaCompile.source)
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("http://d.android.com/reference/")
exclude '**/R.html', '**/R.*.html'
}
}
checkstyle {
configFile project.file('../checks.xml')
showViolations true
}
task cleanJNIBuilds {
def jniLibsDir = new File("MapboxGLAndroidSDK/src/main/jniLibs")
delete jniLibsDir.absolutePath
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
checkstyle.dependsOn variant.javaCompile
checkstyle.source variant.javaCompile.source
checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
checkstyle.exclude('**/BuildConfig.java')
checkstyle.exclude('**/R.java')
checkstyle.exclude('**/com/almeros/android/multitouch/**')
project.tasks.getByName("check").dependsOn checkstyle
}
// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/jar.gradle
android.libraryVariants.all { variant ->
def jarTask = project.tasks.create(name: "jar${variant.name.capitalize()}", type: Jar) {
from variant.javaCompile.destinationDir
exclude "**/R.class"
exclude "**/BuildConfig.class"
}
jarTask.dependsOn variant.javaCompile
artifacts.add('archives', jarTask);
}
// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL :
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL :
"https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
return hasProperty('USERNAME') ? USERNAME :
(hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "")
}
def getRepositoryPassword() {
return hasProperty('PASSWORD') ? PASSWORD :
(hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "")
}
task apklib(type: Zip) {
appendix = extension = 'apklib'
from 'AndroidManifest.xml'
into('res') {
from 'res'
}
into('src') {
from 'src'
}
}
artifacts {
archives apklib
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}
/*
// Leaving out as artifact was incorrectly named when found
addFilter('aar') { artifact, file ->
artifact.name == archivesBaseName
}
addFilter('apklib') { artifact, file ->
artifact.name == archivesBaseName + '-apklib'
}
*/
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
}

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
../gradlew -b build.gradle clean assembleRelease uploadArchives

View File

@@ -0,0 +1,22 @@
GROUP=com.mapbox.mapboxgl
VERSION_NAME=0.0.1-SNAPSHOT
POM_DESCRIPTION=Mapbox GL Android SDK
POM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_URL=https://github.com/mapbox/mapbox-gl-native
POM_SCM_CONNECTION=scm:git@github.com:mapbox/mapbox-gl-native.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:mapbox/mapbox-gl-native.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox
ANDROID_MIN_SDK=14
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.2
ANDROID_BUILD_SDK_VERSION=21
POM_NAME=Mapbox GL Android SDK
POM_ARTIFACT_ID=mapbox-gl-android-sdk
POM_PACKAGING=aar

View File

@@ -58,12 +58,15 @@ public class LonLat implements Parcelable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
LonLat other = (LonLat) obj;
return Double.doubleToLongBits(lat) == Double.doubleToLongBits(other.lat) && Double.doubleToLongBits(lon) == Double.doubleToLongBits(other.lon);
}

View File

@@ -52,12 +52,15 @@ public class LonLatZoom extends LonLat implements Parcelable {
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
LonLatZoom other = (LonLatZoom) obj;
return super.equals(obj) && Double.doubleToLongBits(zoom) == Double.doubleToLongBits(other.zoom);
}

View File

@@ -24,7 +24,6 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ArrayAdapter;
import android.widget.ZoomButtonsController;
import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector;
@@ -225,7 +224,7 @@ public class MapView extends SurfaceView {
}
public void setCenterCoordinate(LonLatZoom centerCoordinate,
boolean animated) {
boolean animated) {
long duration = animated ? ANIMATION_DURATION : 0;
mNativeMapView.setLonLatZoom(centerCoordinate, duration);
}
@@ -233,10 +232,12 @@ public class MapView extends SurfaceView {
public double getDirection() {
double direction = -mNativeMapView.getBearing();
while (direction > 360)
while (direction > 360) {
direction -= 360;
while (direction < 0)
}
while (direction < 0) {
direction += 360;
}
return direction;
}
@@ -513,7 +514,7 @@ public class MapView extends SurfaceView {
// Must handle window resizing here.
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
int height) {
Log.v(TAG, "surfaceChanged");
Log.i(TAG, "resize " + format + " " + width + " " + height);
mNativeMapView.resize((int) (width / mScreenDensity), (int) (height / mScreenDensity), mScreenDensity, width, height);
@@ -588,38 +589,38 @@ public class MapView extends SurfaceView {
// Handle two finger tap
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// First pointer down
break;
case MotionEvent.ACTION_DOWN:
// First pointer down
break;
case MotionEvent.ACTION_POINTER_DOWN:
// Second pointer down
mTwoTap = event.getPointerCount() == 2;
break;
case MotionEvent.ACTION_POINTER_DOWN:
// Second pointer down
mTwoTap = event.getPointerCount() == 2;
break;
case MotionEvent.ACTION_POINTER_UP:
// Second pointer up
break;
case MotionEvent.ACTION_POINTER_UP:
// Second pointer up
break;
case MotionEvent.ACTION_UP:
// First pointer up
long tapInterval = event.getEventTime() - event.getDownTime();
boolean isTap = tapInterval <= ViewConfiguration.getTapTimeout();
boolean inProgress = mRotateGestureDetector.isInProgress() || mScaleGestureDetector.isInProgress();
case MotionEvent.ACTION_UP:
// First pointer up
long tapInterval = event.getEventTime() - event.getDownTime();
boolean isTap = tapInterval <= ViewConfiguration.getTapTimeout();
boolean inProgress = mRotateGestureDetector.isInProgress() || mScaleGestureDetector.isInProgress();
if (mTwoTap && isTap && !inProgress) {
PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event);
zoom(false, focalPoint.x, focalPoint.y);
mTwoTap = false;
return true;
}
if (mTwoTap && isTap && !inProgress) {
PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event);
zoom(false, focalPoint.x, focalPoint.y);
mTwoTap = false;
return true;
}
break;
mTwoTap = false;
break;
case MotionEvent.ACTION_CANCEL:
mTwoTap = false;
break;
case MotionEvent.ACTION_CANCEL:
mTwoTap = false;
break;
}
boolean retVal = mGestureDetector.onTouchEvent(event);
@@ -677,7 +678,7 @@ public class MapView extends SurfaceView {
// Called for flings
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
float velocityY) {
if (!mScrollEnabled) {
return false;
}
@@ -697,7 +698,7 @@ public class MapView extends SurfaceView {
// Cancel any animation
mNativeMapView.cancelTransitions();
mNativeMapView.moveBy(velocityX * duration / 2.0 / mScreenDensity, velocityY * duration / 2.0 / mScreenDensity, (long)(duration * 1000.0f));
mNativeMapView.moveBy(velocityX * duration / 2.0 / mScreenDensity, velocityY * duration / 2.0 / mScreenDensity, (long) (duration * 1000.0f));
return true;
}
@@ -712,7 +713,7 @@ public class MapView extends SurfaceView {
// Cancel any animation
mNativeMapView.cancelTransitions(); // TODO need to test canceling
// transitions with touch
// transitions with touch
// Scroll the map
mNativeMapView.moveBy(-distanceX / mScreenDensity, -distanceY / mScreenDensity);
@@ -885,64 +886,64 @@ public class MapView extends SurfaceView {
// Check which key was pressed via hardware/real key code
switch (keyCode) {
// Tell the system to track these keys for long presses on
// onKeyLongPress is fired
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
event.startTracking();
return true;
// Tell the system to track these keys for long presses on
// onKeyLongPress is fired
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
event.startTracking();
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
if (!mScrollEnabled) {
return false;
}
case KeyEvent.KEYCODE_DPAD_LEFT:
if (!mScrollEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Move left
mNativeMapView.moveBy(scrollDist / mScreenDensity, 0.0 / mScreenDensity);
return true;
// Move left
mNativeMapView.moveBy(scrollDist / mScreenDensity, 0.0 / mScreenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (!mScrollEnabled) {
return false;
}
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (!mScrollEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Move right
mNativeMapView.moveBy(-scrollDist / mScreenDensity, 0.0 / mScreenDensity);
return true;
// Move right
mNativeMapView.moveBy(-scrollDist / mScreenDensity, 0.0 / mScreenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_UP:
if (!mScrollEnabled) {
return false;
}
case KeyEvent.KEYCODE_DPAD_UP:
if (!mScrollEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Move up
mNativeMapView.moveBy(0.0 / mScreenDensity, scrollDist / mScreenDensity);
return true;
// Move up
mNativeMapView.moveBy(0.0 / mScreenDensity, scrollDist / mScreenDensity);
return true;
case KeyEvent.KEYCODE_DPAD_DOWN:
if (!mScrollEnabled) {
return false;
}
case KeyEvent.KEYCODE_DPAD_DOWN:
if (!mScrollEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Move down
mNativeMapView.moveBy(0.0 / mScreenDensity, -scrollDist / mScreenDensity);
return true;
// Move down
mNativeMapView.moveBy(0.0 / mScreenDensity, -scrollDist / mScreenDensity);
return true;
default:
// We are not interested in this key
return super.onKeyUp(keyCode, event);
default:
// We are not interested in this key
return super.onKeyUp(keyCode, event);
}
}
@@ -951,21 +952,21 @@ public class MapView extends SurfaceView {
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
// Check which key was pressed via hardware/real key code
switch (keyCode) {
// Tell the system to track these keys for long presses on
// onKeyLongPress is fired
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
if (!mZoomEnabled) {
return false;
}
// Tell the system to track these keys for long presses on
// onKeyLongPress is fired
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
if (!mZoomEnabled) {
return false;
}
// Zoom out
zoom(false);
return true;
// Zoom out
zoom(false);
return true;
default:
// We are not interested in this key
return super.onKeyUp(keyCode, event);
default:
// We are not interested in this key
return super.onKeyUp(keyCode, event);
}
}
@@ -983,15 +984,15 @@ public class MapView extends SurfaceView {
// Must use the key character map as physical to character is not
// fixed/guaranteed
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
if (!mZoomEnabled) {
return false;
}
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
if (!mZoomEnabled) {
return false;
}
// Zoom in
zoom(true);
return true;
// Zoom in
zoom(true);
return true;
}
// We are not interested in this key
@@ -1005,58 +1006,58 @@ public class MapView extends SurfaceView {
public boolean onTrackballEvent(MotionEvent event) {
// Choose the action
switch (event.getActionMasked()) {
// The trackball was rotated
case MotionEvent.ACTION_MOVE:
if (!mScrollEnabled) {
return false;
}
// The trackball was rotated
case MotionEvent.ACTION_MOVE:
if (!mScrollEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Scroll the map
mNativeMapView.moveBy(-10.0 * event.getX() / mScreenDensity, -10.0 * event.getY() / mScreenDensity);
return true;
// Scroll the map
mNativeMapView.moveBy(-10.0 * event.getX() / mScreenDensity, -10.0 * event.getY() / mScreenDensity);
return true;
// Trackball was pushed in so start tracking and tell system we are
// interested
// We will then get the up action
case MotionEvent.ACTION_DOWN:
// Set up a delayed callback to check if trackball is still
// After waiting the system long press time out
if (mCurrentTrackballLongPressTimeOut != null) {
mCurrentTrackballLongPressTimeOut.cancel();
mCurrentTrackballLongPressTimeOut = null;
}
mCurrentTrackballLongPressTimeOut = new TrackballLongPressTimeOut();
postDelayed(mCurrentTrackballLongPressTimeOut,
ViewConfiguration.getLongPressTimeout());
return true;
case MotionEvent.ACTION_DOWN:
// Set up a delayed callback to check if trackball is still
// After waiting the system long press time out
if (mCurrentTrackballLongPressTimeOut != null) {
mCurrentTrackballLongPressTimeOut.cancel();
mCurrentTrackballLongPressTimeOut = null;
}
mCurrentTrackballLongPressTimeOut = new TrackballLongPressTimeOut();
postDelayed(mCurrentTrackballLongPressTimeOut,
ViewConfiguration.getLongPressTimeout());
return true;
// Trackball was released
case MotionEvent.ACTION_UP:
if (!mZoomEnabled) {
return false;
}
case MotionEvent.ACTION_UP:
if (!mZoomEnabled) {
return false;
}
// Only handle if we have not already long pressed
if (mCurrentTrackballLongPressTimeOut != null) {
// Zoom in
zoom(true);
}
return true;
// Only handle if we have not already long pressed
if (mCurrentTrackballLongPressTimeOut != null) {
// Zoom in
zoom(true);
}
return true;
// Trackball was cancelled
case MotionEvent.ACTION_CANCEL:
if (mCurrentTrackballLongPressTimeOut != null) {
mCurrentTrackballLongPressTimeOut.cancel();
mCurrentTrackballLongPressTimeOut = null;
}
return true;
case MotionEvent.ACTION_CANCEL:
if (mCurrentTrackballLongPressTimeOut != null) {
mCurrentTrackballLongPressTimeOut.cancel();
mCurrentTrackballLongPressTimeOut = null;
}
return true;
default:
// We are not interested in this event
return super.onTrackballEvent(event);
default:
// We are not interested in this event
return super.onTrackballEvent(event);
}
}
@@ -1100,26 +1101,26 @@ public class MapView extends SurfaceView {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == InputDevice.SOURCE_CLASS_POINTER) {
// Choose the action
switch (event.getActionMasked()) {
// Mouse scrolls
case MotionEvent.ACTION_SCROLL:
if (!mZoomEnabled) {
return false;
}
// Mouse scrolls
case MotionEvent.ACTION_SCROLL:
if (!mZoomEnabled) {
return false;
}
// Cancel any animation
mNativeMapView.cancelTransitions();
// Cancel any animation
mNativeMapView.cancelTransitions();
// Get the vertical scroll amount, one click = 1
float scrollDist = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
// Get the vertical scroll amount, one click = 1
float scrollDist = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
// Scale the map by the appropriate power of two factor
mNativeMapView.scaleBy(Math.pow(2.0, scrollDist), event.getX() / mScreenDensity, event.getY() / mScreenDensity);
// Scale the map by the appropriate power of two factor
mNativeMapView.scaleBy(Math.pow(2.0, scrollDist), event.getX() / mScreenDensity, event.getY() / mScreenDensity);
return true;
return true;
default:
// We are not interested in this event
return super.onGenericMotionEvent(event);
default:
// We are not interested in this event
return super.onGenericMotionEvent(event);
}
}
@@ -1132,23 +1133,23 @@ public class MapView extends SurfaceView {
@Override
public boolean onHoverEvent(@NonNull MotionEvent event) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE:
// Show the zoom controls
if ((mZoomButtonsController != null) && mZoomEnabled) {
mZoomButtonsController.setVisible(true);
}
return true;
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE:
// Show the zoom controls
if ((mZoomButtonsController != null) && mZoomEnabled) {
mZoomButtonsController.setVisible(true);
}
return true;
case MotionEvent.ACTION_HOVER_EXIT:
// Hide the zoom controls
if (mZoomButtonsController != null) {
mZoomButtonsController.setVisible(false);
}
case MotionEvent.ACTION_HOVER_EXIT:
// Hide the zoom controls
if (mZoomButtonsController != null) {
mZoomButtonsController.setVisible(false);
}
default:
// We are not interested in this event
return super.onHoverEvent(event);
default:
// We are not interested in this event
return super.onHoverEvent(event);
}
}

View File

@@ -1,11 +1,23 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.1'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
task accessToken {
def rawDir = new File("app/src/main/res/raw")
def rawDir = new File("MapboxGLAndroidSDKTestApp/src/main/res/raw")
rawDir.mkdirs()
def tokenFile = new File("app/src/main/res/raw/token.txt")
def tokenFile = new File("MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt")
if (!tokenFile.exists()) {
String token = System.getenv('MAPBOX_ACCESS_TOKEN')
String token = "$System.env.MAPBOX_ACCESS_TOKEN"
if (token == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
}
@@ -22,7 +34,7 @@ android {
buildToolsVersion "21.1.2"
repositories {
jcenter()
mavenCentral()
}
defaultConfig {
@@ -46,6 +58,7 @@ android {
lintOptions {
checkAllWarnings true
disable 'UnusedAttribute'
abortOnError false
//disable 'IconDensities'
}
@@ -58,9 +71,27 @@ android {
}
dependencies {
compile project(':lib')
compile(project(':MapboxGLAndroidSDK')) {
transitive = true
}
compile 'com.android.support:support-annotations:21.0.0'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.mapzen.android:lost:0.2'
}
checkstyle {
configFile project.file('../checks.xml')
showViolations true
}
android.applicationVariants.all { variant ->
def name = variant.buildType.name
def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
checkstyle.dependsOn variant.javaCompile
checkstyle.source variant.javaCompile.source
checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
checkstyle.exclude('**/BuildConfig.java')
checkstyle.exclude('**/R.java')
project.tasks.getByName("check").dependsOn checkstyle
}

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,9 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}

185
android/java/checks.xml Normal file
View File

@@ -0,0 +1,185 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->
<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!-- <module name="JavadocPackage"/> -->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!-- <module name="NewlineAtEndOfFile"/> -->
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength">
<property name="max" value="2500"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!-- <module name="Header"> -->
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->
<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
-->
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<!--
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
-->
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!-- <module name="LineLength"/> -->
<module name="MethodLength">
<property name="max" value="200"/>
</module>
<!-- <module name="ParameterNumber"/> -->
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<!--<module name="NoWhitespaceAfter"/>-->
<module name="NoWhitespaceBefore"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<!-- <module name="RedundantModifier"/> -->
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!-- <module name="AvoidInlineConditionals"/> -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!--<module name="HiddenField"/>-->
<module name="IllegalInstantiation"/>
<!-- <module name="InnerAssignment"/> -->
<!-- <module name="MagicNumber"/> -->
<!-- <module name="MissingSwitchDefault"/> -->
<!-- <module name="RedundantThrows"/> -->
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<!-- <module name="FinalClass"/> -->
<!-- <module name="HideUtilityClassConstructor"/> -->
<!-- <module name="InterfaceIsType"/> -->
<!-- <module name="VisibilityModifier"/> -->
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<!-- <module name="FinalParameters"/> -->
<!-- <module name="TodoComment"/> -->
<module name="UpperEll"/>
</module>
</module>

View File

@@ -1,49 +0,0 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
repositories {
jcenter()
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 4
versionName "0.1.3"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
checkAllWarnings true
disable 'IconMissingDensityFolder'
}
buildTypes {
debug {
jniDebuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
all*.exclude group: 'commons-collections', module: 'commons-collections'
}
dependencies {
compile 'commons-validator:commons-validator:1.4.1'
compile 'com.android.support:support-annotations:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}

View File

@@ -1,2 +1,2 @@
include ':app'
include ':lib'
include ':MapboxGLAndroidSDK'
include ':MapboxGLAndroidSDKTestApp'

View File

@@ -77,7 +77,7 @@
'../common/ca-bundle.crt',
'../styles/styles'
],
'destination': '<(pwd)/java/lib/src/main/assets'
'destination': '<(pwd)/java/MapboxGLAndroidSDK/src/main/assets'
},
],
@@ -85,7 +85,7 @@
{
'action_name': 'Strip dynamic library',
'inputs': [ '<(PRODUCT_DIR)/lib.target/libmapbox-gl.so' ],
'outputs': [ '<(pwd)/java/lib/src/main/jniLibs/$(JNIDIR)/libmapbox-gl.so' ],
'outputs': [ '<(pwd)/java/MapboxGLAndroidSDK/src/main/jniLibs/$(JNIDIR)/libmapbox-gl.so' ],
'action': [ '$(STRIP)', '<@(_inputs)', '-o', '<@(_outputs)' ]
},
],