Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

fix(android,build): load Android Gradle Plugin conditionally #4

Merged
merged 1 commit into from
Jan 27, 2020
Merged

fix(android,build): load Android Gradle Plugin conditionally #4

merged 1 commit into from
Jan 27, 2020

Conversation

SaeedZhiany
Copy link
Contributor

@SaeedZhiany SaeedZhiany commented Jan 27, 2020

  • Load Android Gradle Plugin conditionally

This wraps the Android Gradle plugin dependency in the buildscripts section of android/build.gradle in a conditional:

if (project == rootProject) {
    // ... (dependency here)
}

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

for more info, you can refer to this thread and especially this comment.

  • get project default ext configs from the root project

@SaeedZhiany SaeedZhiany requested a review from Salakar January 27, 2020 15:42
@Salakar
Copy link
Contributor

Salakar commented Jan 27, 2020

Hey @SaeedZhiany

Thanks for this, am happy to merge the conditional logic for the gradle plugin.

Could you remove the safeExtGet stuff though - its not required as this functionality is already supported through https://github.com/invertase/react-native-gradle-plugin :
image

I can do a release with this in soon after its ready to merge

@SaeedZhiany
Copy link
Contributor Author

Hey @Salakar

Oh, I didn't know that, I'll revert it.

do you want to keep buildToolVersion up to date at version 29.0.2? I know it's commented but it's worth keeping it updated.

@Salakar
Copy link
Contributor

Salakar commented Jan 27, 2020

do you want to keep buildToolVersion up to date at version 29.0.2? I know it's commented but it's worth keeping it updated.

Ok lets keep it on the latest 👍

- Load Android Gradle Plugin conditionally
- get project default ext configs from the root project
@SaeedZhiany
Copy link
Contributor Author

It's done.

@claassistantio
Copy link

claassistantio commented Jan 27, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love these PRs, slowly de-duplicating the gradle runtimes and eventually my react-native builds will stop downloading new gradles from random modules while building...

@Salakar
Copy link
Contributor

Salakar commented Jan 27, 2020

It's done.

Awesome, thank you! Just the CLA left and I'll sort a release

@SaeedZhiany
Copy link
Contributor Author

Just the CLA left and I'll sort a release

It's also done.

@Salakar Salakar changed the title Fixed Gradle setup fix(android,build): load Android Gradle Plugin conditionally Jan 27, 2020
@Salakar Salakar merged commit 30d56fc into invertase:master Jan 27, 2020
@SaeedZhiany SaeedZhiany deleted the patch-1 branch January 27, 2020 16:21
@Salakar
Copy link
Contributor

Salakar commented Jan 27, 2020

v0.0.4 up with this, thank you 🎉

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

Successfully merging this pull request may close these issues.

4 participants