-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathbuild.gradle
More file actions
93 lines (83 loc) · 3.47 KB
/
Copy pathbuild.gradle
File metadata and controls
93 lines (83 loc) · 3.47 KB
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
apply plugin: 'java-library'
apply plugin: 'kotlin'
tasks.withType(JavaCompile) {
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
options.release.set(8)
// Note: Gradle defaults to the platform default encoding, make sure to always use UTF-8 for UTF-8 tests.
options.encoding = "UTF-8"
}
// Produce Java 8 byte code, would default to Java 6.
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
repositories {
// Native lib might be deployed only in internal repo
if (project.hasProperty('gitlabUrl')) {
println "gitlabUrl=$gitlabUrl added to repositories."
maven {
url "$gitlabUrl/api/v4/groups/objectbox/-/packages/maven"
name "GitLab"
credentials(HttpHeaderCredentials) {
name = project.hasProperty("gitlabTokenName") ? gitlabTokenName : "Private-Token"
value = gitlabPrivateToken
}
authentication {
header(HttpHeaderAuthentication)
}
}
} else {
println "Property gitlabUrl not set."
}
}
dependencies {
implementation project(':objectbox-java')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation project(':objectbox-kotlin')
implementation "org.greenrobot:essentials:$essentialsVersion"
// Check flag to use locally compiled version to avoid dependency cycles
if (!project.hasProperty('noObjectBoxTestDepencies') || !noObjectBoxTestDepencies) {
println "Using $obxJniLibVersion"
implementation obxJniLibVersion
} else {
println "Did NOT add native dependency"
}
testImplementation "junit:junit:$juniVersion"
// To test Coroutines
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
// To test Kotlin Flow
testImplementation 'app.cash.turbine:turbine:0.5.2'
}
test {
if (System.getenv("TEST_WITH_JAVA_X86") == "true") {
// to run tests with 32-bit ObjectBox
def javaExecutablePath = System.getenv("JAVA_HOME_X86") + "\\bin\\java"
println("Will run tests with $javaExecutablePath")
executable = javaExecutablePath
} else if (System.getenv("TEST_JDK") != null) {
// To run tests on a different JDK, uses Gradle toolchains API (https://docs.gradle.org/current/userguide/toolchains.html)
def sdkVersionInt = System.getenv("TEST_JDK") as Integer
println("Will run tests with JDK $sdkVersionInt")
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(sdkVersionInt))
})
}
// This is pretty useless now because it floods console with warnings about internal Java classes
// However we might check from time to time, also with Java 9.
// jvmArgs '-Xcheck:jni'
filter {
// Note: Tree API currently incubating on Linux only.
if (!System.getProperty("os.name").toLowerCase().contains('linux')) {
excludeTestsMatching "io.objectbox.tree.*"
}
}
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
displayGranularity = 2
events 'started', 'passed'
}
}