devoxxfr2016-jigsaw-gradle



devoxxfr2016-jigsaw-gradle

0 0


devoxxfr2016-jigsaw-gradle


On Github melix / devoxxfr2016-jigsaw-gradle

Résoudre le puzzle Jigsaw avec Gradle

Cédric Champeau (@CedricChampeau), Gradle Inc.

Who am I

speaker {
    name 'Cédric Champeau'
    company 'Gradle Inc'
    oss 'Apache Groovy committer',
    successes 'Static type checker',
                    'Static compilation',
                    'Traits',
                    'Markup template engine',
                    'DSLs'
        failures Stream.of(bugs),
        twitter '@CedricChampeau',
        github 'melix',
        extraDescription '''Groovy in Action 2 co-author
Misc OSS contribs (Gradle plugins, deck2pdf, jlangdetect, ...)'''
}

Groovy in Action 2

Coupon: ctwdevoxxfr

What is Gradle?

Emerge from Build Hell

  • Unified, fast, reproducible builds

  • Cross-platform

  • Language agnostic

Project Jigsaw

  • Modularity for the Java platform

    • Reliable configuration (goodbye classpath)

    • Strong encapsulation (goodbye com.sun)

  • Enforce strict boundaries between modules

    • compile-time

    • run-time

Jigsaw modules

Declaring a module

module-info.java
module com.foo.bar {
    requires org.baz.qux;
    exports com.foo.bar.alpha;
    exports com.foo.bar.beta;
}

A module

  • Declares dependencies onto other modules

    • optionally transitive (public)

  • Declares a list of packages it exports

  • will be found on modulepath

Why it’s going to break your apps

  • Exports are package based

  • A non-exported package is not visible to consumers

  • 2 modules cannot export the same packages

  • 2 modules cannot have the same internal packages

Death to split packages.

How Gradle will help?

  • Find a smooth migration path

  • Prepare today, migrate when ready

Gradle’s software model

  • Idea : we’re building software, so let’s model software

  • Describe what rather than how

  • Leverage conventions

  • Work in progress

A simple project

Internal APIs

Internal APIs maintenance nightmare

Declaring internal APIs

Compile avoidance

Compile avoidance benefits

  • Doesn’t recompile dependents if:

    • method body changes

    • parameter names change

    • method order changes

    • private method added/removed

  • In short: if API stable, do nothing

Declaring target platforms

Why does Gradle help?

  • Add targetPlatform 'java9'

  • Generate module descriptor automatically?

  • Profit!

Trying it out

What’s next?

  • Automatic toolchain selection

  • Support for modulepath

  • Support for jimage and jlink

  • Support for modulepath

  • Toolchain provisioning

Be involved

Questions

We’re hiring!

Thank you!

0