akhikhl / wuff

Gradle plugin for automating assembly of OSGi/Eclipse bundles and applications
MIT License
152 stars 51 forks source link

Support for Eclipse 4 #23

Open tschulte opened 10 years ago

tschulte commented 10 years ago

I am in the progress of switching a Maven Tycho Build of an e4 RCP application to wuff. But I think for e4 Wuff needs to be enhanced to support the new concepts:

    <extension
            id="myproductid"
            point="org.eclipse.core.runtime.products">
        <product
                name="myproductname"
                application="org.eclipse.e4.ui.workbench.swt.E4Application">
[...]

Workaround:

products {
    launchParameters << '-application'
    launchParameters << 'org.eclipse.e4.ui.workbench.swt.E4Application'
    launchParameters << '-product'
    launchParameters << "${project.name}.myproductid"
}

run {
    args = products.launchParameters
}
akhikhl commented 10 years ago

I implemented support of e4 technology in Wuff 0.0.13-SNAPSHOT. Please, test the following scenario:

buildscript {
  repositories {
    jcenter()
    maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
  }

  dependencies {
    classpath 'org.akhikhl.wuff:wuff-plugin:0.0.13-SNAPSHOT'
  }
}

repositories {
  jcenter()
  maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}

apply plugin: 'java'
apply plugin: 'org.akhikhl.wuff.eclipse-rcp-app'

Wiring of org.eclipse.e4.ui.workbench.swt.E4Application and product is done completely automatically, so you don't have to pass additional arguments to JVM.

I tested e4 support on Eclipse versions 4.2.1, 4.2.2, 4.3.1, 4.3.2, 4.4 and on platforms Linux and Windows. I did not test it on Mac OSX, since I don't own Apple machine.

tschulte commented 10 years ago

It seems to work for SWT based apps. But I wonder, if the Application.e4xmi should be moved to src/main/resources?

Currently I am trying to get a JavaFX-based RCP application to run. See https://github.com/tschulte/contacts-griffon. I still get

Error in equinox application configuration for project org.eclipse.fx.demo.contacts.app:
Could not generate extension-point "org.eclipse.core.runtime.applications" and there are no user-provided extension-points of this type.
Reason: project sources do not contain Application.java or Application.groovy.

This project is a copy of the contacts demo of e(fx)clipse and I just added the gradle build file. As you can see, I needed to do a lot of stuff to at least get it running, though it still does not run completely.

OSGI-Extensions are not supported out of the box:

products {
    launchParameter '-vmargs'
    launchParameter '-Dosgi.framework.extensions=org.eclipse.fx.osgi'
}
configurations {
    osgiExtension
}
dependencies {
    osgiExtension "$eclipseMavenGroup:org.eclipse.fx.osgi:+"
}
afterEvaluate {
    tasks.prepareRunConfig << {
        File configIni = file("$buildDir/run/configuration/config.ini")
        configIni.append "osgi.framework.extensions=reference\\:${configurations.osgiExtension.files[0].toURI()}"
    }
}
configurations {
    compileOnly
    all {
        // exclude a lot of dependencies automatically applied by wuff (swt et. al.)
    }
}

But it still does not run yet. Seem to be some dependency issue. Maybe you can see what the problem is?

akhikhl commented 10 years ago

Moving Application.e4xmi to src/main/resources - yes, this is a good idea. I will try to do it. e(fx)clipse integration - I am new in this area. Will see what I can learn and implement. Could you, please, open a new issue on e(fx)clipse integration and move our discussion there? I'd rather prefer to have more small issues than fewer large issues.