WUFF
Building Eclipse Applications and Plugins 

with Gradle
Gradle Summit 2015

Andrey Hihlovskiy
Introduction to Wuff
• Wuff is a set of gradle plugins
• Run, debug & build

Eclipse Plugins & Applications
• Supports multiple Eclipse versions
• Implements own configuration DSL
History: 2009
Bunch of non-automated Eclipse Plugins
History: 2011
Move to Eclipse Tycho
History: 2014
Started development of Wuff
OSGi challenges
• Duplicate dependencies: OSGi and Maven?
• From where to get these OSGi dependencies?
• No transitive dependencies?
• How to include non-OSGi libraries?
Eclipse mavenization
• Download Eclipse distro from:

“${eclipseMirror}/eclipse/technology/epp/downloads…”
• Unpack it to temp dir
• Read manifest of each plugin, calculate dependencies
• Generate POM for each plugin
• Install each plugin to ~/.m2/repository
Wuff nowadays
• 8 releases
• 7 contributors
• some features in beta
• some great ideas in the air
• version 1.0 is coming this summer
Wuff Gradle Plugins
org.akhikhl.wuff.osgi-bundle
org.akhikhl.wuff.eclipse-bundle
org.akhikhl.wuff.eclipse-equinox-app
org.akhikhl.wuff.eclipse-rcp-app
org.akhikhl.wuff.eclipse-ide-app
org.akhikhl.wuff.efxclipse-app
org.akhikhl.wuff.eclipse-feature
org.akhikhl.wuff.eclipse-repository
Wuff tasks
# equinox-app, rcp-app, efxclipse-app

gradle scaffold



# rcp-app, ide-app, efxclipse-app
gradle run



# rcp-app, ide-app, efxclipse-app
gradle debug



# bundle, p2-repo, equinox-app, 

# rcp-app, ide-app, efxclipse-app
gradle build
Wuff: Eclipse Bundle
apply plugin: ‘java’
apply plugin: ‘org.akhikhl.wuff.eclipse-bundle’



$ gradle build

Effects:
OSGi manifest is created or merged
‘plugin.xml’ is created or merged
‘Require-Bundle’ converted to Gradle dependencies
Eclipse Bundle JAR is created
Wuff: Equinox App
apply plugin: ‘java’
apply plugin: ‘org.akhikhl.wuff.eclipse-equinox-app’
// plugin.xml
<extension id=“app”
point=“org.eclipse.core.runtime.applications”> ...



$ gradle run

Effects:
Equinox configuration is created
“org.eclipse.equinox.launcher.Main” is launched
Wuff: Equinox Product
apply plugin: ‘java’
apply plugin: ‘org.akhikhl.wuff.eclipse-equinox-app’
// plugin.xml
<extension id=“app”
point=“org.eclipse.core.runtime.applications”> ...



$ gradle build

Effect:
Self-Contained Equinox App is created in “build/output”
Equinox Product Layout
Platform-specific 

Equinox Products
products {
product platform: 'linux', arch: 'x86_32'
product platform: 'linux', arch: 'x86_64'
product platform: 'windows', arch: 'x86_32'
product platform: 'windows', arch: 'x86_64'
product platform: 'macosx', arch: 'x86_64'
archiveProducts = true
}



$ gradle build

Effect:
5 platform-specific products are created
Wuff: RCP App
apply plugin: ‘java’
apply plugin: ‘org.akhikhl.wuff.eclipse-rcp-app’
Define Application, Perspective,View ...





$ gradle scaffold
$ gradle run

$ gradle debug
$ gradle build
RCP App vs Equinox App
Equinox App
Wuff: equinox runtime
Wuff: products
You: Application class
RCP App
Wuff: equinox runtime
Wuff: products
You: Application class

Wuff: RCP plugins
You: Views, Perspectives
You: Intro pages
You: Splash screen
Wuff: IDE App
apply plugin: ‘org.akhikhl.wuff.eclipse-ide-app’
IDE App vs RCP App
RCP App
Wuff: equinox runtime
Wuff: products
You: Application class

Wuff: RCP plugins
You: Views, Perspectives
You: Intro pages
You: Splash screen
IDE App
Wuff: equinox runtime
Wuff: products
You: Application class

Wuff: RCP plugins
You: Views, Perspectives
You: Intro pages
You: Splash screen
Wuff: IDE plugins
Switching Eclipse versions
wuff {
selectedEclipseVersion = ‘4.4.2’
}



$ gradle build

Out-of-the-box supported Eclipse versions: 

‘3.7.1’,‘3.7.2’, 

‘4.2.1’,‘4.2.2’, 

‘4.3.1’,‘4.3.2’, 

