Skip to content

About

OpenRewrite recipes maintained by third parties.

Resources

Contributing

Stars

2 stars

Watchers

4 watching

Forks

Repository files navigation

OpenRewrite Logo

rewrite-third-party

ci Apache 2.0 Revved up by Develocity Contributing Guide

What is this?

This project implements a Rewrite module that bundles OpenRewrite recipes maintained by third parties. These recipes are not maintained by the OpenRewrite team, but are still useful for migrating codebases.

Updating the @InlineMe recipes in rewrite-migrate-java and rewrite-logging-frameworks

InlineMethodCallsRecipeGenerator turns the @InlineMe annotations found in the type tables into an InlineMethodCalls recipe list. The generated YAML is not shipped from here, but copied into the module that owns those recipes: rewrite-migrate-java for Guava, and rewrite-logging-frameworks for Log4j API. Claude Code runs the steps below, through to the PRs, with the update-inline-recipes skill.

  1. Refresh the type tables, such that the + versions in recipeDependencies resolve to the latest releases.
    ./gradlew createTypeTable createTestTypeTable --refresh-dependencies
    Commit both src/main/resources/META-INF/rewrite/classpath.tsv.gz and src/test/resources/META-INF/rewrite/classpath.tsv.gz; parserClasspath artifacts land in the first, testParserClasspath artifacts in the second.
  2. Generate the recipes, which prints how many were found for each artifact.
    ./gradlew generateInlineGuavaMethods generateInlineLog4jMethods
    Each task writes the file under build/generated/META-INF/rewrite/ with the name it has in its target repository, and a header naming the exact version the method patterns were generated from. The next regeneration overwrites the whole file, so put what only one target needs, like a precondition, in a hand-written recipe there that lists the generated one.
  3. Copy the generated file into the target repository.
    cp build/generated/META-INF/rewrite/inline-guava-33-methods.yml \
      ../rewrite-migrate-java/src/main/resources/META-INF/rewrite/
  4. There, pin parserClasspath to the version named in the header of the generated file, and run ./gradlew createTypeTable --refresh-dependencies, such that the classpathFromResources entries resolve against the version the method patterns were generated from.
  5. Finish with ./gradlew licenseFormat to add the license header the generated file lacks, and ./gradlew recipeCsvGenerate to update the recipe count in recipes.csv.

Contributing

We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.

About

OpenRewrite recipes maintained by third parties.

Resources

Contributing

Stars

2 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages