Skip to content

Support Jetpack's jettifier, for deps/bytecode rewriting. #87

@cgruber

Description

@cgruber

Jetpack comes with a tool, deeply integrated into Gradle, called Jettifier. The net effect of the integration is that if you have this deps chain: your_lib -> third-party-lib -> android_support_lib a few things happen:

  1. You start using androix_support_libs instead in your direct deps.
  2. You start using the newer equivalent APIs in your code.
  3. You enable Jettifier, which:
    1. rewrites any deps on the older android_support_libs artifacts to the newer androidx ones transparently, inside gradle, intercepting the normal deps resolution logic.
    2. takes any artifacts and rewrites their code references in the bytecode to point at the new apis supplied by androidx/jetpack.

There is a standalone tool (jettifier_standalone) which can do the jar rewriting, and there is a published list of equivalencies which the tool honors, which can be consumed by any deps management. But the bazel_maven_repository rules are in the ecological niche of gradle's deps management here, so we need a feature to do the jetpack-required deps rewriting (probably taking in the file they publish, since a universal rewriting feature is probably useful, and can be useful for large-scale replacement of other kinds, without particularly extra work. However, the big deal will be incorporating the jettifier tool so that, if enabled, it will post-process downloaded jars appropriately.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions