build.gradle 2.61 KB
Newer Older
1
2
3
4
5
6
7
8
static def getSystemVariableOrDefault(String variable, String defaultValue) {
    def value = System.getenv(variable)
    if(value == null) {
        return defaultValue
    }
    return value
}

Daniel Wolf's avatar
Daniel Wolf committed
9
10
11
12
13
14
15
16
ext.public_nexus_user = "publicaccess"
def getNexusUser(){
    def user = System.getenv("NEXUS_USER")
    if(user == null){
        println "Using public Nexus user"
        user = public_nexus_user
    } else {
        println "Nexus user: $user"
Daniel Wolf's avatar
Daniel Wolf committed
17
    }
Daniel Wolf's avatar
Daniel Wolf committed
18
19
    return user
}
Daniel Wolf's avatar
Daniel Wolf committed
20

Daniel Wolf's avatar
Daniel Wolf committed
21
22
23
24
25
26
27
ext.public_nexus_token = "HWGxGVPtvV4p3ZS9RSXf"
def getNexusPassword(){
    def pw = System.getenv("NEXUS_PASSWORD")
    if(pw == null){
        println "Using public Nexus password"
        pw = public_nexus_token
    }
Daniel Wolf's avatar
Daniel Wolf committed
28
29
30
    return pw
}

Daniel Wolf's avatar
Daniel Wolf committed
31
32
ext.nexus_user = getNexusUser()
ext.nexus_password = getNexusPassword()
Daniel Wolf's avatar
Daniel Wolf committed
33
34

buildscript {
Daniel Wolf's avatar
Daniel Wolf committed
35
36
37
    ext {
        ext.KOTLIN_VERSION = '1.5.10'
    }
Daniel Wolf's avatar
Daniel Wolf committed
38
    ext.ANDROID_COMPILE_SDK = (System.getenv("ANDROID_COMPILE_SDK") == null ? 30 : System.getenv("ANDROID_COMPILE_SDK")).toInteger()
39
40
    ext.ANDROID_TARGET_SDK = (System.getenv("ANDROID_TARGET_SDK") == null ? ANDROID_COMPILE_SDK : System.getenv("ANDROID_TARGET_SDK")).toInteger()
    ext.ANDROID_MIN_SDK = (System.getenv("ANDROID_MIN_SDK") == null ? 14 : System.getenv("ANDROID_COMPILE_SDK")).toInteger()
Daniel Wolf's avatar
Daniel Wolf committed
41
    ext.ANDROID_GRADLE_PLUGIN_VERSION = System.getenv("ANDROID_GRADLE_PLUGIN_VERSION") == null ? "4.2.1" : System.getenv("ANDROID_GRADLE_PLUGIN_VERSION")
42
43
44
45
46
47

    println "COMPILE SDK Version: $ANDROID_COMPILE_SDK"
    println "TARGET SDK Version: $ANDROID_TARGET_SDK"
    println "MIN SDK: $ANDROID_MIN_SDK"
    println "---------------------"

Daniel Wolf's avatar
Daniel Wolf committed
48
    repositories {
Daniel Wolf's avatar
Daniel Wolf committed
49
        mavenCentral()
Daniel Wolf's avatar
Daniel Wolf committed
50
        google()
Daniel Wolf's avatar
Daniel Wolf committed
51
52
53
        maven {
            url 'http://storage.googleapis.com/r8-releases/raw'
        }
Daniel Wolf's avatar
Daniel Wolf committed
54
55
    }
    dependencies {
Daniel Wolf's avatar
Daniel Wolf committed
56
        classpath "com.android.tools.build:gradle:$ANDROID_GRADLE_PLUGIN_VERSION"
Daniel Wolf's avatar
Daniel Wolf committed
57
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
58
        classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18"
Daniel Wolf's avatar
Daniel Wolf committed
59
60
61
62
63
64
65

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

allprojects {
66
    apply plugin: 'maven-publish'
Daniel Wolf's avatar
Daniel Wolf committed
67
68
    repositories {
        google()
Daniel Wolf's avatar
Daniel Wolf committed
69
        mavenCentral()
Daniel Wolf's avatar
Daniel Wolf committed
70
71
72
73
74
75
76
        maven {
            url 'https://nexus.frostnerd.com/repository/libs-release/'
            credentials {
                username = "$nexus_user"
                password = "$nexus_password"
            }
        }
Daniel Wolf's avatar
Daniel Wolf committed
77
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
Daniel Wolf's avatar
Daniel Wolf committed
78
        maven { url 'https://jitpack.io' }
Daniel Wolf's avatar
Daniel Wolf committed
79
80
81
82
83
84
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}