Android-components: Meta: Migrate to AndroidX libraries

Created on 31 Jan 2019  路  7Comments  路  Source: mozilla-mobile/android-components

Description

We want to migrate from support libraries to the new AndroidX libraries. That's where all the new features get implemented.

Switching requires a careful migration process where the downstream app projects will have to migrate first and then upstream libraries can follow. If one library switches to AndroidX it forces all its downstream consumers to make the switch too.

Downstream projects can use Jetifier to rewrite their dependencies using support libraries to use AndroidX instead (at build time). This allows apps to make the switch before all their dependencies have done that. While Jetifier is helpful for the migration it's also something we want to get rid of as soon as possible: It breaks gradle composite builds (which we really really want) and it has bugs.

A primary goal of this migration is to clear the path for Fenix / Reference Browser to Android Components to GeckoView and Application Services (without using Jetifier).

Step 1: Migrate app projects

P1

We should not migrate any libraries and force a migration until those projects have migrated first.

P2

Migrating those projects before migrating is a "nice-to-have" but this may not block starting to migrate upstream libraries.

P3

Those projects are either not actively developed or are not actively updating Android Components or are very light consumers of support libraries (e.g. React Native apps).

  • [ ] Notes by Firefox
  • [ ] Send by Firefox

Step 2: Migrate Android Components

Step 3: Migrate upstream libraries

  • [x] Migrate GeckoView to use AndroidX (Bug 1553459)
  • [ ] Migrate application-services libraries to use AndroidX

Step 4: Update third-party dependencies

Our projects (apps and libraries) may have third-party dependencies that depend on support libraries. In order to be able to get rid of Jetifier we will need to migrate to versions of those dependencies that use AndroidX. Multiple third-party libraries are either publishing two artifacts (support libraries / AndroidX) during the migration time or have published a new major version using AndroidX.

  • (TBD; This requires analyzing of our dependencies)
馃崁 meta

Most helpful comment

Interesting article:
https://proandroiddev.com/the-state-of-jetification-in-early-2019-plus-a-bonus-gradle-plugin-aac5854af910

This is a gradle plugin that can check the dependencies of a project and tell you if you can drop jetifier or if some dependencies still depend on the old support libraries. That should be helpful to determine what we are missing (Step 4 above).
https://github.com/plnice/can-i-drop-jetifier/

All 7 comments

Interesting article:
https://proandroiddev.com/the-state-of-jetification-in-early-2019-plus-a-bonus-gradle-plugin-aac5854af910

This is a gradle plugin that can check the dependencies of a project and tell you if you can drop jetifier or if some dependencies still depend on the old support libraries. That should be helpful to determine what we are missing (Step 4 above).
https://github.com/plnice/can-i-drop-jetifier/

Woot! I just read that jetifier has a reverse mode too:
https://ncorti.com/blog/jetifier-reverse

This means we could migrate and apps that do not want to migrate yet can use Jetifier reverse mode to continue to use the old support libraries. ... but:

From the article above:

Unfortunately, the reverse mode is not integrated into the Android Gradle Plugin and there is no property to set to enable it. The only way to run it is to use the standalone version.

Another funky option would be to:

  • Migrate AC to use AndroidX
  • Run reverse mode on the AAR before publishing.

Result:

  • The local checkout uses AndroidX and we can get one step closer to using Gradle composite builds
  • The shipping AARs still use the old support libraries.

It's risky to ship something else than what you build locally though.. :)

According to can-i-drop-jetifier only the GeckoView dependency requires jetifier. That would be nice!

Migration of Focus is in progress and migration of Firefox Lite is planned.

Follow-up to get rid of jetifier: #8459.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boek picture boek  路  3Comments

dnarcese picture dnarcese  路  3Comments

csadilek picture csadilek  路  3Comments

Mugurell picture Mugurell  路  5Comments

jonalmeida picture jonalmeida  路  4Comments