Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip/tbd] remove Android Gradle tools reference #129

Closed
wants to merge 1 commit into from

Conversation

brodycj
Copy link
Owner

@brodycj brodycj commented Sep 16, 2019

from the generated code in android/build.gradle

in order to avoid multiple Android build tools Gradle plugin versions in React Native projects

as discussed in react-native-community/discussions-and-proposals#151

This is a quick fix approach that may be considered a little controversial since would completely disable Android Studio support (see #120). In general, I would recommend that people generate with the example and then open the example project with Android Studio (see #120 (comment)).

Some proposals linked by react-native-community/discussions-and-proposals#151 (comment) seem to fix Android Studio support in some other projects. I am not so happy about adding a committed Gradle JAR artifact or any other big Gradle artifacts that may be needed. Could be an interesting option.

It may be possible to fix Android Studio support by using Yarn workspaces (see #128).

/cc @SaeedZhiany

from the generated code in `android/build.gradle`

in order to avoid multiple Android build tools Gradle plugin versions
in React Native projects

as discussed in react-native-community/discussions-and-proposals#151
@SaeedZhiany
Copy link
Contributor

If I understood correctly from that PRs, @dulmandakh says that gradle files can be moved to root directory of a module, so the maintainers can develop their module just like before, but they have to open the root directory of the module instead of the android directory, everything should be the same as before for the maintainers. as a result when other users get the module from npm or yarn,
the module's gradle file will not be used and automatically all modules use main project AGP.

I am not so happy about adding a committed Gradle JAR artifact or any other big Gradle artifacts that may be needed.

I've taken a look at your changes, it seems you only removed the buildscript sections from all files and not added any gradle related config file in the root directory of the module template, so I'm not sure if it's a correct way, because in all that @dulmandakh's PRs he moved the configs to the root directory not just removing them.
Honestly, I don't figure out exactly how we should apply @dulmandakh's approach yet, so I can't help on this one these days, I need to some free times to getting deep on Gradle system. maybe @dulmandakh can help.

@friederbluemle
Copy link
Contributor

friederbluemle commented Sep 17, 2019

I'm not sure if this is the best approach. As mentioned, by removing the Android Gradle plugin from the template the projects are no longer "self-sustaining": Without a separate project, it is no longer possible to open or build the project in Android Studio or on the command line.

@brodybits

I am not so happy about adding a committed Gradle JAR artifact or any other big Gradle artifacts that may be needed

Yes, completely agree with you - The only Gradle wrapper jar (including related gradlew script files) that should be added to source control is the one in the android subfolder of a RN application project. These files should not be in source control (or packed in npm) for RN native modules. Note that even without these files, it is still possible to open the folder in Android Studio, which will autogenerate these files.

@SaeedZhiany
Copy link
Contributor

it is no longer possible to open or build the project in Android Studio or on the command line.

According to @dulmandakh statements in this comment, it still possible to open and maintain a project using android studio, maintainers should open the project from the module's root project instead of android folder.

@friederbluemle
Copy link
Contributor

@SaeedZhiany - Yes, that's correct, both solutions would still allow the project to be edited in Android Studio. Both would equally solve the main problem (unnecessary downloads of/conflicts with older Android Gradle plugin distributions), while the if (project == rootProject) solution will in addition keep all things Android in the android folder (as it was before).
I opened a PR in this repo here: #135
Please have a look @brodybits 👍

@brodycj brodycj changed the title [...] remove Android Gradle tools reference [wip/tbd] remove Android Gradle tools reference Sep 18, 2019
@brodycj
Copy link
Owner Author

brodycj commented Sep 18, 2019

Now closing this proposal as rejected. Thanks @friederbluemle.

@SaeedZhiany
Copy link
Contributor

@friederbluemle
yeah, your solution so amazing and I love that. I will also open a few PRs on the libraries I'm using to fix their Gradle file.

Thank you for your great contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants