Wuff: Building Eclipse Applications and Plugins with Gradle

Post on 28-Jul-2015

351 views 0 download

Transcript of Wuff: Building Eclipse Applications and Plugins with Gradle

WUFFBuilding Eclipse Applications and Plugins

with Gradle

Gradle Summit 2015 Andrey Hihlovskiy

Introduction to Wuff

• Wuff is a set of gradle plugins

• Run, debug & buildEclipse Plugins & Applications

• Supports multiple Eclipse versions

• Implements own configuration DSL

History: 2009Bunch of non-automated Eclipse Plugins

History: 2011Move to Eclipse Tycho

History: 2014Started 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-appgradle 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 dependenciesEclipse Bundle JAR is created

Wuff: Equinox Appapply 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 runtimeWuff: productsYou: Application class

RCP App Wuff: equinox runtimeWuff: productsYou: Application classWuff: RCP pluginsYou: Views, PerspectivesYou: Intro pagesYou: Splash screen

Wuff: IDE App

apply plugin: ‘org.akhikhl.wuff.eclipse-ide-app’

IDE App vs RCP App

RCP App Wuff: equinox runtimeWuff: productsYou: Application classWuff: RCP pluginsYou: Views, PerspectivesYou: Intro pagesYou: Splash screen

IDE App Wuff: equinox runtimeWuff: productsYou: Application classWuff: RCP pluginsYou: Views, PerspectivesYou: Intro pagesYou: Splash screenWuff: IDE plugins

Switching Eclipse versionswuff { 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 libdependencies { 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 libdependencies { 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