forked from mapsforge/mapsforge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
155 lines (125 loc) · 4.67 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
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
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 = "28.0.1"
ext.jUnitVersion = "4.12"
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
}
}
}
static def androidCompileSdk() { return 28 }
// Minimum API Level by Support Library
static def androidMinSdk() { return 14 }
static def androidTargetSdk() { return 22 }
static def versionCode() { return 1 }
def versionName() { return version }
// Configuration injection for all subprojects
subprojects {
repositories {
google()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
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", "spatialite-android"]
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-library'
//apply plugin: 'checkstyle'
dependencies {
testImplementation "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-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'
}
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 == "debug")
return
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompiler
task.from variant.javaCompiler.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()
targetSdkVersion androidTargetSdk()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}