summaryrefslogtreecommitdiff
path: root/java/test/android/controller/build.gradle
blob: e8f9040f8219f9d5ddb89b88d40896cff3316dce (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
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'gradle.plugin.com.zeroc.gradle.ice-builder:slice:1.4.7'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.zeroc.gradle.ice-builder.slice'

slice {
    output = file("${project.buildDir}/generated/source/ice")
    cppConfiguration = project.cppConfiguration
    cppPlatform = project.cppPlatform
    if(!System.env.ICE_BIN_DIST?.split(" ").find{ it == 'all' || it.contains('java')}) {
        iceHome = project.hasProperty('iceHome') ? project.iceHome
                : System.getenv("ICE_HOME") != null ? System.env.ICE_HOME : new File("$rootProject.projectDir/../../../..").getCanonicalPath()
    }
    java {
        files = fileTree(dir: "$rootProject.projectDir/../../../../scripts/", includes: ['*.ice'])
    }
}

repositories {
    if(slice.jarDir != null) {
        flatDir {
            name "local"
            dirs slice.jarDir
        }
    }

    if(this.devRepo) {
        maven {
            url this.devRepo
        }
    }

    google()
    jcenter()
}

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.zeroc.testcontroller"
        minSdkVersion 24
        targetSdkVersion 28
        multiDexEnabled true // Necessary otherwise we'd exceed the 64K DEX limit.
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }

    buildTypes {
        debug {
            //
            // Set minifyEnabled to false because the test app loads classes dynamically.
            //
            minifyEnabled false
        }

        release {
            //
            // Set minifyEnabled to false because the test app loads classes dynamically.
            //
            minifyEnabled false
        }
    }
}

task copyBksTask(type: Copy) {
    from "${rootProject.projectDir}/../../../../certs/client.bks"
    from "${rootProject.projectDir}/../../../../certs/server.bks"
    into "src/main/res/raw"
}
preBuild.dependsOn(copyBksTask)

clean {
    delete("src/main/res/raw/client.bks")
    delete("src/main/res/raw/server.bks")
}

ext.localDependency = { artifactId ->
    if(project.slice.srcDist || System.env.ICE_BIN_DIST == "cpp") {
        return ":${artifactId}-${project.iceVersion}"
    } else {
        return "com.zeroc:${artifactId}:${project.iceVersion}"
    }
}

dependencies {
    implementation localDependency("glacier2")
    implementation localDependency("ice")
    implementation localDependency("icessl")
    runtimeOnly localDependency("icediscovery")
    runtimeOnly localDependency("icebt")

    implementation files("${rootProject.projectDir}/../../../lib/test.jar")
    runtimeOnly "org.apache.commons:commons-compress:1.14"
}