|
1 | | -apply plugin: 'java-library' |
| 1 | +plugins { |
| 2 | + id("java-library") |
| 3 | +} |
2 | 4 |
|
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 |
6 | 8 | options.release.set(8) |
7 | 9 | } |
8 | 10 |
|
9 | 11 | repositories { |
10 | 12 | // 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.") |
13 | 16 | 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() |
19 | 22 | } |
20 | 23 | authentication { |
21 | | - header(HttpHeaderAuthentication) |
| 24 | + create<HttpHeaderAuthentication>("header") |
22 | 25 | } |
23 | 26 | } |
24 | 27 | } else { |
25 | | - println "Property gitlabUrl not set." |
| 28 | + println("Property gitlabUrl not set.") |
26 | 29 | } |
27 | 30 | } |
28 | 31 |
|
| 32 | +val obxJniLibVersion: String by rootProject.extra |
| 33 | + |
| 34 | +val junitVersion: String by rootProject.extra |
| 35 | + |
29 | 36 | dependencies { |
30 | | - implementation project(':objectbox-java') |
31 | | - implementation project(':objectbox-java-api') |
| 37 | + implementation(project(":objectbox-java")) |
32 | 38 |
|
33 | 39 | // 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) |
37 | 44 | } else { |
38 | | - println "Did NOT add native dependency" |
| 45 | + println("Did NOT add native dependency") |
39 | 46 | } |
40 | 47 |
|
41 | | - testImplementation "junit:junit:$junitVersion" |
| 48 | + testImplementation("junit:junit:$junitVersion") |
42 | 49 | } |
0 commit comments