Add Apple Silicon build workaround - #131
Conversation
bae00b7 to
83bf98e
Compare
|
But then the resulting jar won't support the Java 9 and 16 features (will miss What if instead you add an option to use Java 11 instead of 9, and Java 17 instead of 16? Maybe those Java version are available for Mac. In principle all you have to do is replacing the 2nd argument to |
|
For debugging I added the following temporary task to which prints Gradle Toolchains look like this: |
|
Something like that, except, you have committed the Java version overrides needed on Mac into The ultimate solution is maybe having something like |
Document a local workaround for building on MacOS Apple Silicon and add a Gradle flag to enable it. README.md shows running ./gradlew -Pfreemarker.skipJavaMRJSourceSets=true jar to avoid MR-JAR toolchain errors when JDK9/16 are unavailable. build.gradle.kts adds the skipJavaMRJSourceSets property, conditionally omits configuring the core9/core16 MR-JAR source sets, and updates the Eclipse classpath assembly to avoid referencing those configurations when skipped. Revert "Add Apple Silicon build workaround" This reverts commit 83bf98e. Make core9/core16 Java versions configurable Introduce freemarker.core9.javaVersion and freemarker.core16.javaVersion properties and read them in build.gradle.kts via providers.gradleProperty(); pass those values to configureSourceSet for core9 and core16. Also bump freemarker.javadoc.javaVersion and freemarker.test.javaVersion to 17. This allows compiling the MR-JAR source sets with independent JDK versions (e.g. Java 11 for core9 and Java 17 for core16) configurable from gradle.properties. add javaVersionUsedFor(ver) helper
12418b5 to
5c36655
Compare
|
@ddekany thanks for the feedback and sorry for the long delay. I added your suggestions. Can override this locally. Some diagnostics you get by appending which prints: |
|
Merged with followup commit (only adjusts the README). |
Add a local-only hack / workaround for building on MacOS Apple Silicon when you don't have a JDK9 and/or JDK16 on your system.
Problem was:
On my Macbook M3 I had trouble building freemarker.
Can't remember exactly but AIs of this world recommended Azul somehow.
I managed to get an old Azul JDK 1.8 and 16, but could not find a Azul JDK 9 (https://www.azul.com/downloads/?package=jdk#zulu) .
So I started commenting out some sections in
build.gradle.kts.In this PR
This basically says the build should use
JDK11instead ofJDK9andJDK17instead ofJDK16.Use this to avoid MR-JAR toolchain errors when JDK9/16 are unavailable.