eclipse rcp outside of eclipse ide - gradle to the rescue!

30
Eclipse RCP outside of Eclipse RCP outside of Eclipse IDE - Gradle to the Eclipse IDE - Gradle to the rescue! rescue! Eclipse DemoCamp Poznań 2015 Michał Ćmil @michalcmil

Upload: michal-cmil

Post on 11-Aug-2015

169 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Eclipse RCP outside ofEclipse RCP outside ofEclipse IDE - Gradle to theEclipse IDE - Gradle to the

rescue!rescue!

Eclipse DemoCamp Poznań 2015

Michał Ćmil

@michalcmil

Page 2: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

AgendaAgenda

Eclipse RCP build systemOur projectIssues

GradleIntroductionSample applicationsEclipse RCP

Project experiences

Page 3: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Our projectOur projecte(fx)clipse + Java 8 based Heavy usage of Eclipse technologies: EMF, ECP, Teneo,BirtJava EE 7 backend (WildFly)Around 50 modulesSome code is in JavaScript (via Nashorn)

Page 4: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Eclipse RCP Build SystemEclipse RCP Build System

Eclipse RCP application are madeof plugins/bundles

Plugins come from updatesites defined via TargetPlatform

Eclipse Plug-in DevelopmentEnvironment (IDE)

Maven Tycho (headless)

Page 5: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Target PlatformTarget Platform

Page 6: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Issues with the standardIssues with the standardaproachaproach

Unstable buildsSharing modules between client and serverTightly coupled with IDEVery hard to add external dependencies

Page 7: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Unstable BuildsUnstable Builds

Page 8: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Sharing code betweenSharing code betweenclient and serverclient and server

Maven for server sideEclipse Tycho + PDE for client sideSome modules were used by both...

We had to maintain 3 build system and needed tworuns of Maven on the same code to build the app

Page 9: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Tightly coupled with IDETightly coupled with IDE

Configuring the development environmentis a pain...

Page 10: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Hard to add externalHard to add externaldependencies dependencies

Page 11: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Could be done better...Could be done better...

Project structure known from Maven

Tests in src/test/Continuous integration and releasing

/src/main/java, /src/main/resources?

Page 12: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

So... Is there any hope?So... Is there any hope?

Page 13: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Groovy based build toolMaven's Conventions andDependency Management

Tons of defaults andplugins Supports Nexus,Artifactory etc.

Ant's FlexibilityImperative languageavailable in the DSL

Page 14: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Minimal Java BuildMinimal Java Build

apply plugin: 'java'

$gradle build

Page 15: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Minimal Java Build withMinimal Java Build withGuava and JUnitGuava and JUnitapply plugin: 'java'

repositories { mavenCentral()}

dependencies { compile 'com.google.guava:guava:18.0' testCompile 'junit:junit:4.12'}

$gradle build

Page 16: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

The Bridge between GradleThe Bridge between Gradleand Eclipse RCPand Eclipse RCP

https://github.com/akhikhl/wuff

Andrey Hihlovskiy will present Wuff at Gradle Summit 12.06.2015

Page 17: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

WuffWuff

Eclipse plugins are normal Gradle dependenciesUpdate Site is downloaded into a local Mavenrepository

Automatically bundles non-OSGi dependencies Manifest GenerationRuns and creates executable Eclipse applications

compile 'efxclipse-1_2:org.eclipse.e4.ui.di:+'compile 'com.google.guava:guava:18.0'testCompile 'junit:junit:4.12'

Page 18: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Minimal e(fx)clipse sampleMinimal e(fx)clipse samplebuildscript { repositories { jcenter() } dependencies { classpath 'org.akhikhl.wuff:wuff-plugin:0.0.14' }}

apply plugin: 'org.akhikhl.wuff.efxclipse-app'

wuff { selectedEclipseVersion = 'efxclipse-1.2'}

products { nativeLauncher = false}

