[android] - cleanup unused resources and gradle configurations. (#6896)

This commit is contained in:
Tobrun
2016-11-07 09:25:17 +01:00
committed by GitHub
parent afd43eea3a
commit c5992d71f5
15 changed files with 298 additions and 612 deletions

View File

@@ -1,25 +1,4 @@
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'devicefarm'
task accessToken {
def tokenFile = new File("MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml")
if (!tokenFile.exists()) {
String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<resources>\n" +
" <string name=\"mapbox_access_token\">" + "$System.env.MAPBOX_ACCESS_TOKEN" + "</string>\n" +
"</resources>"
if (tokenFileContents == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
}
tokenFile.write(tokenFileContents)
}
}
gradle.projectsEvaluated {
preBuild.dependsOn('accessToken')
}
ext {
supportLibVersion = '25.0.0'
@@ -36,7 +15,6 @@ android {
versionCode 11
versionName "5.0.0"
// Specify AndroidJUnitRunner as the default test instrumentation runner
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -64,7 +42,6 @@ android {
buildTypes {
debug {
// run code coverage reports
testCoverageEnabled = true
}
release {
@@ -106,63 +83,9 @@ dependencies {
androidTestCompile 'com.squareup.spoon:spoon-client:1.6.2'
}
checkstyle {
configFile project.file('../checks.xml')
showViolations true
}
def getAccessKeyDeviceFarm() {
if (project.hasProperty('AWS_ACCESS_KEY_ID_DEVICE_FARM')) {
return AWS_ACCESS_KEY_ID_DEVICE_FARM
} else {
println("Could not locate AWS_ACCESS_KEY_ID_DEVICE_FARM in gradle.properties")
return ""
}
}
def getSecretAccessKeyDeviceFarm() {
if (project.hasProperty('AWS_SECRET_ACCESS_KEY_DEVICE_FARM')) {
return AWS_SECRET_ACCESS_KEY_DEVICE_FARM
} else {
println("Could not locate AWS_SECRET_ACCESS_KEY_DEVICE_FARM in gradle.properties")
return ""
}
}
devicefarm {
projectName "Mapbox GL Android" // required: Must already exists.
devicePool "sanity" // optional: Defaults to "Top Devices"
authentication {
accessKey getAccessKeyDeviceFarm()
secretKey getSecretAccessKeyDeviceFarm()
}
devicestate {
wifi "on"
bluetooth "off"
gps "on"
nfc "on"
latitude 47.6204 // default
longitude - 122.3491 // default
}
instrumentation {
}
}
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
}
apply from: 'gradle-make.gradle'
apply from: 'gradle-config.gradle'
apply from: 'gradle-device-farm.gradle'
apply from: 'gradle-spoon.gradle'

View File

@@ -0,0 +1,22 @@
//
// Configuration file for gradle build execution.
//
task accessToken {
def tokenFile = new File("MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml")
if (!tokenFile.exists()) {
String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<resources>\n" +
" <string name=\"mapbox_access_token\">" + "$System.env.MAPBOX_ACCESS_TOKEN" + "</string>\n" +
"</resources>"
if (tokenFileContents == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
}
tokenFile.write(tokenFileContents)
}
}
gradle.projectsEvaluated {
preBuild.dependsOn('accessToken')
}

View File

@@ -0,0 +1,43 @@
apply plugin: 'devicefarm'
def getAccessKeyDeviceFarm() {
if (project.hasProperty('AWS_ACCESS_KEY_ID_DEVICE_FARM')) {
return AWS_ACCESS_KEY_ID_DEVICE_FARM
} else {
println("Could not locate AWS_ACCESS_KEY_ID_DEVICE_FARM in gradle.properties")
return ""
}
}
def getSecretAccessKeyDeviceFarm() {
if (project.hasProperty('AWS_SECRET_ACCESS_KEY_DEVICE_FARM')) {
return AWS_SECRET_ACCESS_KEY_DEVICE_FARM
} else {
println("Could not locate AWS_SECRET_ACCESS_KEY_DEVICE_FARM in gradle.properties")
return ""
}
}
devicefarm {
projectName "Mapbox GL Android" // required: Must already exists.
devicePool "sanity" // optional: Defaults to "Top Devices"
authentication {
accessKey getAccessKeyDeviceFarm()
secretKey getSecretAccessKeyDeviceFarm()
}
devicestate {
wifi "on"
bluetooth "off"
gps "on"
nfc "on"
latitude 47.6204 // default
longitude - 122.3491 // default
}
instrumentation {
}
}

View File

@@ -0,0 +1,18 @@
//
// Contains GL-native make commands
//
task makeClean(type: Exec) {
workingDir '../../'
commandLine 'make', 'clean'
}
task makeAndroid(type: Exec) {
workingDir '../../'
commandLine 'make', 'android'
}
task makeAndroidAll(type: Exec) {
workingDir '../../'
commandLine 'make', 'apackage'
}

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Ignore errors caused by icon burning -->
<issue id="IconLauncherShape" severity="ignore">
<ignore path="res/drawable-mdpi/icon.png" />
<ignore path="res/drawable-hdpi/icon.png" />
<ignore path="res/drawable-xdpi/icon.png" />
<ignore path="res/drawable-xxdpi/icon.png" />
<ignore path="res/drawable-mdpi/icon_burned.png" />
<ignore path="res/drawable-hdpi/icon_burned.png" />
<ignore path="res/drawable-xdpi/icon_burned.png" />
<ignore path="res/drawable-xxdpi/icon_burned.png" />
</issue>
<issue id="IconDuplicates" severity="ignore">
<ignore path="res/drawable-mdpi/icon.png" />
<ignore path="res/drawable-hdpi/icon.png" />
<ignore path="res/drawable-xdpi/icon.png" />
<ignore path="res/drawable-xxdpi/icon.png" />
<ignore path="res/drawable-mdpi/icon_burned.png" />
<ignore path="res/drawable-hdpi/icon_burned.png" />
<ignore path="res/drawable-xdpi/icon_burned.png" />
<ignore path="res/drawable-xxdpi/icon_burned.png" />
</issue>
<issue id="UnusedResources" severity="ignore">
<ignore path="res/drawable-mdpi/icon.png" />
<ignore path="res/drawable-hdpi/icon.png" />
<ignore path="res/drawable-xdpi/icon.png" />
<ignore path="res/drawable-xxdpi/icon.png" />
<ignore path="res/drawable-mdpi/icon_burned.png" />
<ignore path="res/drawable-hdpi/icon_burned.png" />
<ignore path="res/drawable-xdpi/icon_burned.png" />
<ignore path="res/drawable-xxdpi/icon_burned.png" />
</issue>
</lint>

View File

@@ -1,21 +0,0 @@
#!/bin/bash
if [[ -z `which iconoblast` ]]; then
echo "Requires https://github.com/mapbox/iconoblast"
exit 1
fi
commit=`git rev-parse --short HEAD`
branch=`git rev-parse --abbrev-ref HEAD`
repo=`git remote show origin | grep 'Fetch URL' | sed -e 's/.*github\.com:mapbox\///' -e 's/\.git$//' -e 's/^mapbox-//'`
pwd=`pwd`
cd src/main/res
for folder in `find . -maxdepth 1 -type d -name drawable-\*`
do
cd ${folder}
cp icon.png icon_burned.png
iconoblast icon_burned.png $commit $branch $repo
cd ..
done
cd ${pwd}