Skip to content
Permalink
Browse files

Gradle improvements

  • Loading branch information...
devemux86 committed Sep 15, 2019
1 parent fd811ab commit bcf3c11d6c718fa30a2f2adf16d9ffc915feec28
@@ -9,14 +9,11 @@ buildscript {
}
}

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 = "29.0.2"
ext.jUnitVersion = "4.12"

@@ -40,8 +37,6 @@ static def versionCode() { return 1 }

def versionName() { return version }

// Configuration injection for all subprojects

subprojects {
repositories {
google()
@@ -54,105 +49,3 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_1_7
}
}

// Configuration for all plain Java projects
project.ext.javalibraryprojects = ["mapsforge-core", "mapsforge-map", "mapsforge-map-awt", "mapsforge-map-reader", "mapsforge-map-writer", "mapsforge-poi", "mapsforge-poi-awt", "mapsforge-poi-writer", "mapsforge-themes"]
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", "sqlite-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.javaCompileProvider
task.exclude '**/BuildConfig.class'
task.exclude '**/R.class'
task.exclude '**/R$*.class'
task.from variant.javaCompileProvider.get().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 project.versionCode()
versionName project.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
}
}
}
@@ -0,0 +1,12 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
testImplementation "junit:junit:$jUnitVersion"
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,4 +1,58 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

dependencies {
api project(":mapsforge-map-reader")
api 'com.caverock:androidsvg:1.3'
}

android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

defaultConfig {
versionCode project.versionCode()
versionName project.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
}
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == "debug")
return

def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompileProvider
jar.exclude '**/BuildConfig.class'
jar.exclude '**/R.class'
jar.exclude '**/R$*.class'
jar.from variant.javaCompileProvider.get().destinationDir
artifacts.add('archives', jar)
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,5 +1,15 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
api project(":mapsforge-map-reader")
api 'com.github.blackears:svgSalamander:v1.1.1'
testImplementation project(":mapsforge-themes")
testImplementation "junit:junit:$jUnitVersion"
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,3 +1,13 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
api project(":mapsforge-map")
testImplementation "junit:junit:$jUnitVersion"
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,9 +1,13 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
implementation project(":mapsforge-core")
implementation 'com.google.guava:guava:23.0'
implementation 'net.sf.trove4j:trove4j:3.0.3'
implementation 'org.locationtech.jts:jts-core:1.15.0'
compileOnly 'org.openstreetmap.osmosis:osmosis-core:0.46'
testImplementation "junit:junit:$jUnitVersion"
}

sourceSets.test.compileClasspath += configurations.compileOnly
@@ -30,3 +34,9 @@ task fatJar(type: Jar, dependsOn: classes) {
artifacts {
archives fatJar
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,7 +1,17 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
api project(":mapsforge-core")
api 'net.sf.kxml:kxml2:2.3.0'
testImplementation 'commons-io:commons-io:2.5'
testImplementation "junit:junit:$jUnitVersion"
testImplementation 'org.mortbay.jetty:jetty:6.1.26'
testImplementation 'org.slf4j:slf4j-log4j12:1.7.25'
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,4 +1,58 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

dependencies {
api project(":mapsforge-poi")
api project(":sqlite-android")
}

android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

defaultConfig {
versionCode project.versionCode()
versionName project.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
}
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name == "debug")
return

def jar = project.tasks.create "jar${name.capitalize()}", Jar
jar.dependsOn variant.javaCompileProvider
jar.exclude '**/BuildConfig.class'
jar.exclude '**/R.class'
jar.exclude '**/R$*.class'
jar.from variant.javaCompileProvider.get().destinationDir
artifacts.add('archives', jar)
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,4 +1,13 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
api project(":mapsforge-poi")
api 'org.xerial:sqlite-jdbc:3.20.0'
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,3 +1,6 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
implementation project(":mapsforge-poi")
implementation 'com.google.guava:guava:23.0'
@@ -29,3 +32,9 @@ task fatJar(type: Jar, dependsOn: classes) {
artifacts {
archives fatJar
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
@@ -1,3 +1,13 @@
apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
api project(":mapsforge-core")
testImplementation "junit:junit:$jUnitVersion"
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}

0 comments on commit bcf3c11

Please sign in to comment.
You can’t perform that action at this time.