/
build.gradle
115 lines (95 loc) · 3.87 KB
/
build.gradle
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
apply plugin: 'com.android.library'
apply plugin: 'de.mannodermaus.android-junit5'
def dirToplev = project.layout.projectDirectory.asFile.absolutePath
// project licence: The MirOS Licence AND GPLv2 with Classpath Exception
// see src/main/resources/LICENCE.ecn-lib and src/main/resources/COPYING
//
// apparently, there’s no standardised way to declare the project licence in Gradle:
// https://discuss.gradle.org/t/how-to-declare-a-license-for-a-gradle-project/26114
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 26
//noinspection OldTargetApi
targetSdkVersion 26
ndkVersion "21.3.6528147"
versionCode 3
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
externalNativeBuild {
cmake {
//noinspection GroovyAssignabilityCheck because Gradle and the IDE have different world views…
arguments "-DTOPLEV=" + dirToplev
}
return void // WTF‽
}
return void // WTF‽
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/native/CMakeLists.txt"
return void // WTF‽
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
//noinspection GradleDependency
buildToolsVersion = '28.0.3'
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
annotationProcessor 'org.projectlombok:lombok:1.18.16'
//noinspection AnnotationProcessorOnCompilePath because both are needed :/
compileOnly 'org.projectlombok:lombok:1.18.16'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.16'
//noinspection AnnotationProcessorOnCompilePath because both are needed :/
testCompileOnly 'org.projectlombok:lombok:1.18.16'
//noinspection GradleDependency
androidTestImplementation 'com.android.support.test:runner:1.0.1'
//noinspection GradleDependency
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//noinspection GradleDependency
androidTestImplementation 'junit:junit:4.12'
androidTestAnnotationProcessor 'org.projectlombok:lombok:1.18.16'
//noinspection AnnotationProcessorOnCompilePath because both are needed :/
androidTestCompileOnly 'org.projectlombok:lombok:1.18.16'
}
def dirForNativeNoNDK = project.layout.buildDirectory.get().dir("native-noNDK")
def srcForNativeNoNDK = project.layout.projectDirectory.dir("src/main/native").asFile
task createNativeNoNDK() {
def dstdir = dirForNativeNoNDK.asFile
if (!dstdir.exists()) dstdir.mkdirs()
}
task buildCMakeNativeNoNDK(type: Exec) {
dependsOn createNativeNoNDK
workingDir dirForNativeNoNDK
commandLine "/usr/bin/env", "cmake", "-DTOPLEV=" + dirToplev, "-DUNDER_NDK=OFF", srcForNativeNoNDK.absolutePath
}
task buildGMakeNativeNoNDK(type: Exec) {
dependsOn buildCMakeNativeNoNDK
workingDir dirForNativeNoNDK
commandLine "/usr/bin/env", "make"
}
project.afterEvaluate {
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
testDebugUnitTest {
dependsOn buildGMakeNativeNoNDK
systemProperty "java.library.path", dirForNativeNoNDK.asFile.absolutePath + ":" + System.getProperty("java.library.path")
}
testReleaseUnitTest {
dependsOn buildGMakeNativeNoNDK
systemProperty "java.library.path", dirForNativeNoNDK.asFile.absolutePath + ":" + System.getProperty("java.library.path")
}
}
}