Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven...
-
Upload
nguyendien -
Category
Documents
-
view
216 -
download
0
Transcript of Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven...
![Page 1: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/1.jpg)
Tycho and CBI adoptionFeedback from the trenches
EclipseCon Europe 2012CC-BY 3.0
![Page 2: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/2.jpg)
About the speakers
Krzysztof:
• Full Name: Krzysztof Daniel
• Twitter: @kda
• Eclipse packager in Fedora Linux
• Contributor to Platform Tycho-based build
• Tycho sceptic
Mickael:
• Full Name: Mickael Istria
• Twitter: @mickaelistria
• JBoss Tools & JBoss Developer Studio build
• Committer on SWTBot, Nebula, GMF-Tooling (mainly build stuff)
• Tycho enthusiast
![Page 3: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/3.jpg)
Agenda
1. CBI/Tycho build - clarification
2. PDE Build vs Tycho: Differences
3. Short migration guide (with tricks)
4. Case study: SWTBot
5. Case study: Eclipse Platform
6. Questions and answers
![Page 4: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/4.jpg)
LTS
A small Clarification
CBI is an initiative to lower the contribution barrier.
Tycho is a technical solution.
CBI
Tycho
![Page 5: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/5.jpg)
Chulk and Cheese
PDEBuild is...
Ant-based
Driven by scripts
totally open to hacksTarget-platform aware
customizable via "Callbacks"
Tycho is...
Maven-based
Driven by lifecycle and descriptors (pom)
strict & constrainingTarget-platform aware (p2 only)
customizable via plugins
![Page 6: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/6.jpg)
Chulk and Cheese (continued)
PDEBuild...
1 script = N bundles/features
is a monolithic build
Tycho...
1 pom = 1 artifact
Allows incremental build (artifact after artifact)
![Page 7: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/7.jpg)
Knowing your enemy: build.properties
custom=true
customBuildCallbacks=...
$ find . -name build.properties \
-exec grep -H custom {} \;
![Page 8: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/8.jpg)
Knowing your enemy:repository shape
nested artifacts:
*.dll, *.class, *.jar, *.jnilib, *.so
content in features
Documentation generation
cycles
![Page 9: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/9.jpg)
Migration Guide: 101
Create a pom.xml for each artifact
mvn org.eclipse.tycho:tycho-pomgenerator-plugin:0.16.0:generate-poms -DgroupId=<MY.PROJECT>
http://wiki.eclipse.org/Tycho/Reference_Card#Generating_POM_files
![Page 10: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/10.jpg)
Migration Guide: A partial Tycho build
While keeping PDE/Build for production...
1. Generate poms
2. Convert problematic artifacts into p2 repo
3. Use the pre-compiled artifacts in your build
as required
4. Fix one bundle at a time.
![Page 11: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/11.jpg)
Migration Guide: be modular !
Any module (plugin, feature...) should be able to build on its own (and only on it's own).
mvn verify should work from anywhere in your source tree -as long as dependencies can be resolved-.
Necessary for incremental builds (successive mvn install)
![Page 12: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/12.jpg)
Migration Guide - don't be afraid to...
Refactor: Maven will force you to refactor, but don't be afraid, in the end everything looks cleaner.
Example: GMF Tooling had to move documentation to a dedicated plugin.
Iterate: Start with the ugliest solution and improve later. Ugliest Maven solution is already an improvement over PDE/Build.
![Page 13: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/13.jpg)
Migration Guide - customize
PDE/Build flow is replaced by Maven lifecycle (phases)
PDE/Build customCallbacks are replaced by usage of Maven plugins
![Page 14: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/14.jpg)
A Trap: Implicit dependencies between plugins
Example: javadoc generation-sourcepath "
;../org.eclipse.ant.core/src ...
-d reference/api -classpath @rt@ ;../com.ibm.icu_*.jar ...
Tycho solutions:
• Explicit your dependencies in your bundle
• Explicit dependencies when invoking a Maven plugin
• Refactor
![Page 15: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/15.jpg)
to the Maven world and its plugin ecosystem
![Page 16: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/16.jpg)
Migration Guide - iteration #1
Use maven-antrunner-plugin to invoke your customCallbacks/build.xmls.
If customCallbacks require some Eclipse-specific Ant tasks, use tycho-eclipserun-plugin with org.eclipse.ant.core.antRunner application
![Page 17: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/17.jpg)
Migration Guide – native libraries
• use maven-antrunner-plugin
• remember to propagate errors and fail the build when necessary
• use any build phase before the "compile" - (recommended "generate-resources")
• Look forward to maven-nar-plugin
• Try to "flatten" artifacts
![Page 18: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/18.jpg)
Migration Guide - help generation
use tycho-eclipserun-plugin
adjust all the paths or copy required bundles
![Page 19: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/19.jpg)
Migration Guide - innern jars
tycho-custom-bundle-plugin
• creates inner jars from fileset
• used in JDTo batch-compilero antadapter
![Page 20: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/20.jpg)
Migration Guide - cool plugins (Maven)
maven-dependency-plugin:get and maven-download-plugin:wget mojos to include other stuff in your jar.
Still missing: a real way to do filesystem operation with Maven (always use Ant plugin...)
![Page 21: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/21.jpg)
Migration Guide - cool plugins (Tycho)
• tycho-buildtimestamp-jgito version changes after code changeo qualifier-commit consistency
• eclipse-jarsigner-plugin
![Page 22: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/22.jpg)
Migration guide - sources
tycho-source-plugin generates a source bundle made of sources for your bundle.
tycho-source-feature-plugin generates a feature made of all <referencedBundles>.source
Very good in most cases, but don't allow big customization for tricky cases
![Page 23: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/23.jpg)
Migration Guide: Tests made "native"
eclipse-test-plugin and tycho-surefire-plugin run test in the minimal necessary environment (as specified in MANIFEST.MF)
![Page 24: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/24.jpg)
Migration Guide - very custom stuff
Create your own Maven plugin for that.
Try to get it generic enough to share this with the community as part of Tycho.
![Page 25: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/25.jpg)
Truly liberating build
• Offline o only once your Maven repo contains the right stuffo using "offline" target platforms and repo (file://...)
• Forever reproducible (p2 repo sustainability?)o Need to keep your target platform
• Automatedo no single item should be created outside of maven.
• Default
![Page 26: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/26.jpg)
Case study: SWTBot
• Vanilla Tycho use-case
• No workaround
• Just mvn verify and you get a ready-to-publish p2 repo
• Simply added code coverage and Sonar support by using Maven plugins
![Page 27: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/27.jpg)
Case Study: Platform
• it is not default at all
• "natives" repo
• failing Eclipse build on MacOS (384482)
• native parts not built (except in Fedora)
• dependency trap workarounded by:o adjusting pathso copying deps (for help)
![Page 28: Tycho and CBI adoption - EclipseCon Europe 2017 · PDF filePDE/Build flow is replaced by Maven lifecycle ... Example: javadoc generation ... • tycho-buildtimestamp-jgit](https://reader034.fdocuments.in/reader034/viewer/2022051523/5a790e827f8b9a43758d14ac/html5/thumbnails/28.jpg)
Q&A