Skip to content

Commit f050716

Browse files
KTS: convert test-proguard build script
1 parent 1d27774 commit f050716

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

tests/test-proguard/build.gradle.kts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,49 @@
1-
apply plugin: 'java-library'
1+
plugins {
2+
id("java-library")
3+
}
24

3-
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
4-
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
5-
tasks.withType(JavaCompile).configureEach {
5+
tasks.withType<JavaCompile> {
6+
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
7+
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
68
options.release.set(8)
79
}
810

911
repositories {
1012
// Native lib might be deployed only in internal repo
11-
if (project.hasProperty('gitlabUrl')) {
12-
println "gitlabUrl=$gitlabUrl added to repositories."
13+
if (project.hasProperty("gitlabUrl")) {
14+
val gitlabUrl = project.property("gitlabUrl")
15+
println("gitlabUrl=$gitlabUrl added to repositories.")
1316
maven {
14-
url "$gitlabUrl/api/v4/groups/objectbox/-/packages/maven"
15-
name "GitLab"
16-
credentials(HttpHeaderCredentials) {
17-
name = project.hasProperty("gitlabTokenName") ? gitlabTokenName : "Private-Token"
18-
value = gitlabPrivateToken
17+
url = uri("$gitlabUrl/api/v4/groups/objectbox/-/packages/maven")
18+
name = "GitLab"
19+
credentials(HttpHeaderCredentials::class) {
20+
name = project.findProperty("gitlabTokenName")?.toString() ?: "Private-Token"
21+
value = project.property("gitlabPrivateToken").toString()
1922
}
2023
authentication {
21-
header(HttpHeaderAuthentication)
24+
create<HttpHeaderAuthentication>("header")
2225
}
2326
}
2427
} else {
25-
println "Property gitlabUrl not set."
28+
println("Property gitlabUrl not set.")
2629
}
2730
}
2831

32+
val obxJniLibVersion: String by rootProject.extra
33+
34+
val junitVersion: String by rootProject.extra
35+
2936
dependencies {
30-
implementation project(':objectbox-java')
31-
implementation project(':objectbox-java-api')
37+
implementation(project(":objectbox-java"))
3238

3339
// Check flag to use locally compiled version to avoid dependency cycles
34-
if (!project.hasProperty('noObjectBoxTestDepencies') || !noObjectBoxTestDepencies) {
35-
println "Using $obxJniLibVersion"
36-
implementation obxJniLibVersion
40+
if (!project.hasProperty("noObjectBoxTestDepencies")
41+
|| project.property("noObjectBoxTestDepencies") == false) {
42+
println("Using $obxJniLibVersion")
43+
implementation(obxJniLibVersion)
3744
} else {
38-
println "Did NOT add native dependency"
45+
println("Did NOT add native dependency")
3946
}
4047

41-
testImplementation "junit:junit:$junitVersion"
48+
testImplementation("junit:junit:$junitVersion")
4249
}

0 commit comments

Comments
 (0)