Les slides du Tools in Action que j'ai donné à Devoxx France 2019.
Le JDK est open source et son développement aussi. L'ensemble des nouveautés vit sur des branches Mercurial qui peuvent être téléchargées et compilées à la demande. Cela permet de jouer avec des fonctionnalités encore en chantier, de regarder comment les nouvelles syntaxes fonctionneront, bref, de jouer avec un JDK du futur, qui n'existera peut-être jamais. L'objet de ce tools in action est simple : montrer comment tout ceci fonctionne, de l'installation d'une machine Ubuntu à l'exécution d'un JDK recompilé maison.
2. #DevoxxFR @JosePaumard
Pourquoi son propre JDK ?
Parce que c’est amusant
On peut construire des JDK qui n’existent pas encore
Voire qui n’existeront jamais !
Est-ce un JDK ? Licence du TCK…
5. #DevoxxFR @JosePaumard
Pourquoi son propre JDK ?
https://hg.openjdk.java.net/
Racine du repository Mercurial de l’Open JDK
65 projets référencés :
- amber, valhalla, loom, panama
- graal
- duke
6. #DevoxxFR @JosePaumard
Construit-on un JDK ?
En fait non…
Car il y a le TCK = Test Compatibility Kit
Qui est sous licence, et plus complexe à faire tourner
Le LondonJug (LJC) a lancé Adopt OpenJDK
https://adoptopenjdk.net/
10 plateformes, 5 versions, 2 JVM
7. #DevoxxFR @JosePaumard
Le point de départ
Quelques installations !
- Distribution Ubuntu Desktop 18.04
- Mercurial n’est pas installé par défaut
$ sudo apt-get install mercurial
14. #DevoxxFR @JosePaumard
Mettre à jour un repo local
Ici le repo n’est pas à jour
$ hg branches
fibers 54758:d0d359325486
processorid 54156:df063b0c6b16
cont 54757:852a4764af87 (inactive)
default 54751:f855ec13aa25 (inactive)
15. #DevoxxFR @JosePaumard
Mettre à jour un repo local
$ hg pull
pulling from http://hg.openjdk.java.net/loom/loom/
searching for changes
adding changesets
adding manifests
adding file changes
added 82 changesets with 444 changes to 370 files
new changesets 9396de97aabc:2c84b04740e1
(run 'hg update' to get a working copy)
$ hg branches
fibers 54840:2c84b04740e1
processorid 54156:df063b0c6b16
cont 54839:8d1717a86bcc (inactive)
default 54838:9d0ae9508d53 (inactive)
18. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW !
$ ./configure
Runnable configure script is not present
Generating runnable configure script at /home/ubuntu/jdk-builds/loom/build/.configure-
support/generated-configure.sh
Autoconf is not found on the PATH, and AUTOCONF is not set.
You need autoconf to be able to generate a runnable configure script.
You might be able to fix this by running 'sudo apt-get install autoconf’.
$ sudo apt-get install autoconf
19. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW !
$ ./configure
configure: error: Cannot find GNU make 3.81 or newer! Please put it in the path, or add
e.g. MAKE=/opt/gmake3.81/make as argument to configure.
$ sudo apt-get install make
20. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW !
$ ./configure
configure: error: Could not find a C compiler. You might be able to fix this by running
'sudo apt-get install build-essential'.
configure exiting with result code 1
$ sudo apt-get install build-essential (117Mo)
21. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW…
$ ./configure
configure: error: Could not find X11 libraries. You might be able to fix this by running
'sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev
libxt-dev'.
configure exiting with result code 1
$ sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev
libxt-dev (20Mo)
22. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW…
$ ./configure
configure: error: Could not find cups! You might be able to fix this by running 'sudo
apt-get install libcups2-dev'.
configure exiting with result code 1
$ sudo apt-get install libcups2-dev
23. #DevoxxFR @JosePaumard
Configurer la compilation
Utilitaire autoconf FTW…
$ ./configure
configure: error: Could not find alsa! You might be able to fix this by running 'sudo
apt-get install libasound2-dev'.
configure exiting with result code 1
$ sudo apt-get install libasound2-dev
24. #DevoxxFR @JosePaumard
Configurer la compilation !
Utilitaire autoconf FTW…
A new configuration has been successfully created in
/home/ubuntu/jdk-builds/loom/build/linux-x86_64-server-release
using default settings.
Configuration summary:
* Debug level: release
* HS debug level: product
* JVM variants: server
* JVM features: server: 'aot cds cmsgc compiler1 compiler2 epsilongc g1gc graal jfr jni-check jvmci jvmti management
nmt parallelgc serialgc services shenandoahgc vm-structs zgc'
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 13-internal+0-adhoc.ubuntu.loom (13-internal)
Tools summary:
* Boot JDK: openjdk version "12" 2019-03-19 OpenJDK Runtime Environment (build 12+33) OpenJDK 64-Bit Server VM
(build 12+33, mixed mode, sharing) (at /home/ubuntu/jdk/jdk-12)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)
Build performance summary:
* Cores to use: 4
* Memory limit: 7953 MB
25. #DevoxxFR @JosePaumard
Lancer la compilation
Make FTW
$ make images
Building target 'images' in configuration 'linux-x86_64-server-release'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Compiling 1 files for BUILD_JFR_TOOLS
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
...
26. #DevoxxFR @JosePaumard
Lancer la compilation
Make FTW
$ make images
...
Creating support/demos/image/jfc/SampleTree/SampleTree.jar
Creating support/demos/image/jfc/TableExample/TableExample.jar
Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar
Creating jdk image
Creating CDS archive for jdk image
Stopping sjavac server
Finished building target 'images' in configuration 'linux-x86_64-server-release'
$ du -s *
6287440 loom
6358412 amber
29. #DevoxxFR @JosePaumard
En conclusion
Un peu galère…
Un peu long !
Un peu pédestre pour tester les fonctionnalités
On se bat contre l’IDE, voire on le laisse tomber…
Permet de suivre ce qui se fait, en temps réel !