build.gradle 4.13 KB
Newer Older
armin's avatar
armin committed
1
def readVarFile() {
2
    File varFile = file('VARIABLES.txt')
armin's avatar
armin committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    def qtVars = [:]
    varFile.eachLine { line ->
        if (line.trim()) {
            def eq = line.indexOf('=')
            if (eq > 0) {
                def key = line.substring(0, eq)
                def value = line.substring(eq+1)
                qtVars."$key" = value
            }
        }
    }
    return qtVars
}

def QtApp = readVarFile()


def versionMajor = QtApp.VER_MAJ.toInteger()
def versionMinor = QtApp.VER_MIN.toInteger()
def versionPatch = QtApp.VER_PAT.toInteger()

24
25
26
27
def android_armv7 = QtApp.ANDROID_ARMv7.toInteger()
def android_armv8 = QtApp.ANDROID_ARM64.toInteger()
def android_x86 = QtApp.ANDROID_x86.toInteger()
def android_x86_64 = QtApp.ANDROID_x86_64.toInteger()
armin's avatar
armin committed
28

armin's avatar
armin committed
29
30
31
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
armin's avatar
armin committed
32
        maven { url 'https://maven.google.com' }
Dennis Beier's avatar
Dennis Beier committed
33
        jcenter()
armin's avatar
armin committed
34
35
36
    }

    dependencies {
armin's avatar
armin committed
37
        classpath 'com.android.tools.build:gradle:3.2.1'
armin's avatar
armin committed
38
        classpath 'com.google.gms:google-services:4.1.0'
armin's avatar
armin committed
39
40
41
42
43
44
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
Dennis Beier's avatar
Dennis Beier committed
45

armin's avatar
armin committed
46
47
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
armin's avatar
armin committed
48
        maven { url 'https://maven.google.com' }
Dennis Beier's avatar
Dennis Beier committed
49
        jcenter()
armin's avatar
armin committed
50

armin's avatar
armin committed
51
52
53
54
55
56
57
    }
}

apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
armin's avatar
armin committed
58
59
    maven { url 'https://maven.google.com' }

armin's avatar
armin committed
60
61
62
63
64
65
66
}

apply plugin: 'io.fabric'

crashlytics {
    enableNdk true
    androidNdkOut '.'
armin's avatar
armin committed
67
    androidNdkLibsOut './crashlytics/'
armin's avatar
armin committed
68
69
70
}

dependencies {
armin's avatar
armin committed
71
72
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
armin's avatar
armin committed
73
74
        transitive = true
    }
armin's avatar
armin committed
75
    implementation('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
armin's avatar
armin committed
76
77
        transitive = true
    }
armin's avatar
armin committed
78
    implementation 'com.android.support:appcompat-v7:26.1.0'
armin's avatar
armin committed
79
80
81
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
82
    implementation 'com.android.support:appcompat-v7:28.0.0'
armin's avatar
armin committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

}



android {
    /*******************************************************
     * The following variables:
     * - androidBuildToolsVersion,
     * - androidCompileSdkVersion
     * - qt5AndroidDir - holds the path to qt android files
     *                   needed to build any Qt application
     *                   on Android.
     *
     * are defined in gradle.properties file. This file is
     * updated by QtCreator and androiddeployqt tools.
     * Changing them manually might break the compilation!
     *******************************************************/

    compileSdkVersion androidCompileSdkVersion.toInteger()

    buildToolsVersion androidBuildToolsVersion

    defaultConfig {
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

        if (android_armv7 == 1) {
            ndk {
                abiFilters 'armeabi-v7a'
            }
        } else if (android_armv8 == 1){
            ndk {
                abiFilters 'arm64-v8a'
            }
        } else if(android_x86 == 1){
            ndk {
                abiFilters 'x86'
            }
        }else if(android_x86_64 == 1){
            ndk {
                abiFilters 'x86_64'
            }
armin's avatar
armin committed
124
        }
125

armin's avatar
asd    
armin committed
126
        versionCode versionMajor * (100000 + versionMinor * 1000)+1 + versionPatch * 100
armin's avatar
armin committed
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
        versionName QtApp.VERSION
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
            res.srcDirs = [qt5AndroidDir + '/res', 'res']
            resources.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }
    }

    lintOptions {
        abortOnError false
    }
armin's avatar
armin committed
146

armin's avatar
armin committed
147
148
}

armin's avatar
armin committed
149
150


armin's avatar
armin committed
151
apply plugin: 'com.google.gms.google-services'
armin's avatar
armin committed
152
153

copy {
154
    from 'build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-ndk/1.1.6/jni/'
armin's avatar
armin committed
155
156
157
158
159
160
161
    into 'libs'
    include '**/*'
}
copy {
    from 'libs'
    into 'crashlytics'
    include '**/*'
162
}