Question

I have built an Eclipse RCP application (Indigo) with Tycho. The build is run on a Win 7, 64-bit machine.

The parent POM includes:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>target-platform-configuration</artifactId>
  <version>${tycho-version}</version>
  <configuration>
  <resolver>p2</resolver>

  <environment>
    <os>linux</os>
    <ws>gtk</ws>
    <arch>x86_64</arch>
  </environment>
  <environment>
    <os>win32</os>
    <ws>win32</ws>
    <arch>x86_64</arch>
  </environment>
  <environment>
    <os>macosx</os>
    <ws>cocoa</ws>
    <arch>x86_64</arch>
  </environment>

...

The product configuration looks like this (with a few omissions and extra line breaks for readbility):

<product name="My App" uid="myapp.product" id="myapp.core.product" application="myapp.core.application" version="0.1.4.qualifier" useFeatures="true" includeLaunchers="true">

   <configIni use="default">
   </configIni>

   <launcherArgs>
      <programArgs>-data @noDefault</programArgs>
      <vmArgsMac>-XstartOnFirstThread
                         -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
   </launcherArgs>

   <launcher name="myapp_0_1_4">
      <solaris/>
      <win useIco="false">
         <bmp/>
      </win>
   </launcher>

   <vm>
      <macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</macos>
   </vm>

   <plugins>
      <plugin id="com.ibm.icu"/>
      <plugin id="myapp.core"/>
      <plugin id="org.eclipse.core.runtime"/>
      <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/>
      <plugin id="org.eclipse.equinox.app"/>
      <plugin id="org.eclipse.equinox.common"/>
      <plugin id="org.eclipse.osgi"/>
      <plugin id="org.eclipse.swt"/>
      <plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/>
      <plugin id="org.eclipse.ui"/>
      <plugin id="org.eclipse.ui.workbench"/>
   </plugins>

   <features>
      <feature id="org.eclipse.rcp" version="3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/>
      <feature id="myapp.platform_dependencies.feature" version="0.1.4.qualifier"/>
      <feature id="myapp.core.feature" version="0.1.4.qualifier"/>
      <feature id="myapp.ui.feature" version="0.1.4.qualifier"/>
      <feature id="myapp.model.feature" version="0.1.4.qualifier"/>
   </features>

   <configurations>
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
   </configurations>

</product>

The build runs without problems, and generates zip files, which, unpacked on the target OSs Windows & Linux include working launchers. (On Linux, I have to make the launcher executable before being able to run it.)

On Mac OS X (10.6.8), however, the launcher (myapp.app) does nothing...

When I run java -jar -XstartOnFirstThread plugins/org.eclipse.equinox.launcher_[version], the application is launched, albeit without the splash screen.

I imagine I have a wrong setting anywhere in my Product Configuration, but I cannot mind which.

Was it helpful?

Solution

Cross-platform build on Windows for Mac is not expected to work. The reason is that Tycho/p2 would need to simulate a file system with Unix permissions. There is a request for this in Tycho's issue tracker, but IMHO implementing this is not worth the effort.

OTHER TIPS

I have just figured out how to make OSX executable .app from Windows.

You can set the Tycho build to generate .tar.gz files for Mac/Linux, then use a tool to set permission on the executable within the tar file, as tar supports *nix permissions.

Here is a snippet that shows how to set this in a pom.xml file. (This snippet also sets up Mac .app folder and adds version to archive file names): http://snipt.org/Aggid3

Here is a Java class that does the permissions bit. It requires Guava and Apache Commons Compress: http://snipt.org/Aggic1

Here is a prebuilt jar including all the dependencies: https://mega.co.nz/#!WcNjyRjS!KE7tM1xYrt1l9JIguUAsrgpLe2V0NS1QIj_NvdAnm88

A usage example using the above would be: java -jar gztperms.jar “My Product-0.0.1.201309091838-macosx.cocoa.x86.tar.gz” “My Product-Executable-0.0.1.201309091838-macosx.cocoa.x86.tar.gz” “My Product.app/Contents/MacOS/My Product”

I have a fairly trivial Ant-based post-build script I execute from Jenkins that finds the .gz file and runs this script on it, and everything now works from the artifact link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top