forked from mapsforge/mapsforge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
169 lines (137 loc) · 5.25 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
def filterProjects(filter) {
return subprojects.findAll { project -> filter.contains(project.name) }
}
allprojects {
group = 'org.mapsforge'
version = 'master-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.androidBuildVersionTools = "25.0.0"
ext.jUnitVersion = "4.12"
description = """The mapsforge project provides free and open software for OpenStreetMap-based applications."""
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
}
}
}
// no injection of functions, so via inheritance
def androidCompileSdk() { return 25 }
def androidMinSdk() { return 10 }
// this is the last SDK with the old permissions system, so this should not change in the future
def androidTargetSdkOldPermissions() { return 22 }
// moving forward we will target the latest SDK (that will all have the new permissions system)
def androidTargetSdkRuntimePermissions() { return androidCompileSdk() }
def versionCode() { return 61 }
def versionName() { return version }
// Configuration injection for all subprojects
subprojects {
repositories {
jcenter()
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
}
// Configuration for all plain Java projects
project.ext.javalibraryprojects = ["mapsforge-core", "mapsforge-map", "mapsforge-themes", "mapsforge-map-reader", "mapsforge-map-awt", "mapsforge-map-writer", "mapsforge-poi", "mapsforge-poi-awt", "mapsforge-poi-writer"]
project.ext.javaprojects = project.javalibraryprojects + ["mapsforge-samples-awt"]
configure(filterProjects(project.javalibraryprojects)) {
apply plugin: 'maven'
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
}
configure(filterProjects(project.javaprojects)) {
apply plugin: 'java'
//apply plugin: 'checkstyle'
dependencies {
testCompile "junit:junit:$jUnitVersion"
}
/*checkstyle {
showViolations = false // turn on for reporting
// as of Gradle 2.2.1 every sub project seems to require a checkstyle file, this
// directive forces all projects to use the shared file in the root project
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
}*/
// set java source encoding, otherwise some tests fail
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
}
// Configuration for Android projects
project.ext.androidlibraryprojects = ["mapsforge-map-android", "mapsforge-map-android-extras", "spatialite-android", "mapsforge-poi-android"]
project.ext.androidapkprojects = ["mapsforge-samples-android"]
project.ext.androidprojects = project.androidlibraryprojects + project.androidapkprojects
// TODO get checkstyle and pmd working for android (right now it does not work out of the box, so better wait for official fix)
configure(filterProjects(project.androidapkprojects)) {
apply plugin: 'com.android.application'
android {
productFlavors {
oldpermissions {
targetSdkVersion androidTargetSdkOldPermissions()
}
runtimepermissions {
targetSdkVersion androidTargetSdkRuntimePermissions()
}
}
}
}
configure(filterProjects(project.androidlibraryprojects)) {
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals("debug")) {
print "Skipping debug jar"
return; // Skip debug builds.
}
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
artifacts.add('archives', task);
}
if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
}
configure(filterProjects(project.androidprojects)) {
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
versionCode versionCode()
versionName versionName()
minSdkVersion androidMinSdk()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}