https://github.com/mcmil/wuff-skeleton

$gradle scaffold$gradle build $gradle run

Page 19: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

ScaffoldingScaffoldingsrc!"" main #"" java $ !"" pl $ !"" cmil $ !"" wuff $ !"" skeleton $ !"" SamplePart.java !"" resources #"" Application.e4xmi #"" css $ !"" default.css !"" plugin.xml

Page 20: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

EffectEffect

Page 21: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Multi module sampleMulti module sampleapply plugin: 'org.akhikhl.wuff.eclipse-config'

wuff { selectedEclipseVersion = 'efxclipse-1.2'}

products { nativeLauncher = false}

project(':pl.cmil.wuff.sample.main') { apply plugin: 'org.akhikhl.wuff.efxclipse-app'

dependencies { compile project(':pl.cmil.wuff.sample.services') }}

project(':pl.cmil.wuff.sample.services') { apply plugin: 'org.akhikhl.wuff.osgi-bundle'

dependencies { compile 'com.google.guava:guava:18.0' }}

https://github.com/mcmil/wuff-efxclipse-samples

Page 22: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Additional featuresAdditional features

Supports Equinox, EclipseRCP, e(fx)clipse, IDE apps,SWT Apps

Easy switching between Eclipse versionsGenerating features and repositoriesAutomatic conversion of existing applicationsPlatform-specific products

https://github.com/akhikhl/wuff-sandbox

Page 23: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Wuff DocumentationWuff Documentation

https://github.com/akhikhl/wuff/tree/master/exampleshttps://github.com/akhikhl/wuff/wiki

Page 24: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Did it help?Did it help?

Stable buildsEasier for developers

Maven-like dependencies (also external - likeGuava, Jersey)Maven-like structure and testsMaven repositories (Maven Central, jCenter,local Nexus)

Page 25: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Did it help?Did it help?

IDE independentNo tooling needed - Gradle Wrapper automaticallydownloads itself on Windows/Linux

One command build for the whole applicationWorks great on Jenkinsgradlew build & gradlew run

Page 26: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

It's not perfectIt's not perfect

A lot of automatics that can failManifests generation and merging

Relatively long buildsclient minimally 30-40sserver minimally 90s with deployment CPU intensive (can work on multiple cores)

Page 27: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Speeding up the buildSpeeding up the build

DaemonGradle is always running

Parallel builds (module level)New Gradle releases

Performance is a priority - biggest buildsaround 4000 modules

Gradle Profiler

https://discuss.gradle.org/t/the-gradle-roadmap/105

Page 28: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Speeding up the buildSpeeding up the build

IntelliJ PluginStarting the application straighlty from theIDE (without using gradle)Incremental builds for classes and resources(gradle build not required)

https://github.com/mcmil/wuff-intellij-plugin

Page 29: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

Buildship - AnotherBuildship - Anotherapproachapproach

Deep Gradle-Eclipse integration plugin

Gradle guys are building an eclipse plugin for gradle-based projects in the Eclipse IDE... ...and they use Gradle to build it Started 24.03.2015 - currently only snapshots available

http://www.vogella.com/tutorials/EclipseGradle/article.html

https://github.com/eclipse/buildship

Page 30: Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!

SourcesSourcesWuff: e(fx)clipse Wuff samples:

, Gradle: Gradle Free E-Books: Eclipse architecture: Buildship: Eclipse and Gradle Tutorial:

Why Gradle:

https://github.com/akhikhl/wuffhttps://github.com/mcmil/wuff-

efxclipse-samples https://github.com/mcmil/wuff-skeletonhttp://gradle.org/

http://gradle.org/books/http://www.aosabook.org/en/eclipse.html

https://github.com/eclipse/buildship http://www.vogella.com/tutorials/

EclipseGradle/article.htmlhttp://www.drdobbs.com/jvm/why-build-your-java-

projects-with-gradle/240168608