Slide 1

Slide 1 text

Developer Productivity How Micronaut is built Cédric Champeau Micronaut Developer Oracle Labs

Slide 2

Slide 2 text

• Working at Oracle Labs on Micronaut  Main focus on build plugins and dev productivitity • Formerly working at Gradle Inc • Author of static compiler of Groovy • Amateur astronomer  @CedricChampeau  https://www.astrobin.com/users/melix/ About me Copyright © 2022, Oracle and/or its affiliates micronaut.io github.com/micronaut-projects/micronaut-core https://melix.github.io/blog/2022/05/astro-twitch.html

Slide 3

Slide 3 text

• Micronaut is focused on modern architectures like Serverless and Microservices • Also a complete framework for any type of application • Lightweight, reactive (HTTP Client/Server based on Netty) • Annotation processor to compute framework infrastructure at compile time Micronaut Copyright © 2022, Oracle and/or its affiliates micronaut.io github.com/micronaut-projects/micronaut-core

Slide 4

Slide 4 text

Micronaut = Build Time Framework Infrastructure Copyright © 2022, Oracle and/or its affiliates Micronaut computes: • All dependency & configuration injection • Annotation metadata, meta-annotations • AOP proxies • Bean introspections • And all other framework infrastructure • Reflection, runtime proxy, and dynamic classloader free

Slide 5

Slide 5 text

Micronaut is Open Source Copyright © 2022, Oracle and/or its affiliates • Hosted at GitHub • Managed by the Micronaut Foundation • 92 Git repositories  ~60 modules • Each project versioned independently

Slide 6

Slide 6 text

Micronaut releases Copyright © 2022, Oracle and/or its affiliates • Core version drives a “Micronaut release” • Micronaut Core BOM includes many Micronaut modules • Gradle and Maven plugin integrate with the BOM

Slide 7

Slide 7 text

GitHub Workflows Copyright © 2022, Oracle and/or its affiliates • Micronaut Project Template  Used to create new modules  Defines project “template”  Defines files to be sync’ed on all projects  Shared configuration (checkstyle rules, ...)

Slide 8

Slide 8 text

GitHub Workflows: custom GitHub Actions Copyright © 2022, Oracle and/or its affiliates See https://github.com/micronaut-projects/github-actions - release note generation - BOM updates - Micronaut Launch deployment helpers

Slide 9

Slide 9 text

GitHub Workflows: one-click releases Copyright © 2022, Oracle and/or its affiliates

Slide 10

Slide 10 text

Micronaut Build Copyright © 2022, Oracle and/or its affiliates • An internal plugin suite • Models how Micronaut modules are built • Configures common behavior  Quality checks  Sonar  Publication to Maven Central  Build cache  Test selection  ...

Slide 11

Slide 11 text

Gradle “convention plugins” Copyright © 2022, Oracle and/or its affiliates • For Maven users, think of “composite parent POMs” • Take care of shared configuration, aka conventions • Different plugins  From Micronaut Build Plugins (internal)  io.micronaut.build.internal.module : typical Micronaut module, with annotation processing enabled, published on Maven Central, etc.  io.micronaut.build.internal.bom: a “platform”, or BOM for Maven

Slide 12

Slide 12 text

Copyright © 2022, Oracle and/or its affiliates Demo: Writing a convention plugin

Slide 13

Slide 13 text

Gradle “convention plugins” Copyright © 2022, Oracle and/or its affiliates Root project: plugins { id("io.micronaut.build.internal.docs") id("io.micronaut.build.internal.quality-reporting") } Module: plugins { id("io.micronaut.build.internal.aot-project") } description = "Micronaut AOT API, for integration in build/CLI tools" dependencies { implementation(projects.aotCore) }

Slide 14

Slide 14 text

Gradle “convention plugins” Copyright © 2022, Oracle and/or its affiliates “Local” convention plugin: // build-logic/src/main/groovy/io.micronaut.build.internal.aot-project.gradle plugins { id "io.micronaut.build.internal.base-module" } micronautBuild { enableProcessing = false enableBom = false }

Slide 15

Slide 15 text

Gradle “convention plugins” Copyright © 2022, Oracle and/or its affiliates • For Maven users, think of “composite parent POMs” • Take care of shared configuration, aka conventions • Different plugins  From Micronaut Build Plugins (internal)  io.micronaut.build.internal.module : typical Micronaut module, with annotation processing enabled, published on Maven Central, etc.  io.micronaut.build.internal.bom: a “platform”, or BOM for Maven

Slide 16

Slide 16 text

Gradle task wiring Copyright © 2022, Oracle and/or its affiliates • Forget about Maven lifecycle • In Gradle, lifecycle is dynamic A task (compileJava, test, ...) inputs outputs https://melix.github.io/blog/2021/10/gradle-quickie-dependson.html https://melix.github.io/blog/2022/01/understanding-provider-api.html

Slide 17

Slide 17 text

Example: generating BOMs Copyright © 2022, Oracle and/or its affiliates

Slide 18

Slide 18 text

Gradle “convention plugins” Copyright © 2022, Oracle and/or its affiliates • Each project may declare specific modules

Slide 19

Slide 19 text

Gradle Entreprise : Build Scans Copyright © 2022, Oracle and/or its affiliates Visit https://ge.micronaut.io

Slide 20

Slide 20 text

Gradle Entreprise : Build Scans Copyright © 2022, Oracle and/or its affiliates Visit https://ge.micronaut.io

Slide 21

Slide 21 text

Gradle Enterprise: avoidance savings Copyright © 2022, Oracle and/or its affiliates

Slide 22

Slide 22 text

Gradle Entreprise : Build Cache Copyright © 2022, Oracle and/or its affiliates Visit https://ge.micronaut.io

Slide 23

Slide 23 text

Gradle Entreprise : Flaky Test Detection Copyright © 2022, Oracle and/or its affiliates Visit https://ge.micronaut.io

Slide 24

Slide 24 text

Gradle Enterprise: predictive test selection Copyright © 2022, Oracle and/or its affiliates

Slide 25

Slide 25 text

What about users? Copyright © 2022, Oracle and/or its affiliates • Gradle plugins are designed with the same composition model in mind ● io.micronaut.application = micronaut + application + docker + GraalVM ● io.micronaut.library = micronaut + library + docker + GraalVM ● io.micronaut.minimal.application = micronaut + application ● io.micronaut.minimal.library = micronaut + library • Declarative as much as possible

Slide 26

Slide 26 text

Copyright © 2022, Oracle and/or its affiliates 26 Thank you! Slides coming at @CedricChampeau