From 8546f59b12a58775e6bf7fa1852204cfcfdb9f8e Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 15 Nov 2021 16:22:07 +0100 Subject: [PATCH] Support building and running on Apple M1 Silicon Problem: Prior to this commit, it was not possible to build or run the desktop app on Apple's M1 (macos aarch64) architecture. Solution: This commit makes all the changes necessary to successfully build and run on M1, but some of these changes require depending on snapshots and forks of certain dependencies, so this commit shouldn't be merged to master until those fixes are officially released. The changes made here include: 1. Upgrading from JavaFX 16 to JavaFX 17. JavaFX 17 was the first release to support aarch64 binaries, and so it's required. 2. Upgrading to a version of the openjfx-gradle-plugin that contains the fix at openjfx/javafx-gradle-plugin#113 to download the correct aarch64-classified JavaFX 17 jars. NOTE: at the time of this commit, the fix has not been released, so we are now depending on a locally-built SNAPSHOT resolved from `mavenLocal()`. 3. Upgrading to a version of the JFoenix library that includes a fix for the bug documented at sshahine/JFoenix#1187. At the time of this commit, this fix has only been publihed in the 'rationalityfrontline' fork of JFoenix, and so we've temporarily updated our dependency to point to that artifact. It appears that a new version of JFoenix is being developed that will contain this fix, but it hasn't shipped yet. Notes: - Gradle dependency verification metadata has been updated to reflect the changes mentioned above, but will need further updates to capture the Linux, Windows and MacOS Intel variants of the JavaFX 17 binaries. - Building and testing has been verified to work on JDKs 11 through 17; - Running the desktop app only works on JDKs 11 through 15, however, until sshahine/JFoenix#1205 is fixed. Right now, attempting to run on JDK 16+ will result in a 'Cannot invoke "javafx.scene.Node.getLayoutBounds()" because "this.textNode" is null' error. See the above mentioned issue for details. - It was necessary to bump the minimum supported source compatibility in the Gradle build from Java 10 to Java 11 in order to be able to consume the upgraded JFoenix artifact. --- build.gradle | 10 ++-- gradle/verification-metadata.xml | 98 ++++++++++++-------------------- 2 files changed, 43 insertions(+), 65 deletions(-) diff --git a/build.gradle b/build.gradle index 934e2bfb576..dff43d58ed7 100644 --- a/build.gradle +++ b/build.gradle @@ -3,12 +3,13 @@ buildscript { mavenCentral() maven { url "https://jitpack.io" } maven { url "https://plugins.gradle.org/m2/" } + mavenLocal() } dependencies { classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17' classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0' classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0' - classpath 'org.openjfx:javafx-plugin:0.0.10' + classpath 'org.openjfx:javafx-plugin:0.0.11-SNAPSHOT' classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.5.6' } } @@ -27,7 +28,7 @@ configure(subprojects) { apply plugin: 'java' apply plugin: 'com.google.osdetector' - sourceCompatibility = 1.10 + sourceCompatibility = 1.11 ext { // in alphabetical order bcVersion = '1.63' @@ -50,7 +51,7 @@ configure(subprojects) { httpcoreVersion = '4.4.13' ioVersion = '2.6' jacksonVersion = '2.12.1' - javafxVersion = '16' + javafxVersion = '17.0.1' javaxAnnotationVersion = '1.2' jcsvVersion = '1.4.0' jetbrainsAnnotationsVersion = '13.0' @@ -489,7 +490,8 @@ configure(project(':desktop')) { implementation "com.google.guava:guava:$guavaVersion" implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.googlecode.jcsv:jcsv:$jcsvVersion" - implementation "com.jfoenix:jfoenix:$jfoenixVersion" + //implementation "com.jfoenix:jfoenix:$jfoenixVersion" // until sshahine/JFoenix#1187 + implementation("org.rationalityfrontline.workaround:jfoenix:17.0.1") // is fixed implementation "commons-io:commons-io:$ioVersion" implementation "de.jensd:fontawesomefx-commons:$fontawesomefxCommonsVersion" implementation "de.jensd:fontawesomefx-materialdesignfont:$fontawesomefxMaterialdesignfontVersion" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index d1cef5eae40..2277ede3715 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -964,14 +964,6 @@ - - - - - - - - @@ -2378,74 +2370,50 @@ - - - + + + - - - - - - + + + - - + + - - - - - + + - - - - - - - - - + + + - - + + - - + + - - - + + + - - - - - - - - + + - - - - - - - - - + + + - - + + - - + + @@ -2517,6 +2485,14 @@ + + + + + + + +