Skip to content

Commit

Permalink
Support building SDK with JVM 11 (#7535)
Browse files Browse the repository at this point in the history
* Building the SDK now requires JDK 11.
* Updated to Gradle 7.2.
* Updated to Android Gradle Plugin 7.1.0-beta03.
* Updated to Kotlin 1.5.31.
* Updated to Kotlin Coroutines 1.5.2.
* Updated to CMake 3.21.4.
* Updated to NDK 23.1.7779620.
  • Loading branch information
rorbech authored Nov 16, 2021
1 parent e48b77a commit 0c37e9a
Show file tree
Hide file tree
Showing 70 changed files with 1,995 additions and 1,592 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Enhancements
* [RealmApp] Reduced native memory usage when working with synchronized Realms.
* [RealmApp] Make it possible to bundle synchronized Realms in apps using `Realm.writeCopyTo()` and `SyncConfiguration.Builder.assetFile()`.
* The Realm Transformer and Realm Gradle Plugin now supports the Gradle Configuration Cache. (Issue [#7299](https://github.com/realm/realm-java/issues/7299))

### Fixed
* [RealmApp] Bug where progress notifiers continue to be called after the download of a synced realm is complete. (Issue [Realm Core #4919](https://github.com/realm/realm-core/issues/4919))
Expand All @@ -18,6 +19,13 @@

### Internal
* Updated to Realm Core 11.6.0, commit: b170db6a47789ff5f2fbc3eeed0220b4b0a3f6b7.
* Building the SDK now requires JDK 11.
* Updated to Gradle 7.2.
* Updated to Android Gradle Plugin 7.1.0-beta03.
* Updated to Kotlin 1.5.31.
* Updated to Kotlin Coroutines 1.5.2.
* Updated to CMake 3.21.4.
* Updated to NDK 23.1.7779620.
* Disable analytics for any value of the `REALM_DISABLE_ANALYTICS` environment variable, not just `true`.
* Disable analytics whenever the `CI` environment variable is set.

Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ENV TZ=Europe/Copenhagen
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Set the environment variables
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV JAVA8_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV ANDROID_HOME /opt/android-sdk-linux
# Need by cmake
ENV ANDROID_NDK_HOME /opt/android-ndk
Expand All @@ -18,6 +19,7 @@ ENV PATH ${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/cmdline-tools/latest:$
ENV PATH ${PATH}:${NDK_HOME}
ENV NDK_CCACHE /usr/bin/ccache
ENV CCACHE_CPP2 yes
ENV REALM_DISABLE_ANALYTICS true

# Keep the packages in alphabetical order to make it easy to avoid duplication
# tzdata needs to be installed first. See https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai
Expand All @@ -41,6 +43,7 @@ RUN DEBIAN_FRONTEND=noninteractive \
libz1 \
libvirt-clients \
libvirt-daemon-system \
openjdk-11-jdk-headless \
openjdk-8-jdk-headless \
qemu-kvm \
s3cmd \
Expand Down Expand Up @@ -77,15 +80,18 @@ RUN yes | sdkmanager \
'extras;android;m2repository' \
'platforms;android-30' \
'platform-tools' \
'ndk;22.0.7026061' \
'ndk;23.1.7779620' \
'system-images;android-29;default;x86'

# Make the SDK universally writable
RUN chmod -R a+rwX ${ANDROID_HOME}

# Ensure a new enough version of CMake is available.
RUN cd /opt \
&& wget -nv https://cmake.org/files/v3.18/cmake-3.18.4-Linux-x86_64.tar.gz \
&& tar zxf cmake-3.18.4-Linux-x86_64.tar.gz
&& wget -nv https://cmake.org/files/v3.21/cmake-3.21.4-linux-x86_64.tar.gz \
&& tar zxf cmake-3.21.4-linux-x86_64.tar.gz

ENV PATH "/opt/cmake-3.18.4-Linux-x86_64/bin:$PATH"
# Workaround for https://issuetracker.google.com/issues/206099937
RUN ln -s /usr/bin/ninja /opt/cmake-3.21.4-linux-x86_64/bin/ninja

ENV PATH "/opt/cmake-3.21.4-linux-x86_64/bin:$PATH"
23 changes: 9 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,7 @@ def runBuild(buildFlags, instrumentationTestTarget) {
if (isReleaseBranch) {
signingFlags = "-PsignBuild=true -PsignSecretRingFile=\"${SIGN_KEY}\" -PsignPassword=${SIGN_KEY_PASSWORD}"
}
// Work around https://github.com/realm/realm-java/issues/7476 by building each artifact independantly instead
// of using Gradle to call down into sub projects (which seems to trigger a bug somewhere).
sh """
cd realm-annotations
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
cd ../realm-transformer
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
cd ../library-build-transformer
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
cd ../gradle-plugin
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
cd ../realm
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
"""
sh "./gradlew assemble ${buildFlags} ${signingFlags} --stacktrace"
}
}

Expand All @@ -264,6 +251,14 @@ def runBuild(buildFlags, instrumentationTestTarget) {
step([$class: 'LintPublisher'])
}
},
// FIXME https://github.com/realm/realm-java/issues/7593
// 'JVM8 introExample check' : {
// // Force build with JVM8, by disabling the cache, and check introExample.
// sh """
// cd examples/moduleExample
// JAVA_HOME=\$JAVA8_HOME ../gradlew check ${buildFlags} --stacktrace
// """
// },
'Realm Transformer' : {
try {
gradle('realm-transformer', 'check')
Expand Down
14 changes: 7 additions & 7 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Realm Core release used by Realm Java
# https://github.com/realm/realm-core/releases
REALM_CORE=10.3.3
REALM_CORE=11.6.0

# Version of MongoDB Realm used by integration tests
# See https://github.com/realm/ci/packages/147854 for available versions
MONGODB_REALM_SERVER=2021-04-22

# Common Android settings across projects
GRADLE_BUILD_TOOLS=4.0.0
GRADLE_BUILD_TOOLS=7.1.0-beta03
ANDROID_BUILD_TOOLS=30.0.3
KOTLIN=1.3.72
KOTLIN_COROUTINES=1.3.9
KOTLIN=1.5.31
KOTLIN_COROUTINES=1.5.2

# Common classpath dependencies
gradle=6.8.3
ndkVersion=22.0.7026061
gradle=7.2
ndkVersion=23.1.7779620
BUILD_INFO_EXTRACTOR_GRADLE=4.17.0
GRADLE_NEXUS_PLUGIN=1.0.0
CMAKE=3.18.4
CMAKE=3.21.4

# Bson dependency version
BSON_DEPENDENCY=3.12.1
Expand Down
4 changes: 2 additions & 2 deletions examples/compatibilityExample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {

// Ensure that we can compile an app without Java 8 features
compileOptions {
sourceCompatibility 1.7
targetCompatibility 1.7
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

Expand Down
Binary file modified examples/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0c37e9a

Please sign in to comment.