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

Improved Gradle setup #17

Merged
merged 1 commit into from
Apr 29, 2020
Merged

Improved Gradle setup #17

merged 1 commit into from
Apr 29, 2020

Conversation

SaeedZhiany
Copy link
Contributor

  • 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.

  • removed unnecessary buildToolsVersion specification

in newer versions of Android Gradle Plugin, it's no longer needed to specify buildToolsVersion the plugin itself will peek the correct version automatically.

  • extracted duplicated default versions extraction from the root project Gradle setup into a function

it's a common between RN libraries to use auxiliary function safeExtGet to get rid the duplicated codes for extracting versions from the root project'S Gradle setup

Load Android Gradle Plugin conditionally
removed unnecessary buildToolsVersion specification
extracted duplicated default versions extraction from the root project Gradle setup into a function
@SaeedZhiany
Copy link
Contributor Author

@faizalshap

please review and merge this.

Thanks

@faizalshap faizalshap merged commit 10dc729 into faizalshap:master Apr 29, 2020
@SaeedZhiany SaeedZhiany deleted the patch-1 branch April 29, 2020 03:32
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.

2 participants