Skip to content

Conversation

szymonrybczak
Copy link
Collaborator

Summary:

By using ctx.project.android?.sourceDir clean command will work when Android project is under different path.

Test Plan:

  1. Clone the repository and do all the required steps from the Contributing guide
  2. Change android folder name and specify in react-native.config.js new path.
  3. Run this command:
node /path/to/react-native-cli/packages/cli/build/bin.js clean

Choose android cache to clean, and command should be executed in correct place.

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

@szymonrybczak
Copy link
Collaborator Author

While creating this PR I find out that we're not dynamically finding Android project if it doesn't exists under default path:

export default function findAndroidDir(root: string) {
if (fs.existsSync(path.join(root, 'android'))) {
return 'android';
}
return null;
}

(in iOS part we're looking for Podfile and base on this location we're assuming iOS project location), should we do the same for Android? cc. @tido64 @cortinico If yes, what files should we look at?

@tido64
Copy link
Contributor

tido64 commented Nov 6, 2023

(in iOS part we're looking for Podfile and base on this location we're assuming iOS project location), should we do the same for Android? cc. @tido64 @cortinico If yes, what files should we look at?

build.gradle is a good file to look for. @cortinico correct me if I'm wrong. I wouldn't look too deep for it though, you'll just risk false positives. In the repositories I have been in, I've only seen /android/build.gradle or /build.gradle.

@szymonrybczak szymonrybczak merged commit c847b3a into main Nov 6, 2023
@szymonrybczak szymonrybczak deleted the fix/remove-hardcoded-android-path branch November 6, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants