Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMERO.insight Java Application Bundler task for Mac OS X #3337

Merged
merged 14 commits into from
Jan 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@

//Third-party libraries





import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
//Application-internal dependencies
import org.openmicroscopy.shoola.env.config.AgentInfo;
import org.openmicroscopy.shoola.env.config.Registry;
Expand Down Expand Up @@ -210,18 +216,18 @@ public static void startup(final String home, final String configFile)
private Container(String home, String configFile)
throws StartupException
{
if (configFile == null || configFile.trim().equals(""))
if (StringUtils.isBlank(configFile) ||
!FilenameUtils.isExtension(configFile, "xml"))
configFile = CONFIG_FILE;
this.configFile = configFile;
//Convert to abstract pathname.
//(empty string leads to empty abstract pathname)
File f = new File(home == null ? "" : home);
if (StringUtils.isBlank(FilenameUtils.getPath(home)))
home = System.getProperty("user.dir");
File f = new File(home);

//Now make it absolute. If the original path wasn't absolute, then
//translation is system dependent.
f = f.getAbsoluteFile();
homeDir = f.getAbsolutePath();

//Make sure that what we've got is a directory.
if (!f.exists() || !f.isDirectory())
throw new StartupException("Can't locate home dir: "+homeDir);
Expand Down
205 changes: 173 additions & 32 deletions components/insight/build/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,30 @@
classname="com.exe4j.Exe4JTask"/>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* TASK NAME: appbundler-init
*
* DESCRIPTION:
* Packages a Java application as a Mac app bundle. We are using a fork
* (https://bitbucket.org/infinitekind/appbundler) of the Oracle Java
* Application Bundler (https://java.net/projects/appbundler).
* Documentation on usage can be found here:
* * https://java.net/downloads/appbundler/appbundler.html
* * https://bitbucket.org/infinitekind/appbundler
*
* EXTERNAL DEPENDENCIES: appbundler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="appbundler-init">
<path id="appbundler-init.cp">
<fileset dir="${base.lib.dir}" includes="appbundler*.jar"/>
</path>
<echo message="${appbundler-init.cp}"/>
<taskdef name="appbundler"
classname="com.oracle.appbundler.AppBundlerTask">
<classpath refid="appbundler-init.cp"/>
</taskdef>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Package the whole app into the ${dist.jar.file} under ${dist.dir}.
* The whole content of the ${app.compiled.dir} is jar'ed and a suitable
Expand Down Expand Up @@ -482,6 +506,41 @@
fullpath="${dist.zip.prefix.win64.openGL}/${dist.app.config.dir.name}/imviewer.xml"/>
</zip>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Creates the Mac OS X distribution bundle under ${dist.dir} using the
* Java Application Bundler infrastructure for Java 1.7+.
* This is a zip file whose name is set to
* ${dist.bundle.name}-${dist.bundle.version}-mac.zip
* and whose contents are:
* + A config dir, containing all the app.config files. The dir name is
* set to the name of the ${app.config.dir}.
* + The OMERO.insight application. That is, the .app dir embedding the app
* jar file, all the the app.libs files, and Mac OS X specific config.
* + The install instructions, ${dist.osx.installfile}.
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="dist-osx-appbundler"
depends="jar,appbundler-init"
description="Build and package the app for OS X distribution using the Java Application Bundler.">
<delete dir="${dist.dir}/OMERO.insight_Java7+.app"/>
<appbundler
outputdirectory="${dist.dir}"
name="${distInsight.name}_Java7+"
displayname="${distInsight.name}"
executableName="${distInsight.name}"
identifier="org.openmicroscopy.insight"
shortversion="${dist.bundle.version}"
version="${dist.bundle.version}"
icon="${dist.osx.icon}"
mainclassname="${app.mainclass}">
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Duser.dir=$APP_ROOT/.."/>
<classpath refid="app.libs"/>
<classpath dir="${dist.dir}" includes="${dist.jar.file}"/>
</appbundler>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Creates the Mac OS X distribution bundle under ${dist.dir}.
* This is a zip file whose name is set to
Expand All @@ -495,11 +554,11 @@
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="dist-osx"
depends="jar"
depends="jar,dist-osx-appbundler"
description="Build and package the app for OS X distribution.">
<delete dir="${dist.dir}/OMERO.insight.app"/>
<delete dir="${dist.dir}/OMERO.insight_Java6.app"/>
<jarbundler dir="${dist.dir}"
name="${distInsight.name}"
name="${distInsight.name}_Java6"
mainclass="${app.mainclass}"
version="${dist.bundle.version}"
infostring="${distInsight.name} Java Client, ${dist.bundle.version}"
Expand All @@ -518,12 +577,16 @@
<zipfileset prefix="${dist.zip.prefix.osx}/${dist.app.config.dir.name}"
dir="${app.config.dir}"/>
<zipfileset prefix="${dist.zip.prefix.osx}" dir="${dist.dir}"
includes="OMERO.insight.app/**"
excludes="**/${dist.osx.stub.name}"/>
includes="OMERO.insight*.app/**"
excludes="**/${dist.osx.stub.name},**/${distInsight.name}"/>
<zipfileset file="${dist.osx.stub}"
fullpath="${dist.zip.prefix.osx}/OMERO.insight.app/Contents/MacOS/${dist.osx.stub.name}"
fullpath="${dist.zip.prefix.osx}/OMERO.insight_Java6.app/Contents/MacOS/${dist.osx.stub.name}"
filemode="775"/>
<zipfileset file="${dist.dir}/OMERO.insight_Java7+.app/Contents/MacOS/${distInsight.name}"
fullpath="${dist.zip.prefix.osx}/OMERO.insight_Java7+.app/Contents/MacOS/${distInsight.name}"
filemode="775"/>
<zipfileset prefix="${dist.zip.prefix.osx}" file="${dist.osx.installfile}"/>
<zipfileset prefix="${dist.zip.prefix.osx}"
file="${dist.osx.installfile}"/>
<zipfileset file="${base.licensefile}"
fullpath="${dist.zip.prefix.osx}/LICENSE"/>
</zip>
Expand All @@ -532,9 +595,9 @@
<target name="dist-osx-openGL"
depends="jar"
description="Build and package the app for OS X distribution with OpenGL support.">
<delete dir="${dist.dir}/OMERO.insight.app"/>
<delete dir="${dist.dir}/OMERO.insight_Java6.app"/>
<jarbundler dir="${dist.dir}"
name="${distInsight.name}"
name="${distInsight.name}_Java6"
mainclass="${app.mainclass}"
version="${dist.bundle.version}"
infostring="${distInsight.name} Java Client, ${dist.bundle.version}"
Expand Down Expand Up @@ -623,10 +686,11 @@
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="distEditor-osx"
depends="jar"
depends="jar,distEditor-osx-appbundler"
description="Build and package the app for OS X distribution.">
<delete dir="${dist.dir}/OMERO.editor_Java6.app"/>
<jarbundler dir="${dist.dir}"
name="${distEditor.name}"
name="${distEditor.name}_Java6"
mainclass="${app.mainclass}"
version="${dist.bundle.version}"
infostring="${distEditor.name} Java Client, ${dist.bundle.version}"
Expand All @@ -646,18 +710,56 @@
<zipfileset prefix="${dist.zip.prefix.editor.osx}/${dist.app.config.dir.name}"
dir="${app.config.dir}"/>
<zipfileset prefix="${dist.zip.prefix.editor.osx}" dir="${dist.dir}"
includes="OMERO.editor.app/**"
excludes="**/${dist.osx.stub.name}"/>
includes="OMERO.editor*.app/**"
excludes="**/${dist.osx.stub.name},**/${distEditor.name}"/>
<zipfileset file="${dist.osx.stub}"
fullpath="${dist.zip.prefix.editor.osx}/OMERO.editor.app/Contents/MacOS/${dist.osx.stub.name}"
fullpath="${dist.zip.prefix.editor.osx}/OMERO.editor_Java6.app/Contents/MacOS/${dist.osx.stub.name}"
filemode="775"/>
<zipfileset file="${dist.dir}/OMERO.editor_Java7+.app/Contents/MacOS/${distEditor.name}"
fullpath="${dist.zip.prefix.editor.osx}/OMERO.editor_Java7+.app/Contents/MacOS/${distEditor.name}"
filemode="775"/>
<zipfileset prefix="${dist.zip.prefix.editor.osx}"
file="${dist.osx.installfile}"/>
<zipfileset file="${base.licensefile}"
fullpath="${dist.zip.prefix.editor.osx}/LICENSE"/>
</zip>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Creates the Mac OS X distribution bundle under ${dist.dir} using the
* Java Application Bundler infrastructure for Java 1.7+.
* This is a zip file whose name is set to
* ${dist.bundle.name}-${dist.bundle.version}-mac.zip
* and whose contents are:
* + A config dir, containing all the app.config files. The dir name is
* set to the name of the ${app.config.dir}.
* + The OMERO.insight application. That is, the .app dir embedding the app
* jar file, all the the app.libs files, and Mac OS X specific config.
* + The install instructions, ${dist.osx.installfile}.
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="distEditor-osx-appbundler"
depends="jar,appbundler-init"
description="Build and package the app for OS X distribution using the Java Application Bundler.">
<delete dir="${dist.dir}/OMERO.editor_Java7+.app"/>
<appbundler
outputdirectory="${dist.dir}"
name="${distEditor.name}_Java7+"
displayname="${distEditor.name}"
executableName="${distEditor.name}"
identifier="org.openmicroscopy.editor"
shortversion="${dist.bundle.version}"
version="${dist.bundle.version}"
icon="${distEditor.osx.icon}"
mainclassname="${app.mainclass}">
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Duser.dir=$APP_ROOT/.."/>
<classpath refid="app.libs"/>
<classpath dir="${dist.dir}" includes="${dist.jar.file}"/>
<argument value="containerEditor.xml"/>
</appbundler>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Creates the Windows distribution bundle under ${dist.dir}.
* This is a zip file whose name is set to
Expand Down Expand Up @@ -704,10 +806,11 @@
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="distImporter-osx"
depends="jar"
depends="jar,distImporter-osx-appbundler"
description="Build and package the app for OS X distribution.">
<delete dir="${dist.dir}/OMERO.importer_Java6.app"/>
<jarbundler dir="${dist.dir}"
name="${distImporter.name}"
name="${distImporter.name}_Java6"
mainclass="${app.mainclass}"
version="${dist.bundle.version}"
infostring="${distImporter.name} Java Client, ${dist.bundle.version}"
Expand All @@ -717,28 +820,65 @@
stubfile="${dist.osx.stub}"
jvmversion="1.6+"
vmoptions="${dist.vmparameters}"
arguments="containerImporter.xml">
arguments="containerImporter.xml">
<jarfileset refid="app.libs"/>
<jarfileset dir="${dist.dir}" includes="${dist.jar.file}"/>
</jarbundler>
<property name="dist.zip.prefix.importer.osx"
value="${distImporter.bundle.name}-${dist.bundle.version}-mac"/>
<zip destfile="${dist.dir}/${dist.zip.prefix.importer.osx}.zip">
<zipfileset prefix="${dist.zip.prefix.importer.osx}/${dist.app.config.dir.name}"
dir="${app.config.dir}"/>
<zipfileset prefix="${dist.zip.prefix.importer.osx}" dir="${dist.dir}"
includes="OMERO.importer.app/**"
excludes="**/${dist.osx.stub.name}"/>
<zipfileset file="${dist.osx.stub}"
fullpath="${dist.zip.prefix.importer.osx}/OMERO.importer.app/Contents/MacOS/${dist.osx.stub.name}"
filemode="775"/>
<zipfileset prefix="${dist.zip.prefix.importer.osx}"
file="${dist.osx.installfile}"/>
<zipfileset file="${base.licensefile}"
fullpath="${dist.zip.prefix.importer.osx}/LICENSE"/>
</zip>
</target>
<zip destfile="${dist.dir}/${dist.zip.prefix.importer.osx}.zip">
<zipfileset prefix="${dist.zip.prefix.importer.osx}/${dist.app.config.dir.name}"
dir="${app.config.dir}"/>
<zipfileset prefix="${dist.zip.prefix.importer.osx}" dir="${dist.dir}"
includes="OMERO.importer*.app/**"
excludes="**/${dist.osx.stub.name},**/${distImporter.name}"/>
<zipfileset file="${dist.osx.stub}"
fullpath="${dist.zip.prefix.importer.osx}/OMERO.importer_Java6.app/Contents/MacOS/${dist.osx.stub.name}"
filemode="775"/>
<zipfileset file="${dist.dir}/OMERO.importer_Java7+.app/Contents/MacOS/${distImporter.name}"
fullpath="${dist.zip.prefix.importer.osx}/OMERO.importer_Java7+.app/Contents/MacOS/${distImporter.name}"
filemode="775"/>
<zipfileset prefix="${dist.zip.prefix.importer.osx}"
file="${dist.osx.installfile}"/>
<zipfileset file="${base.licensefile}"
fullpath="${dist.zip.prefix.importer.osx}/LICENSE"/>
</zip>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Creates the Mac OS X distribution bundle under ${dist.dir} using the
* Java Application Bundler infrastructure for Java 1.7+.
* This is a zip file whose name is set to
* ${dist.bundle.name}-${dist.bundle.version}-mac.zip
* and whose contents are:
* + A config dir, containing all the app.config files. The dir name is
* set to the name of the ${app.config.dir}.
* + The OMERO.insight application. That is, the .app dir embedding the app
* jar file, all the the app.libs files, and Mac OS X specific config.
* + The install instructions, ${dist.osx.installfile}.
* + The license file, ${base.licensefile}.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<target name="distImporter-osx-appbundler"
depends="jar,appbundler-init"
description="Build and package the app for OS X distribution using the Java Application Bundler.">
<delete dir="${dist.dir}/OMERO.importer+.app"/>
<appbundler
outputdirectory="${dist.dir}"
name="${distImporter.name}_Java7+"
displayname="${distImporter.name}"
executableName="${distImporter.name}"
identifier="org.openmicroscopy.importer"
shortversion="${dist.bundle.version}"
version="${dist.bundle.version}"
icon="${distImporter.osx.icon}"
mainclassname="${app.mainclass}">
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Duser.dir=$APP_ROOT/.."/>
<classpath refid="app.libs"/>
<classpath dir="${dist.dir}" includes="${dist.jar.file}"/>
<argument value="containerImporter.xml"/>
</appbundler>
</target>

<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Remove all output generated by the targets within this file.
Expand All @@ -764,6 +904,7 @@ Distribution targets:
---------------------
dist: Creates the distribution bundle under ${dist.dir}.
dist-osx: Creates the Mac OS X distribution bundle under ${dist.dir}.
dist-osx-appbundler: Creates the Mac OS X distribution bundle under ${dist.dir} using the Java Application Bundler infrastructure for Java 1.7+.
dist-win: Creates the Windows distribution bundle under ${dist.dir}.
dist-osx-openGL: Creates the Mac OS X distribution bundle under ${dist.dir} with OpenGL support.
dist-win-openGL: Creates the Windows distribution bundle under ${dist.dir} with OpenGL support.
Expand Down
1 change: 1 addition & 0 deletions components/insight/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<exclude ext="pom"/>
</dependency>
<!-- For build -->
<dependency org="ome" name="appbundler" rev="${versions.appbundler}" conf="build->default"/>
<dependency org="insight" name="jarbundler" rev="${versions.jarbundler}" conf="build->default"/>
<!-- From classpath -->
<dependency org="insight" name="ai_path" rev="${versions.ai_path}"/>
Expand Down
1 change: 1 addition & 0 deletions etc/omero.properties
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ versions.apacheds=1.5.6
versions.activation=1.1.1
versions.ant=1.8.0
versions.antlr=2.7.6
versions.appbundler=1.0.0
versions.asm=1.5.3
versions.axis=1.4
versions.backport=3.1
Expand Down
7 changes: 7 additions & 0 deletions lib/licenses/README
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@
License File: apache-v2.0.txt


Artifacts: appbundler-*.jar
Project: Packages a Java application as a Mac app bundle.
Web Site: https://java.net/projects/appbundler
License: General Public License (GPL), Version 2
License File: gpl.txt


Artifacts: axis-client-*.jar
Project: Apache Axis is an implementation of the SOAP
("Simple Object Access Protocol") submission to W3C.
Expand Down