Slide 1

Slide 1 text

Fast and reliable builds with Gradle and Maven Marc Philipp (@marcphilipp), Gradle Inc. 1

Slide 2

Slide 2 text

About me speaker { name = "Marc Philipp" home = "Karlsruhe, Germany" company = "Gradle Inc." title = "Senior Software Engineer" openSourceRoles = [ "JUnit team lead" ] twitter = "@marcphilipp" github = "marcphilipp" web = uri("https://www.marcphilipp.de") } 2 . 1

Slide 3

Slide 3 text

Gradle Inc. Build Happiness Products Gradle Build Tool Gradle Enterprise 2 . 2

Slide 4

Slide 4 text

How do builds affect developer produc vity? failures: about 20% of builds fail due to code defects 5‑10% of a team’s capacity is spent on fixing slowness: a team’s capacity is reduced by 4% for each extra minute of build me unreliability: 5% of a team’s capacity goes into debugging build problems 2 . 3

Slide 5

Slide 5 text

Fast builds 3 . 1

Slide 6

Slide 6 text

Fast builds faster = avoid doing needless work reuse results! incremental builds build cache 3 . 2

Slide 7

Slide 7 text

Incremental builds Gradle Maven 3 . 3

Slide 8

Slide 8 text

Incremental builds Gradle can reuse results of the last me this build ran on this machine. 3 . 4

Slide 9

Slide 9 text

We can do be er! 3 . 5

Slide 10

Slide 10 text

Why not… of any me and any build that ran anywhere. 3 . 6

Slide 11

Slide 11 text

Even be er For Maven and Gradle builds! 3 . 7

Slide 12

Slide 12 text

3 . 8

Slide 13

Slide 13 text

Build Cache for Gradle $> gradle ­­build­cache assemble :compileJava FROM­CACHE :processResources :classes :jar :assemble BUILD SUCCESSFUL 3 . 9

Slide 14

Slide 14 text

Build Cache for Gradle out‑of‑the‑box for Java, Groovy, Scala, C++ and Swi projects supports compile, test and verifica on tasks high‑performance remote backend from Gradle Docker Hub: gradle/build‑cache‑node 3 . 10

Slide 15

Slide 15 text

Build Cache for Maven custom extension (part of Gradle Enterprise) ini al release: March 2019 supported plugins: Java Compiler, Surefire/Failsafe, Javadoc, JAXB, Checkstyle 3 . 11

Slide 16

Slide 16 text

Build Cache – Demo 3 . 12

Slide 17

Slide 17 text

How does it work? Calculate cacheKey of a task/goal from its inputs: cacheKey(javaCompile) = hash(sourceFiles, … ) Store its outputs under cacheEntry: cacheEntry(javaCompile) = fileTree(classFiles) Gradle task Inputs Outputs 3 . 13

Slide 18

Slide 18 text

Local and remote cache 3 . 14

Slide 19

Slide 19 text

3 . 15

Slide 20

Slide 20 text

3 . 16

Slide 21

Slide 21 text

3 . 17

Slide 22

Slide 22 text

3 . 18

Slide 23

Slide 23 text

3 . 19

Slide 24

Slide 24 text

3 . 20

Slide 25

Slide 25 text

3 . 21

Slide 26

Slide 26 text

3 . 22

Slide 27

Slide 27 text

3 . 23

Slide 28

Slide 28 text

3 . 24

Slide 29

Slide 29 text

Reliable builds 4 . 1

Slide 30

Slide 30 text

Requirements monitoring of builds to discover regressions/improvements both builds by developers and CI reliability performance 4 . 2

Slide 31

Slide 31 text

What are Build Scans? persistent record of what happened during a build permanent and shareable URL for developers and build engineers 4 . 3

Slide 32

Slide 32 text

Gradle $> gradle build ­­scan ... BUILD SUCCESSFUL in 8m 22s 418 actionable tasks: 112 executed, 48 from cache, 258 up­ Publishing build scan... https://scans.gradle.com/s/lbmn7n4dngqgq 4 . 4

Slide 33

Slide 33 text

Maven (with extension registered in .mvn/extensions.xml) $> mvn clean verify ... [INFO] ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ [INFO] BUILD SUCCESS [INFO] ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ [INFO] Total time: 5.262 s [INFO] Finished at: 2019­04­23T09:55:36+02:00 [INFO] ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ [INFO] 13 goals, 8 executed, 5 from cache, saving at least [INFO] [INFO] Publishing build scan... [INFO] https://gradle.com/s/ypgljbvelzxzs [INFO] 4 . 5

Slide 34

Slide 34 text

Build Scans – Demo 4 . 6

Slide 35

Slide 35 text

Build Scans support Gradle and Maven public scans are free on without build comparison, performance dashboard etc. Gradle Enterprise provides addi onal features and on‑premise hos ng scans.gradle.com h ps:/ /scans.gradle.com/s/nq7w6cjm72mak/ 4 . 7

Slide 36

Slide 36 text

Custom analyses use Export API h ps:/ /github.com/gradle/build‑analysis‑demo 4 . 8

Slide 37

Slide 37 text

4 . 9

Slide 38

Slide 38 text

4 . 10

Slide 39

Slide 39 text

Resources Free trainings on , e.g. Build Cache Deep Dive Maven + Gradle Enterprise Gradle Build Tool: Gradle Enterprise: h ps:/ /gradle.com/training/ YouTube channel h ps:/ /gradle.org h ps:/ /gradle.com 5 . 1

Slide 40

Slide 40 text

Дякую! See you tomorrow? 5 From Revolu on to Con nuous Evolu on Tomorrow, 16:10, Track C News from JUnit 5.x 5 . 2