Code Monkey home page Code Monkey logo

jakarta-transformer-plugin's Introduction

JakartaTransformer Gradle plugin

Build Status

Plugin for integrating the JakartaTransformer tool into Gradle builds.

The main implemented case at the moment is that of "shadowing" (to play on the phrase "shade"). Basically this allows a project to apply this plugin, point to a dependency, have the plugin transform that dependency’s artifacts and present those transformed artifacts as the projects published artifacts.

E.g.

plugins {
    id 'base'
    id 'hibernate.jakarta-transformer'
}

ext {
    jpa = 'javax.persistence:javax.persistence-api:2.2'
    jta = 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec'

    jakartaJpa = 'jakarta.persistence:jakarta.persistence-api:3.0.0'
    jakartaJta = 'jakarta.transaction:jakarta.transaction-api:2.0.0'
}

dependencies {
    // Specifying the transformer's dependencies is optional.  0.2.0 is used by default
    jakartaTransformerTool(
            'org.eclipse.transformer:org.eclipse.transformer:0.2.0',
            'org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0'
    )
}

jakartaTransformation {
    renameRules rootProject.file( 'rules/jakarta-renames.properties' )
    versionRules rootProject.file( 'rules/jakarta-versions.properties' )
    directRules rootProject.file( 'rules/jakarta-direct.properties' )

    dependencyResolutions {
        dependencySubstitution {
            substitute module( project.jpa ) with module( project.jakartaJpa )
            substitute module( project.jta ) with module( project.jakartaJta )
        }
    }

    shadow( 'org.hibernate:hibernate-core:5.5.0.Alpha1' ) {
        runTests {
            useJUnitPlatform()
            ...
        }
        withSources()
        withJavadoc()
    }
}

This configuration will:

  1. Apply this plugin to a project :D

  2. Define the dependencies for the transformer tool (this is exposed to allow easier updating)

  3. Substitute dependencies as specified

  4. Apply shadowing to the hibernate-core JPA provider. The produced artifacts are named based on the shadow project’s dependency details (group, name, version).

  5. Present the transformed artifact(s) as this project’s published artifacts

I did try to https://github.com/eclipse/transformer/issues/146[contribute] this back to the upstream Jakarta project but
never got a reply, so I simply implement the requirements for the Hibernate projects.

For a more complete implementation, e.g., we would support "selections", "bundles" and other Transformer / JakartaTransformer
options.  However, this plugin simply supports the options needed for Hibernate builds.

jakarta-transformer-plugin's People

Contributors

sebersole avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.