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

Post on 11-Aug-2015

170 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

rescue!rescue!

Eclipse DemoCamp Poznań 2015

Michał Ćmil

@michalcmil

AgendaAgenda

Eclipse RCP build systemOur projectIssues

GradleIntroductionSample applicationsEclipse RCP

Project experiences

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)

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)

Target PlatformTarget Platform

Issues with the standardIssues with the standardaproachaproach

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

Unstable BuildsUnstable Builds

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

Tightly coupled with IDETightly coupled with IDE

Configuring the development environmentis a pain...

Hard to add externalHard to add externaldependencies dependencies

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?

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

Groovy based build toolMaven's Conventions andDependency Management

Tons of defaults andplugins Supports Nexus,Artifactory etc.

Ant's FlexibilityImperative languageavailable in the DSL

Minimal Java BuildMinimal Java Build

apply plugin: 'java'

$gradle build

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

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

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'

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

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

EffectEffect

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

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

Wuff DocumentationWuff Documentation

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

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)

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

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)

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

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

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

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

top related