summaryrefslogtreecommitdiff
path: root/build.gradle
blob: d284d54a063bd60a4c5b48beab24dd433bad8d81 (plain)
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
apply plugin: 'com.android.application'
apply from: "$project.rootDir/gradle/scripts/git-scm-version.gradle"
apply plugin: 'checkstyle'

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

/*
task clean(type: Delete) {
    delete rootProject.buildDir
}
*/
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    signingConfigs {
        release {
            // We can leave these in environment variables
            storeFile file(System.getenv("KEYSTORE")  ?: "/store")
            keyAlias System.getenv("KEY_ALIAS")
            storePassword System.getenv("STORE_PASS")
            keyPassword System.getenv("STORE_PASS")
        }
    }
    defaultConfig {
        applicationId "org.navitproject.navit"
        minSdkVersion 10
        targetSdkVersion 29
        versionCode gitVersionCode
        versionName gitVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
        }
        externalNativeBuild {
            cmake {
                arguments '-DDISABLE_CXX=y', '-DUSE_PLUGINS=n', '-DBUILD_MAPTOOL=n', '-DXSL_PROCESSING=n', '-DSAMPLE_MAP=n', '-DCMAKE_SYSROOT='+android.ndkDirectory+'/sysroot'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if(file(System.getenv("KEYSTORE")  ?: "/store").exists()){
                signingConfig signingConfigs.release
            }
        }
    }
    lintOptions {
        disable 'UnusedResources'
        abortOnError true
    }
    sourceSets {
        main {
            manifest.srcFile "navit/android/AndroidManifest.xml"
            java.srcDirs = ["navit/android/src"]
            resources.srcDirs = ["navit/android/src"]
            renderscript.srcDirs = ["navit/android/src"]
            res.srcDirs = ["navit/android/res", "android-builddir/android/res"]
            assets.srcDirs = ["navit/android/assets", "android-builddir/android/assets"]
            }
    }
    externalNativeBuild {
        cmake {
            buildStagingDirectory "./android-builddir"
            path 'CMakeLists.txt'
        }
    }

    task checkstyleMain(type: Checkstyle){
        source 'navit/android/src'
        include '**/*.java'
        configFile = rootProject.file('checkstyle.xml')
        ignoreFailures = false
        showViolations = true
        // empty classpath
        classpath = files()
        reports {
            include ('**/*.java')
            xml.enabled = true
            html.enabled = true
            xml {
                destination file("checkstyle/checkstyleMain.xml")
            }
            html {
                destination file("checkstyle/checkstyleMain.html")
            }
        }

        checkstyle {
            toolVersion = '8.26'
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "navit-${variant.buildType.name}.apk"
        }
        // create tasks to generate Javadocs
        task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
            source = android.sourceSets.main.java.srcDirs
            destinationDir = file("navit/android/build/outputs/docs/javadoc/")
            title = rootProject.name
            options.memberLevel = JavadocMemberLevel.PACKAGE
            verbose = true
            failOnError false
        }
    }

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'navit/android/libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation 'junit:junit:4.12'
    implementation 'ch.acra:acra:4.9.2'
//    implementation 'com.android.support:support-v4:28.0.0'
}