build.gradle 3.48 KB
Newer Older
1
2
3
4
5
6
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
Tobias Wich's avatar
Tobias Wich committed
7
        classpath 'com.android.tools.build:gradle:3.5.0'
8
9
10
11
12
13
14
15
16
17
        classpath 'digital.wup:android-maven-publish:3.6.2'
    }
}


apply plugin: 'com.android.library'
apply plugin: 'digital.wup.android-maven-publish'


android {
Tobias Wich's avatar
Tobias Wich committed
18
19
    compileSdkVersion 29
    buildToolsVersion '29.0.2'
20
21

    defaultConfig {
22
        minSdkVersion 17
Tobias Wich's avatar
Tobias Wich committed
23
        targetSdkVersion 29
24
        //testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
25
26
27
28
	    multiDexEnabled true
    }

    lintOptions {
Tobias Wich's avatar
Tobias Wich committed
29
30
31
32
        // disable warnings caused by bouncycastle JCA
        disable "TrustAllX509TrustManager"
        // disable warnings caused by jaxb annotations
        disable "InvalidPackage"
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
    }

    packagingOptions {
        /* Otherwise DuplicateFileException */
        //exclude 'LICENSE.Open-eCard'
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    sourceSets {
        main {
            resources {
                srcDir("$buildDir/bundleImpl")
            }
        }
    }
}


repositories {
    google()
    jcenter()
    mavenLocal()
}


// get version and groupId from pom.xml

def pomDom = new XmlSlurper()
        .parse(new File(projectDir, "pom.xml"))
        .declareNamespace(m: "http://maven.apache.org/POM/4.0.0")
version = pomDom.'m:parent'.'m:version'.text()
group pomDom.'m:groupId'.text()


configurations {
72
    bundleImpl
73
74
75
76
}


dependencies {
Tobias Wich's avatar
Tobias Wich committed
77
78
79
80
    //implementation 'androidx.appcompat:appcompat:1.0.0'
    //androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
    //    exclude group: 'com.android.support', module: 'support-annotations'
    //})
81
82
83
84
85
86
87
88
89
90
    //testImplementation 'junit:junit:4.12'

    // necessary dependencies which are not packed into the aar
    api 'org.slf4j:slf4j-api:1.7.25'
    api 'xerces:xercesImpl:2.12.0'

    // compile time dependencies which are not needed at runtime
    compileOnly 'javax.xml.bind:jaxb-api:2.3.1'
    compileOnly 'com.google.code.findbugs:annotations:3.0.1u2'

91
92
93
    // Android Oec-Core
    bundleImpl "org.openecard.clients:android-core:${version}"

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
145
    // needed or the thing crashes (should be made an api dependecy)
    bundleImpl "javax.jws.jsr181-api:jsr181-api:2.1.1"

    // add all bundleImpl deps, so that class files get copied and the deps are available for the compilation
    implementation configurations.bundleImpl.asFileTree
}



// custom tasks to take care of OeC resource files which are excluded by the aar build

task copyLibs(type: Copy) {
    dependsOn configurations.bundleImpl

    from {
        configurations.bundleImpl.collect {
            zipTree(it)
        }
    }
    into "$buildDir/bundleImpl/"
    exclude '**/*.class'
    exclude 'META-INF/maven/**'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'cif-repo/repo-config.properties'
}

preBuild.dependsOn(copyLibs)



// deployment config

publishing {
    repositories {
        maven {
            def releasesRepoUrl = "https://mvn.ecsec.de/repository/openecard-release"
            def snapshotsRepoUrl = "https://mvn.ecsec.de/repository/openecard-snapshot"
            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
            // use credentials from globally configured properties
            credentials {
                username = ecsecRepoUser
                password = ecsecRepoPass
            }
        }
    }

    publications {
        lib(MavenPublication) {
            from components.android
        }
    }
}