openrewrite / rewrite-android

OpenRewrite recipes for Android
Apache License 2.0
1 stars 2 forks source link

Add initial Android SDK upgrade recipes #1

Closed timtebeek closed 2 weeks ago

timtebeek commented 1 month ago

What problem are you trying to solve?

Provide a skeleton structure for recipes that migrate folks between various Android versions.

There's a few helpful first steps and useful resources we can pull from to provide a first couple steps, and then fill out more details in separate issues and pull requests.

What precondition(s) should be checked before applying this recipe?

AGP used.

Describe the situation before applying the recipe

android {
    compileSdk 34
    ...
    defaultConfig {
        targetSdk 34
    }
}

Describe the situation after applying the recipe

android {
    compileSdk 35
    ...
    defaultConfig {
        targetSdk 35
    }
}

Any additional context

The Android SDK docs provide a helpful reference of changes between Android versions; in particular the Removals are good to see:

There's also the next announced deprecations per version:

In addition to the API differences, there's also instructions to upgrading the SDK & AGP:

adityabad commented 1 month ago

Hello @timtebeek Could I offer some help here?

timtebeek commented 1 month ago

Hello @timtebeek Could I offer some help here?

Hi! Yes sure, welcome to contribute! I've added a rough skeleton; from there it's a matter of defining a first few steps to adopt newer SDK API versions. Perhaps there's a few good one-to-one replacements you know of that could be implemented as a declarative recipe? Feel free to open a draft pull request with the changes you've identified, and then we'll take it from there.

adityabad commented 1 month ago

Thanks!! on it

adityabad commented 1 month ago

Hello @timtebeek .Here is a draft PR to understand if I am in the right direction. Please check and let me know

timtebeek commented 1 month ago

Hello @timtebeek .Here is a draft PR to understand if I am in the right direction. Please check and let me know

Did you mean to include a link? I'm not seeing any draft PR or fork under your GitHub account.

adityabad commented 1 month ago

yes i was supposed to attach the link. https://github.com/elastic/elasticsearch/pull/112883 @timtebeek

timtebeek commented 1 month ago

yes i was supposed to attach the link. elastic/elasticsearch#112883 @timtebeek

I don't think that's quite right. Please join our OSS Slack to discuss your approach before going forward.

timtebeek commented 1 month ago

I've added a recipe to change the SDK version in build.gradle files already

We can keep this issue open to gather further ideas for recipes that can hook into this framework of migration recipes.

jjkester commented 1 month ago

The Android SDK is quite a complex beast when it comes to versioning:

These are relatively simple to model (I am working on a PR for that).

Besides that:

Android Studio has migrations and hits for that built-in, not sure if these are documented somewhere (exhaustively) and/or this code can be leveraged.

timtebeek commented 2 weeks ago

With https://github.com/openrewrite/rewrite-android/pull/3 merged I think we have enough of a basic structure covered that can be extended by folks looking to add specific migrations. Anyone is welcome to log additional issues or open up a draft pull request with desired migration steps.