|
1 | | -### React Native Brownfield Gradle Plugin |
| 1 | +# React Native Brownfield Gradle Plugin |
| 2 | + |
| 3 | + |
| 4 | + |
2 | 5 |
|
3 | 6 | This plugin helps you convert your react-native brownfield implementation into a fat Aar. |
4 | 7 |
|
5 | | -#### Installation |
| 8 | +## Installation |
6 | 9 |
|
7 | | -##### From Remote |
| 10 | +### From Remote |
8 | 11 |
|
9 | | -- TBA |
| 12 | +To your top level `build.gradle` add |
10 | 13 |
|
11 | | -##### From Local |
| 14 | +```diff |
| 15 | +buildscript { |
| 16 | + repositories { |
| 17 | + google() |
| 18 | + mavenCentral() |
| 19 | + } |
| 20 | + dependencies { |
| 21 | + classpath("com.android.tools.build:gradle") |
| 22 | + classpath("com.facebook.react:react-native-gradle-plugin") |
| 23 | + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") |
| 24 | ++ classpath("com.callstack.react:brownfield:0.3.0") |
| 25 | + } |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +To your brownfield project level `build.gradle.kts` add |
| 30 | + |
| 31 | +```diff |
| 32 | + plugins { |
| 33 | + id("com.android.library") |
| 34 | + id("org.jetbrains.kotlin.android") |
| 35 | ++ id("com.callstack.react.brownfield") |
| 36 | + `maven-publish` |
| 37 | + id("com.facebook.react") |
| 38 | + } |
| 39 | +react { |
| 40 | + autolinkLibrariesWithApp() |
| 41 | + } |
| 42 | + |
| 43 | + val appProject = project(":app") |
| 44 | +``` |
| 45 | + |
| 46 | +### From Local |
12 | 47 |
|
13 | 48 | - From the root of this repository, run `yarn brownfield:plugin:publish:local` and it will publish the plugin to your local maven |
14 | | -- Then add the following patch to your react-native brownfield `build.gradle` files: |
| 49 | + |
| 50 | +To your top level `build.gradle` add |
15 | 51 |
|
16 | 52 | ```diff |
17 | | -diff --git a/android/build.gradle b/android/build.gradle |
18 | | -index 3dd1ac9..0db4ded 100644 |
19 | | ---- a/android/build.gradle |
20 | | -+++ b/android/build.gradle |
21 | | -@@ -16,6 +16,7 @@ buildscript { |
22 | | - } |
23 | | -+ mavenLocal() |
24 | | - google() |
25 | | - mavenCentral() |
26 | | - } |
27 | | -@@ -23,7 +24,7 @@ buildscript { |
28 | | - classpath("com.android.tools.build:gradle") |
29 | | - classpath("com.facebook.react:react-native-gradle-plugin") |
30 | | - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") |
31 | | -+ classpath("com.callstack.react:brownfield:0.1.0") |
32 | | - } |
33 | | - } |
| 53 | +buildscript { |
| 54 | + repositories { |
| 55 | ++ mavenLocal() |
| 56 | + google() |
| 57 | + mavenCentral() |
| 58 | + } |
| 59 | + dependencies { |
| 60 | + classpath("com.android.tools.build:gradle") |
| 61 | + classpath("com.facebook.react:react-native-gradle-plugin") |
| 62 | + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") |
| 63 | ++ classpath("com.callstack.react:brownfield:0.3.0") |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +To your brownfield project level `build.gradle.kts` add |
34 | 69 |
|
35 | | -diff --git a/android/rnbrownfield/build.gradle.kts b/android/rnbrownfield/build.gradle.kts |
36 | | -index b915003..e387075 100644 |
37 | | ---- a/android/rnbrownfield/build.gradle.kts |
38 | | -+++ b/android/rnbrownfield/build.gradle.kts |
39 | | -@@ -1,7 +1,7 @@ |
| 70 | +```diff |
40 | 71 | plugins { |
41 | 72 | id("com.android.library") |
42 | 73 | id("org.jetbrains.kotlin.android") |
43 | 74 | + id("com.callstack.react.brownfield") |
44 | 75 | `maven-publish` |
45 | 76 | id("com.facebook.react") |
46 | 77 | } |
47 | | -@@ -10,8 +10,8 @@ react { |
| 78 | +react { |
48 | 79 | autolinkLibrariesWithApp() |
49 | 80 | } |
50 | 81 |
|
51 | 82 | val appProject = project(":app") |
52 | 83 | ``` |
53 | 84 |
|
54 | | -#### API Usage |
| 85 | +## API Usage |
55 | 86 |
|
56 | 87 | - **About Dependencies** |
57 | 88 |
|
@@ -101,13 +132,13 @@ dependencies { |
101 | 132 |
|
102 | 133 | <hr/> |
103 | 134 |
|
104 | | -#### Tooling |
| 135 | +## Tooling |
105 | 136 |
|
106 | 137 | - We are using `ktlint` and `detekt` for formatting and linting |
107 | 138 | - You can run `./gradlew :brownfield:lint` to auto-format and detect linting issues |
108 | 139 |
|
109 | 140 |
|
110 | | -#### Architecture |
| 141 | +## Architecture |
111 | 142 |
|
112 | 143 | Below is a flow diagram of how the files are being used in this gradle plugin from an overview: |
113 | 144 |
|
|
0 commit comments