Top Level Directory migration in DigitalMusicAndroid3P

Top Level Directory migration in DigitalMusicAndroid3P

On behalf of Native Foundations team, I want to inform you about an upcoming change in our React Native integration with DigitalMusicAndroid3P that will impact the top-level folder structure. We are making adjustments to enhance project organization and align it with React Native best practices.

Q: Why are we doing this change of top-level directory in Android?

By aligning with recommended conventions for React Native development, we can improve the consistency and maintainability of our codebase. The revised folder structure will enhance collaboration among developers and streamline future ReactNative integration.

├── build@ -> // no change
├── build-tools // no change
├── ...
├── gradle // no change
└── android
    ├── build.gradle (and other gradle files) // move from top-level directory
    ├── amplifyqueue // move from top-level directory
    ├── automotiveos // move from top-level directory
    ├── basequeue // move from top-level directory
    ├── buildSrc // move from top-level directory
    ├── libs // move from top-level directory
    └── src // move from top-level directory

See more at Pivoting Android’s ReactNative Dependency Management Approach and Intergration options for top-level folder structure for Android app

Q: Is there any similar change in iOS package?

Due to different React Native configurations between Android and iOS, this change only applies to the main Android package DigitalMusicAndroid3P. For example, Android build is using Peru and ReactNative dependencies are pulled from PeruNPM/Code Artifact with ReactNative Gradle plugin. In iOS pipeline, React Native dependencies are pulled from Brazil artifacts.

Q: Will git history be affected by this directory migration?

No. Git keeps track of file objects during moving/renaming file. Directory location information is stored separately in git tree objects. As long as no content is changed, git will retain the history of commits via git blame. If you want to get log of a specific file in a command line, please add —follow option to git log. For example

git blame android/src/main/java/com/amazon/mp3/featuregate/Feature.kt
git log --follow android/src/main/java/com/amazon/mp3/featuregate/Feature.kt

Q: Will this modify the output of generated build?

We have conducted testing with QA and verified the split build output apk paths are the same as before the migration.

Q: What is the best strategy to rebase feature branch with this new change in mainline?

This change will introduce to mainline on May 29th 2023. Please update any feature branch with mainline as soon as possible to avoid any conflict. There are 2 available options:

  • Rebase your branch: we recommend rebasing it onto the latest mainline branch after 29th May. Please note that if there is a new file in the feature branch, you should double-check the file location and manually copy it to the Android directory if it is missing. Please ensure that there will be no “src” folder at the top-level directory eventually.

  • Create a new branch based on mainline and cherry-pick your commits over: make sure to pull the latest changes after 29th May and perform a clean build after updating.

Please remind that the recommended approach from our team is Mainline-based Branching Strategy for Mobile Clients