Wuff: Building Eclipse Applications and Plugins with Gradle

30
WUFF Building Eclipse Applications and Plugins with Gradle Gradle Summit 2015 Andrey Hihlovskiy

Transcript of Wuff: Building Eclipse Applications and Plugins with Gradle

Page 1: Wuff: Building Eclipse Applications and Plugins with Gradle

WUFFBuilding Eclipse Applications and Plugins

with Gradle

Gradle Summit 2015 Andrey Hihlovskiy

Page 2: Wuff: Building Eclipse Applications and Plugins with Gradle

Introduction to Wuff

• Wuff is a set of gradle plugins

• Run, debug & buildEclipse Plugins & Applications

• Supports multiple Eclipse versions

• Implements own configuration DSL

Page 3: Wuff: Building Eclipse Applications and Plugins with Gradle

History: 2009Bunch of non-automated Eclipse Plugins

Page 4: Wuff: Building Eclipse Applications and Plugins with Gradle

History: 2011Move to Eclipse Tycho

Page 5: Wuff: Building Eclipse Applications and Plugins with Gradle

History: 2014Started development of Wuff

Page 6: Wuff: Building Eclipse Applications and Plugins with Gradle

OSGi challenges

• Duplicate dependencies: OSGi and Maven?

• From where to get these OSGi dependencies?

• No transitive dependencies?

• How to include non-OSGi libraries?

Page 7: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 8: Wuff: Building Eclipse Applications and Plugins with Gradle

Wuff nowadays

• 8 releases

• 7 contributors

• some features in beta

• some great ideas in the air

• version 1.0 is coming this summer

Page 9: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 10: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 11: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 12: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 13: Wuff: Building Eclipse Applications and Plugins with Gradle

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”

Page 14: Wuff: Building Eclipse Applications and Plugins with Gradle

Equinox Product Layout

Page 15: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 16: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 17: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 18: Wuff: Building Eclipse Applications and Plugins with Gradle

Wuff: IDE App

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

Page 19: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 20: Wuff: Building Eclipse Applications and Plugins with Gradle

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’.

Page 21: Wuff: Building Eclipse Applications and Plugins with Gradle

Defining Eclipse version

wuff { eclipseVersion(‘myVersion’) { eclipseMavenGroup = ‘myGroup’ sources { source ‘http://...’ } } selectedEclipseVersion = ‘myVersion’ }

Page 22: Wuff: Building Eclipse Applications and Plugins with Gradle

Installing language packs

wuff { languagePack ‘de’ languagePack ‘fr’ }

Out-of-the-box supported languages: ‘de’ (German)‘fr’ (French)‘es’ (Spanish)

Page 23: Wuff: Building Eclipse Applications and Plugins with Gradle

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 }

Page 24: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 25: Wuff: Building Eclipse Applications and Plugins with Gradle

Including non-OSGi libdependencies { privateLib ‘org.jdom:jdom2:2.0.6’ }

MANIFEST.MF:Bundle-ClassPath: jdom-2.0.6.jar

including bundle

Page 26: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 27: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 28: Wuff: Building Eclipse Applications and Plugins with Gradle

Wuff: version 1.0 and beyond

• Resolve OSGi bundles directly from p2 repos

• More control over manifest and plugin.xml generation

• IDE integration

Page 29: Wuff: Building Eclipse Applications and Plugins with Gradle

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

Page 30: Wuff: Building Eclipse Applications and Plugins with Gradle

Thanks for listening!

Andrey Hihlovskiy

akhikhl at GitHub

[email protected]

@AndreyHihlovskiy