‘4.4’,‘4.4.1’,‘4.4.2’.
Defining Eclipse version
wuff {
eclipseVersion(‘myVersion’) {

eclipseMavenGroup = ‘myGroup’

sources {
source ‘http://...’

}
}
selectedEclipseVersion = ‘myVersion’
}
Installing language packs
wuff {
languagePack ‘de’
languagePack ‘fr’
}

Out-of-the-box supported languages:

‘de’ (German)
‘fr’ (French)
‘es’ (Spanish)
Localizing product
products {
product platform: 'linux', arch: ‘x86_64' // english
product platform: 'linux', arch: ‘x86_64’, language: ‘de’

product platform: 'linux', arch: 'x86_64', language: ‘fr’
archiveProducts = true
}

Wrapping non-OSGi lib
dependencies {
compile ‘org.jdom:jdom2:2.0.6’
}

MANIFEST.MF:

Bundle-ClassPath: jdom-2.0.6.jar
Export-Package: org.jdom2;...
jdom2-bundle-2.0.6.jar
Including non-OSGi lib
dependencies {
privateLib ‘org.jdom:jdom2:2.0.6’
}

MANIFEST.MF:

Bundle-ClassPath: jdom-2.0.6.jar
including bundle
Generating Eclipse Features
apply plugin: ‘org.akhikhl.wuff.eclipse-feature’
dependencies {
feature ‘:MyBundle’
feature “$eclipseMavenGroup:org.eclipse.jface:+”
}
feature.xml, MANIFEST.MF
myFeature_1.0.0.jar
Generating P2 Repositories
apply plugin: ‘org.akhikhl.wuff.eclipse-repository’
dependencies {
repository project(‘:MyFeature1’)
repository “$eclipseMavenGroup:org.eclipse.rcp:+”
}
artifacts.xml, content.xml, features/, plugins/
myRepository_1.0.0.zip
Wuff: version 1.0 and beyond
• Resolve OSGi bundles
directly from p2 repos
• More control over
manifest and plugin.xml
generation
• IDE integration
Wuff is here for you
https://github.com/akhikhl/wuff
https://github.com/akhikhl/wuff/wiki
at Gradle Plugin Portal
at JCenter
at Maven Central
Thanks for listening!
Andrey Hihlovskiy
akhikhl at GitHub
akhikhl@gmail.com
@AndreyHihlovskiy

