Skip to content

Commit

Permalink
Package for Windows (#3)
Browse files Browse the repository at this point in the history
* add dependent DLLs
* Grabs OpenJFX ZIPs from the base directory. Added clean target. Default runs all targets.
* update readme
* update .gitignore for the new build process

Co-authored-by: Sebastian Berlin <sebastian.berlin@wikimedia.se>
  • Loading branch information
Abbe98 and sebastian-berlin-wmse authored Feb 3, 2022
1 parent a364ae6 commit e5a7a00
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 34 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
build
store
dist
nbproject\private
/nbproject/private/
bin
tmp
pattypan.jar
*.zip
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ __[:arrow_down: Download](https://github.com/yarl/pattypan/releases)__
----

### Build and run
[Apache Ant](https://ant.apache.org/) is used for building Pattypan. You need to have JDK 11 or later installed as well as [a download of OpenJFX](https://gluonhq.com/products/javafx/). In order to download and build source code, do the following:
[Apache Ant](https://ant.apache.org/) is used for building Pattypan. You need to have JDK 11 or later installed as well as [a download of OpenJFX](https://gluonhq.com/products/javafx/) for each platform you want to support. In order to download and build source code, do the following:

```
git clone https://github.com/yarl/pattypan.git
cd pattypan
export PATH_TO_FX=path-to-javafx-sdk/lib
ant compile && ant jar
ant
```

This will run the default `build` target. It assumes that the current directory contains the OpenJFX SDK ZIP(s) and will unpack the required files to the correct locations. The resulting JAR will support Linux, Windows or both. The ZIPs present dictates what platforms will be supported. Note that the ZIPs should have their default name to be included.

A temporary directory will be used during the build process and removed afterwards. It's default path is *tmp/* and can be set using `ant -Dtmp=...`

You can also set test server or any other server:

```
Expand Down
114 changes: 87 additions & 27 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,98 @@
<project default="compile" basedir=".">
<project default="build" basedir=".">
<target name="build" depends="prepareJavfx, compile, jar, clean"/>
<property name="lib.dir" location="lib" />
<property environment="env"/>
<property name="openjfxSDKPath" value="${env.PATH_TO_FX}"/>
<property name="tmp" location="tmp" />

<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>

<target name="clean">
<delete dir="bin"/>
<target name="prepareJavfx">
<mkdir dir="${tmp}"/>
<unzip dest="${tmp}">
<fileset dir=".">
<include name="openjfx-*_linux-*_bin-sdk.zip"/>
</fileset>
<patternset>
<include name="**/javafx.base.jar"/>
<include name="**/javafx.graphics.jar"/>
<include name="**/javafx.controls.jar"/>
<include name="**/javafx.web.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<unzip dest="bin">
<fileset dir="${tmp}">
<include name="javafx.base.jar"/>
<include name="javafx.graphics.jar"/>
<include name="javafx.controls.jar"/>
</fileset>
<patternset>
<exclude name="META-INF/MANIFEST.MF"/>
<exclude name="module-info.class"/>
</patternset>
</unzip>
<unzip dest="bin">
<fileset dir=".">
<include name="openjfx-*_linux-*_bin-sdk.zip"/>
</fileset>
<patternset>
<include name="**/libprism*.so"/>
<include name="**/libjavafx*.so"/>
<include name="**/libglass*.so"/>
<include name="**/libdecora_sse.so"/>
</patternset>
<mapper type="flatten"/>
</unzip>

<unzip dest="${tmp}">
<fileset dir=".">
<include name="openjfx-*_windows-*_bin-sdk.zip"/>
</fileset>
<patternset>
<include name="**/javafx.base.jar"/>
<include name="**/javafx.graphics.jar"/>
<include name="**/javafx.controls.jar"/>
<include name="**/javafx.web.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<unzip dest="bin">
<fileset dir="${tmp}">
<include name="javafx.base.jar"/>
<include name="javafx.graphics.jar"/>
<include name="javafx.controls.jar"/>
</fileset>
<patternset>
<exclude name="META-INF/MANIFEST.MF"/>
<exclude name="module-info.class"/>
</patternset>
</unzip>
<unzip dest="bin">
<fileset dir=".">
<include name="openjfx-*_windows-*_bin-sdk.zip"/>
</fileset>
<patternset>
<include name="**/prism*.dll"/>
<include name="**/javafx*.dll"/>
<include name="**/glass.dll"/>
<include name="**/decora_sse.dll"/>
<include name="**/api-ms-win-core-console-l1-1-0.dll"/>
<include name="**/api-ms-win-core-console-l1-2-0.dll"/>
<include name="**/msvcp140.dll"/>
<include name="**/vcruntime140_1.dll"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>

<target name="compile" depends="clean">
<target name="compile">
<mkdir dir="bin"/>
<javac includeantruntime="false" srcdir="src" destdir="bin">
<classpath refid="classpath" />
<compilerarg line="--module-path ${openjfxSDKPath}"/>
<compilerarg line="--module-path ${tmp}"/>
<compilerarg line="--add-modules javafx.web"/>
</javac>
</target>
Expand All @@ -30,26 +105,6 @@
<include name="text/**"/>
</fileset>
</copy>
<unzip dest="bin">
<fileset dir="${openjfxSDKPath}">
<include name="javafx.base.jar"/>
<include name="javafx.graphics.jar"/>
<include name="javafx.controls.jar"/>
<include name="javafx.swing.jar"/>
</fileset>
<patternset>
<exclude name="META-INF/MANIFEST.MF"/>
<exclude name="module-info.class"/>
</patternset>
</unzip>
<copy todir="bin">
<fileset dir="${openjfxSDKPath}">
<include name="libprism*.so"/>
<include name="libjavafx*.so"/>
<include name="libglass*.so"/>
<include name="libdecora_sse.so"/>
</fileset>
</copy>
<jar destfile="pattypan.jar" basedir="bin" includes="**/*">
<manifest>
<attribute name="Class-Path" value="${lib.dir}"/>
Expand All @@ -58,4 +113,9 @@
<zipgroupfileset dir="${lib.dir}"/>
</jar>
</target>

<target name="clean">
<delete dir="${tmp}"/>
<delete dir="bin"/>
</target>
</project>

0 comments on commit e5a7a00

Please sign in to comment.