Skip to content

Commit

Permalink
Initial migration to Java 11 on Mac as POC.
Browse files Browse the repository at this point in the history
Focusing first on getting "hello world" applications running under Java 11, this initial migration works for Mac OS X (10.14.1). There are a number of issues and warnings still to address so the overall PR remains WIP. Specific modifications to address processing#5750:

 - Modification in build system to address a unified JDK / JRE.
 - Modification in build system and application code to deal with version naming convention migration.
 - Modification of OS X specific system paths changed by Java 11.
 - Migration to OpenJDK (processing#4415) via AdoptOpenJDK (selected due to long term build support and some vendor independence).
 - Migration to OpenJFX (processing#5286).
 - Removal of deprecated `java.ext.dirs` (replacement funcationality is still being explored).
 - Update to the appbundler fork.
 - Update to the JDT jars.

Documentation is still incomplete as is reaching feature parity on mac as well as testing on other OS'. Please don't merge yet.
  • Loading branch information
sampottinger committed Jan 12, 2019
1 parent 3dd945f commit 3cc210f
Show file tree
Hide file tree
Showing 49 changed files with 3,345 additions and 859 deletions.
25 changes: 11 additions & 14 deletions app/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<fail unless="core-built" message="Please build the core library first and make sure it is located at ../core/library/core.jar" />

<mkdir dir="bin" />

<!-- copy languages files -->
<copy todir="bin">
<fileset dir="src">
<include name="processing/app/languages/*.properties" />
</fileset>
</copy>

<!-- in some cases, pde.jar was not getting built
https://github.com/processing/processing/issues/1792 -->
<delete file="pde.jar" />
Expand All @@ -30,22 +30,19 @@

<javac source="1.8"
target="1.8"
destdir="bin"
excludes="**/tools/format/**"
encoding="UTF-8"
includeAntRuntime="false"
classpath="../core/library/core.jar;
../core/apple.jar;
lib/ant.jar;
lib/ant-launcher.jar;
destdir="bin"
excludes="**/tools/format/**"
encoding="UTF-8"
includeAntRuntime="false"
classpath="../core/library/core.jar;
../core/apple.jar;
lib/ant.jar;
lib/ant-launcher.jar;
lib/jna.jar;
lib/jna-platform.jar"
debug="on"
nowarn="true"
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
nowarn="true">
<src path="src" />
<compilerclasspath path="../java/mode/org.eclipse.jdt.core.jar;
../java/mode/jdtCompilerAdapter.jar" />
</javac>
</target>

Expand Down
4 changes: 2 additions & 2 deletions app/src/processing/app/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public boolean accept(File dir, String name) {
name.endsWith(".jdk") && !name.startsWith(".");
}
});
return new File(plugins[0], "Contents/Home/jre");
return new File(plugins[0], "Contents/Home");
}
// On all other platforms, it's the 'java' folder adjacent to Processing
return getContentFile("java");
Expand Down Expand Up @@ -412,4 +412,4 @@ static public int unsetenv(String variable) {
static public int getSystemDPI() {
return inst.getSystemDPI();
}
}
}
31 changes: 18 additions & 13 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
</target>

<!-- Require Java 8 everywhere. -->
<fail message="Unsupported Java version: ${java.version}. To build, make sure that Java 8 (aka Java 1.8) is installed.">
<fail message="Unsupported Java version: ${java.version}. To build, make sure that Java 11 is installed.">
<condition>
<not>
<or>
<contains string="${java.version}" substring="1.8" />
<contains string="${java.version}" substring="11." />
</or>
</not>
</condition>
Expand All @@ -70,15 +70,20 @@
<property name="examples.dir"
value="../../processing-docs/content/examples" />

<property name="jdk.version" value="8" />
<property name="jdk.update" value="192" />
<property name="jdk.train" value="11" />
<property name="jdk.version" value="0" />
<property name="jdk.update" value="1" />
<property name="jdk.build" value="12" />
<!-- See https://gist.github.com/P7h/9741922
or http://stackoverflow.com/q/10268583 -->
<property name="jdk.hash" value="750e1c8617c5452694857ad95c3ee230" />

<property name="jdk.short" value="${jdk.version}u${jdk.update}" />
<property name="jdk.esoteric" value="1.${jdk.version}.0_${jdk.update}" />

<property name="jdk.prefix" value="adoptopenjdk" />
<property name="jdk.separator" value="-" />
<property name="jdk.esoteric" value="${jdk.train}.${jdk.version}.${jdk.update}" />


<!-- Figure out the JRE download location for Linux and Windows. -->
<!--
Expand Down Expand Up @@ -266,7 +271,7 @@

<!-- Set the version of Java that must be present to build. -->
<property name="jdk.path.macosx"
value="/Library/Java/JavaVirtualMachines/jdk${jdk.esoteric}.jdk" />
value="/Library/Java/JavaVirtualMachines/${jdk.prefix}${jdk.separator}${jdk.esoteric}.jdk" />

<available file="${jdk.path.macosx}" property="macosx_jdk_found" />