Wuff: Building Eclipse Applications and Plugins with Gradle

  • 1.
    WUFF Building Eclipse Applicationsand Plugins 
 with Gradle Gradle Summit 2015
 Andrey Hihlovskiy
  • 2.
    Introduction to Wuff •Wuff is a set of gradle plugins • Run, debug & build
 Eclipse Plugins & Applications • Supports multiple Eclipse versions • Implements own configuration DSL
  • 3.
    History: 2009 Bunch ofnon-automated Eclipse Plugins
  • 4.
    History: 2011 Move toEclipse Tycho
  • 5.
  • 6.
    OSGi challenges • Duplicatedependencies: OSGi and Maven? • From where to get these OSGi dependencies? • No transitive dependencies? • How to include non-OSGi libraries?
  • 7.
    Eclipse mavenization • DownloadEclipse distro from:
 “${eclipseMirror}/eclipse/technology/epp/downloads…” • Unpack it to temp dir • Read manifest of each plugin, calculate dependencies • Generate POM for each plugin • Install each plugin to ~/.m2/repository
  • 8.
    Wuff nowadays • 8releases • 7 contributors • some features in beta • some great ideas in the air • version 1.0 is coming this summer
  • 9.
  • 10.
    Wuff tasks # equinox-app,rcp-app, efxclipse-app
 gradle scaffold
 
 # rcp-app, ide-app, efxclipse-app gradle run
 
 # rcp-app, ide-app, efxclipse-app gradle debug
 
 # bundle, p2-repo, equinox-app, 
 # rcp-app, ide-app, efxclipse-app gradle build
  • 11.
    Wuff: Eclipse Bundle applyplugin: ‘java’ apply plugin: ‘org.akhikhl.wuff.eclipse-bundle’
 
 $ gradle build
 Effects: OSGi manifest is created or merged ‘plugin.xml’ is created or merged ‘Require-Bundle’ converted to Gradle dependencies Eclipse Bundle JAR is created
  • 12.
    Wuff: Equinox App applyplugin: ‘java’ apply plugin: ‘org.akhikhl.wuff.eclipse-equinox-app’ // plugin.xml <extension id=“app” point=“org.eclipse.core.runtime.applications”> ...
 
 $ gradle run
 Effects: Equinox configuration is created “org.eclipse.equinox.launcher.Main” is launched
  • 13.
    Wuff: Equinox Product applyplugin: ‘java’ apply plugin: ‘org.akhikhl.wuff.eclipse-equinox-app’ // plugin.xml <extension id=“app” point=“org.eclipse.core.runtime.applications”> ...
 
 $ gradle build
 Effect: Self-Contained Equinox App is created in “build/output”
  • 14.
  • 15.
    Platform-specific 
 Equinox Products products{ product platform: 'linux', arch: 'x86_32' product platform: 'linux', arch: 'x86_64' product platform: 'windows', arch: 'x86_32' product platform: 'windows', arch: 'x86_64' product platform: 'macosx', arch: 'x86_64' archiveProducts = true }
 
 $ gradle build
 Effect: 5 platform-specific products are created
  • 16.
    Wuff: RCP App applyplugin: ‘java’ apply plugin: ‘org.akhikhl.wuff.eclipse-rcp-app’ Define Application, Perspective,View ...
 
 
 $ gradle scaffold $ gradle run
 $ gradle debug $ gradle build
  • 17.
    RCP App vsEquinox App Equinox App Wuff: equinox runtime Wuff: products You: Application class RCP App Wuff: equinox runtime Wuff: products You: Application class
 Wuff: RCP plugins You: Views, Perspectives You: Intro pages You: Splash screen
  • 18.
    Wuff: IDE App applyplugin: ‘org.akhikhl.wuff.eclipse-ide-app’
  • 19.
    IDE App vsRCP App RCP App Wuff: equinox runtime Wuff: products You: Application class
 Wuff: RCP plugins You: Views, Perspectives You: Intro pages You: Splash screen IDE App Wuff: equinox runtime Wuff: products You: Application class
 Wuff: RCP plugins You: Views, Perspectives You: Intro pages You: Splash screen Wuff: IDE plugins
  • 20.
    Switching Eclipse versions wuff{ selectedEclipseVersion = ‘4.4.2’ }
 
 $ gradle build
 Out-of-the-box supported Eclipse versions: 
 ‘3.7.1’,‘3.7.2’, 
 ‘4.2.1’,‘4.2.2’, 
 ‘4.3.1’,‘4.3.2’, 
 ‘4.4’,‘4.4.1’,‘4.4.2’.
  • 21.
    Defining Eclipse version wuff{ eclipseVersion(‘myVersion’) {
 eclipseMavenGroup = ‘myGroup’
 sources { source ‘http://...’
 } } selectedEclipseVersion = ‘myVersion’ }
  • 22.
    Installing language packs wuff{ languagePack ‘de’ languagePack ‘fr’ }
 Out-of-the-box supported languages:
 ‘de’ (German) ‘fr’ (French) ‘es’ (Spanish)
  • 23.
    Localizing product products { productplatform: 'linux', arch: ‘x86_64' // english product platform: 'linux', arch: ‘x86_64’, language: ‘de’
 product platform: 'linux', arch: 'x86_64', language: ‘fr’ archiveProducts = true }

  • 24.
    Wrapping non-OSGi lib dependencies{ compile ‘org.jdom:jdom2:2.0.6’ }
 MANIFEST.MF:
 Bundle-ClassPath: jdom-2.0.6.jar Export-Package: org.jdom2;... jdom2-bundle-2.0.6.jar
  • 25.
    Including non-OSGi lib dependencies{ privateLib ‘org.jdom:jdom2:2.0.6’ }
 MANIFEST.MF:
 Bundle-ClassPath: jdom-2.0.6.jar including bundle
  • 26.
    Generating Eclipse Features applyplugin: ‘org.akhikhl.wuff.eclipse-feature’ dependencies { feature ‘:MyBundle’ feature “$eclipseMavenGroup:org.eclipse.jface:+” } feature.xml, MANIFEST.MF myFeature_1.0.0.jar
  • 27.
    Generating P2 Repositories applyplugin: ‘org.akhikhl.wuff.eclipse-repository’ dependencies { repository project(‘:MyFeature1’) repository “$eclipseMavenGroup:org.eclipse.rcp:+” } artifacts.xml, content.xml, features/, plugins/ myRepository_1.0.0.zip
  • 28.
    Wuff: version 1.0and beyond • Resolve OSGi bundles directly from p2 repos • More control over manifest and plugin.xml generation • IDE integration
  • 29.
    Wuff is herefor you https://github.com/akhikhl/wuff https://github.com/akhikhl/wuff/wiki at Gradle Plugin Portal at JCenter at Maven Central
  • 30.
    Thanks for listening! AndreyHihlovskiy akhikhl at GitHub akhikhl@gmail.com @AndreyHihlovskiy