Skip to content

Commit cf8aa6d

Browse files
Gradle: use release flag instead of sourceCompatibility and targetCompatibility.
Fixes FlatBufferBuilder using ByteBuffer instead of Buffer API.
1 parent 1d1950e commit cf8aa6d

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

objectbox-java-api/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
apply plugin: 'java-library'
22

3-
sourceCompatibility = JavaVersion.VERSION_1_8
4-
targetCompatibility = JavaVersion.VERSION_1_8
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+
compileJava {
6+
options.release.set(8)
7+
}
58

69
task javadocJar(type: Jar, dependsOn: javadoc) {
710
archiveClassifier.set('javadoc')

objectbox-java/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
apply plugin: 'java-library'
22
apply plugin: "com.github.spotbugs"
33

4-
sourceCompatibility = JavaVersion.VERSION_1_8
5-
targetCompatibility = JavaVersion.VERSION_1_8
4+
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
5+
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
6+
compileJava {
7+
options.release.set(8)
8+
}
69

710
ext {
811
javadocForWebDir = "$buildDir/docs/web-api-docs"

objectbox-kotlin/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ buildscript {
55
apply plugin: 'kotlin'
66
apply plugin: 'org.jetbrains.dokka'
77

8-
sourceCompatibility = JavaVersion.VERSION_1_8
9-
targetCompatibility = JavaVersion.VERSION_1_8
8+
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
9+
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
10+
compileJava {
11+
options.release.set(8)
12+
}
1013

1114
// Produce Java 8 byte code, would default to Java 6.
1215
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

objectbox-rxjava/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
apply plugin: 'java-library'
22

3-
sourceCompatibility = JavaVersion.VERSION_1_8
4-
targetCompatibility = JavaVersion.VERSION_1_8
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+
compileJava {
6+
options.release.set(8)
7+
}
58

69
dependencies {
710
api project(':objectbox-java')

objectbox-rxjava3/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ apply plugin: 'java-library'
66
apply plugin: 'kotlin'
77
apply plugin: 'org.jetbrains.dokka'
88

9-
sourceCompatibility = JavaVersion.VERSION_1_8
10-
targetCompatibility = JavaVersion.VERSION_1_8
9+
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
10+
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
11+
compileJava {
12+
options.release.set(8)
13+
}
1114

1215
// Produce Java 8 byte code, would default to Java 6.
1316
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

tests/objectbox-java-test/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ apply plugin: 'kotlin'
33

44
uploadArchives.enabled = false
55

6-
sourceCompatibility = JavaVersion.VERSION_1_8
7-
targetCompatibility = JavaVersion.VERSION_1_8
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
8+
compileJava {
9+
options.release.set(8)
10+
}
811

912
// Produce Java 8 byte code, would default to Java 6.
1013
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {

tests/test-proguard/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ apply plugin: 'java-library'
22

33
uploadArchives.enabled = false
44

5-
sourceCompatibility = JavaVersion.VERSION_1_8
6-
targetCompatibility = JavaVersion.VERSION_1_8
5+
// Note: use release flag instead of sourceCompatibility and targetCompatibility to ensure only JDK 8 API is used.
6+
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
7+
compileJava {
8+
options.release.set(8)
9+
}
710

811
repositories {
912
// Native lib might be deployed only in internal repo

0 commit comments

Comments
 (0)