Skip to content

Commit f59f52c

Browse files
author
Cameron Mace
authored
fixed checkstyle, fixed gitignore, and added config.gradle (mapbox#224)
* fixed checkstyle, fixed gitignore, and added config.gradle * added checkstyle to bitrise.yml * adding missing input line
1 parent 88e0364 commit f59f52c

12 files changed

Lines changed: 317 additions & 196 deletions

.gitignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
secring.gpg
1+
# Gradle files
2+
.gradle/
3+
4+
# IntelliJ files
5+
.idea/
6+
*.iml
7+
8+
# Build files
9+
build/
10+
*.so
11+
*.apk
12+
BuildConfig.java
13+
.DS_Store
14+
15+
# Local settings
16+
local.properties
17+
18+
# Capture files
19+
captures/
20+
21+
# Token file
22+
libandroid/app/src/main/res/values/developer-config.xml

libandroid/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

libandroid/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ dependencies {
5555
// Testing
5656
testCompile 'junit:junit:4.12'
5757
}
58+
59+
apply from: 'gradle-checkstyle.gradle'
60+
apply from: 'gradle-config.gradle'
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
apply plugin: 'checkstyle'
22

3-
checkstyle.toolVersion = '7.1'
3+
checkstyle {
4+
toolVersion = "7.1.1" // 7.3
5+
configFile = "../../checkstyle.xml" as File
6+
}
47

58
task checkstyle(type: Checkstyle) {
69
description 'Checks if the code adheres to coding standards'
710
group 'verification'
8-
9-
configFile = new File(rootDir, "checkstyle.xml")
11+
configFile file("../../checkstyle.xml")
1012
source 'src'
1113
include '**/*.java'
1214
exclude '**/gen/**'
13-
1415
classpath = files()
1516
ignoreFailures = false
1617
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// Configuration file for gradle build execution.
3+
//
4+
5+
task accessToken {
6+
def tokenFile = new File("app/src/main/res/values/developer-config.xml")
7+
if (!tokenFile.exists()) {
8+
String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
9+
"<resources>\n" +
10+
" <string name=\"mapbox_access_token\">" + "$System.env.MAPBOX_ACCESS_TOKEN" + "</string>\n" +
11+
"</resources>"
12+
13+
if (tokenFileContents == null) {
14+
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
15+
}
16+
tokenFile.write(tokenFileContents)
17+
}
18+
}
19+
20+
gradle.projectsEvaluated {
21+
preBuild.dependsOn('accessToken')
22+
}

libandroid/lib/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies {
4747

4848
apply from: 'gradle-javadoc.gradle'
4949
apply from: 'gradle-mvn-push.gradle'
50+
apply from: 'gradle-checkstyle.gradle'
5051

5152
// See: https://github.com/chrisbanes/gradle-mvn-push/issues/43#issuecomment-84140513
5253
afterEvaluate { project ->
@@ -56,3 +57,4 @@ afterEvaluate { project ->
5657
}
5758
}
5859
}
60+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apply plugin: 'checkstyle'
2+
3+
checkstyle {
4+
toolVersion = "7.1.1" // 7.3
5+
configFile = "../../checkstyle.xml" as File
6+
}
7+
8+
task checkstyle(type: Checkstyle) {
9+
description 'Checks if the code adheres to coding standards'
10+
group 'verification'
11+
configFile file("../../checkstyle.xml")
12+
source 'src'
13+
include '**/*.java'
14+
exclude '**/gen/**'
15+
classpath = files()
16+
ignoreFailures = false
17+
}

libjava/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

libjava/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,4 @@ allprojects {
2020

2121
task clean(type: Delete) {
2222
delete rootProject.buildDir
23-
}
24-
25-
apply from: 'checkstyle.gradle'
23+
}

libjava/lib/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ def getGitRevision() {
3838
}
3939

4040
apply from: 'gradle-mvn-push.gradle'
41+
apply from: 'gradle-checkstyle.gradle'

0 commit comments

Comments
 (0)