Expand Down Expand Up @@ -532,11 +537,8 @@
signature="Pde3"
icon="macosx/processing.icns"
copyright="© The Processing Foundation"
getInfo="${version}, Copyright © The Processing Foundation"
shortVersion="${version}"
version="${revision}"
javafx="true"
minimumSystem="10.8.5"
mainClassName="processing.app.BaseSplash">

<!-- The appbundler task needs a couple files (the Info.plist and
Expand Down Expand Up @@ -592,7 +594,7 @@
<option value="-Djna.nosys=true" />

<!-- deal with jokers who install JOGL, ANTLR, etc system-wide -->
<option value="-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/lib/ext" />
<!--<option value="-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/adoptopenjdk-11.0.1.jdk/Contents/Home/lib/ext" />-->

<option value="-Dapple.laf.useScreenMenuBar=true" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true" />
Expand Down Expand Up @@ -620,6 +622,8 @@
-->
</bundleapp>

<mkdir dir="macosx/work/Processing.app/Contents/Java/Classes" />

<!-- Temporary fix until new appbundler is included again after solving
https://github.com/processing/processing/issues/3359
https://github.com/processing/processing/issues/3360
Expand All @@ -629,18 +633,19 @@
Also, because Ant's copy task does not retain file permissions on
Unix systems, we need to use <exec executable="cp" ... > instead -->
<exec executable="cp">
<arg line="${jdk.path.macosx}/Contents/Home/bin/keytool macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/bin"/>
<arg value="-r"/>
<arg line="${jdk.path.macosx}/Contents/Home/bin macosx/work/Processing.app/Contents/PlugIns/adoptopenjdk-11.0.1.jdk/Contents/Home/bin"/>
</exec>

<property name="contents.dir"
location="macosx/work/Processing.app/Contents" />

<!-- Replace libjli.dylib symlink with actual file.
Deals with code signing issues on OS X 10.9.5+ -->
<property name="jli.path" value="${contents.dir}/PlugIns/jdk${jdk.esoteric}.jdk/Contents/MacOS/libjli.dylib" />
<property name="jli.path" value="${contents.dir}/PlugIns/adoptopenjdk-11.0.1.jdk/Contents/MacOS/libjli.dylib" />
<delete file="${jli.path}" />
<exec executable="cp">
<arg line="${jdk.path.macosx}/Contents/Home/jre/lib/jli/libjli.dylib ${jli.path}"/>
<arg line="${jdk.path.macosx}/Contents/Home/lib/jli/libjli.dylib ${jli.path}"/>
</exec>

<copy todir="${contents.dir}/Java">
Expand Down
30 changes: 9 additions & 21 deletions build/jre/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,31 @@

<!-- Where can I expect to find Java Mode JARs? -->
<property name="java.mode" value="../../java/mode/" />

<!-- Check for JDT compiler, since this is likely a PDE build. Using
it allows us to build the PDE with only a JRE on Windows and Linux.
So that the core can be built independently of the PDE,
use javac (the "modern" compiler) if ecj is not present. -->
<property name="jdt.jar" value="${java.mode}/org.eclipse.jdt.core.jar" />
<condition property="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"
else="modern">
<available file="${jdt.jar}" />
</condition>
<!--<echo message="compiler is ${build.compiler}" />-->

<javac source="1.8"
target="1.8"
srcdir="src"
destdir="bin"
debug="true"
target="1.8"
srcdir="src"
destdir="bin"
debug="true"
includeantruntime="true"
nowarn="true">
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
<compilerclasspath path="${jdt.jar}; ${java.mode}/jdtCompilerAdapter.jar" />
</javac>
</target>

<target name="dist" depends="compile">
<jar basedir="bin" destfile="downloader.jar" />
</target>

<target name="demo" depends="dist">
<taskdef name="downloader"
<taskdef name="downloader"
classname="Downloader"
classpath="downloader.jar" />
<downloader version="8" update="31" build="13"
<downloader version="8" update="31" build="13"
jdk="true" flavor="macosx-x64.dmg" />
</target>

<target name="clean">
<delete dir="bin" />
<delete file="downloader.jar" />
Expand Down
Binary file modified build/macosx/appbundler.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions build/macosx/appbundler/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ questions.
</copy>

<exec executable="${cc}">
<arg line="${arch64} ${arch32}"/>
<arg line="${arch64}"/> <!-- ${arch32} not supported -->
<arg value="-I"/>
<arg value="${env.JAVA_HOME}/include"/>
<arg value="-I"/>
Expand All @@ -87,10 +87,10 @@ questions.
<arg value="-isysroot"/>
<!--
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"/>
<arg value="-mmacosx-version-min=10.7"/>
<arg value="-mmacosx-version-min=10.7"/>
-->
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"/>
<arg value="-mmacosx-version-min=10.8"/>
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"/>
<arg value="-mmacosx-version-min=10.8"/>
<arg value="native/main.m"/>
</exec>
</target>
Expand Down

0 comments on commit 3cc210f

Please sign in to comment.