-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathbuild.gradle.kts
65 lines (56 loc) · 2.06 KB
/
build.gradle.kts
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
plugins {
// Plugin to help us find updated dependencies, not required to use ObjectBox
// https://github.com/ben-manes/gradle-versions-plugin/releases
id("com.github.ben-manes.versions") version "0.51.0"
}
buildscript {
val objectboxVersion by extra("4.2.0")
// For Android projects
val _compileSdkVersion by extra(34) /* Android 14 (UPSIDE_DOWN_CAKE) */
val _targetSdkVersion by extra(33) /* Android 13 (TIRAMISU) */
dependencies {
classpath("com.android.tools.build:gradle:8.1.1") // For Android projects
// Note: when updating make sure to update coroutines dependency to match.
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22") // For Kotlin projects
classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")
}
repositories {
mavenCentral() // ObjectBox artifacts are available on Maven Central.
google() // For Android projects
}
}
allprojects {
repositories {
mavenCentral() // ObjectBox artifacts are available on Maven Central.
google() // For Android projects
}
}
// Helper task for us to quickly compress the example files into a ZIP file.
tasks.register<Zip>("zipAll") {
archiveBaseName.set("objectbox-examples")
from(rootDir) {
exclude("**/.idea/**")
exclude("**/build/**")
exclude(".gradle/**")
exclude("**/*.iml")
exclude("**/*.dll")
exclude("**/*.so")
exclude("**/local.properties")
}
destinationDirectory.set(buildDir)
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
// Reject preview releases for dependencyUpdates task
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}