11// android/build.gradle
22
3- // based on:
4- //
5- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
6- // original location:
7- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
8- //
9- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
10- // original location:
11- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12-
133buildscript {
144 // The Android Gradle plugin is only required when opening the android folder stand-alone.
155 // This avoids unnecessary downloads and potential conflicts when the library is included as a
166 // module dependency in an application project.
17- // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
187 if (project == rootProject) {
198 repositories {
209 google()
@@ -26,11 +15,6 @@ buildscript {
2615 }
2716}
2817
29- plugins {
30- id(' com.android.library' )
31- id(' maven-publish' )
32- }
33-
3418def DEFAULT_COMPILE_SDK_VERSION = 28
3519def DEFAULT_BUILD_TOOLS_VERSION = ' 28.0.3'
3620def DEFAULT_MIN_SDK_VERSION = 18
@@ -40,9 +24,15 @@ def safeExtGet(prop, fallback) {
4024 rootProject. ext. has(prop) ? rootProject. ext. get(prop) : fallback
4125}
4226
27+ apply plugin : ' com.android.library'
28+ apply plugin : ' com.facebook.react'
29+
4330android {
4431 compileSdkVersion safeExtGet(' compileSdkVersion' , DEFAULT_COMPILE_SDK_VERSION )
4532 buildToolsVersion safeExtGet(' buildToolsVersion' , DEFAULT_BUILD_TOOLS_VERSION )
33+
34+ namespace " com.reactnativelauncharguments"
35+
4636 defaultConfig {
4737 minSdkVersion safeExtGet(' minSdkVersion' , DEFAULT_MIN_SDK_VERSION )
4838 targetSdkVersion safeExtGet(' targetSdkVersion' , DEFAULT_TARGET_SDK_VERSION )
@@ -55,7 +45,6 @@ android {
5545}
5646
5747repositories {
58- // ref: https://www.baeldung.com/maven-local-repository
5948 mavenLocal()
6049 maven {
6150 // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
@@ -66,68 +55,10 @@ repositories {
6655 url " $rootDir /../node_modules/jsc-android/dist"
6756 }
6857 google()
58+ mavenCentral()
6959}
7060
7161dependencies {
7262 // noinspection GradleDynamicVersion
73- implementation ' com.facebook.react:react-native:+' // From node_modules
74- }
75-
76- def configureReactNativePom (def pom ) {
77- def packageJson = new groovy.json.JsonSlurper (). parseText(file(' ../package.json' ). text)
78-
79- pom. project {
80- name packageJson. title
81- artifactId packageJson. name
82- version = packageJson. version
83- group = " com.reactnativelauncharguments"
84- description packageJson. description
85- url packageJson. repository. baseUrl
86-
87- licenses {
88- license {
89- name packageJson. license
90- url packageJson. repository. baseUrl + ' /blob/master/' + packageJson. licenseFilename
91- distribution ' repo'
92- }
93- }
94-
95- developers {
96- developer {
97- id packageJson. author. username
98- name packageJson. author. name
99- }
100- }
101- }
102- }
103-
104- afterEvaluate { project ->
105- // some Gradle build hooks ref:
106- // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
107- task androidSourcesJar(type : Jar ) {
108- archiveClassifier = ' sources'
109- from android. sourceSets. main. java. srcDirs
110- include ' **/*.java'
111- }
112-
113- android. libraryVariants. all { variant ->
114- def name = variant. name. capitalize()
115- def javaCompileTask = variant. javaCompileProvider. get()
116-
117- task " jar${ name} " (type : Jar , dependsOn : javaCompileTask) {
118- from javaCompileTask. destinationDir
119- }
120- }
121-
122- artifacts {
123- archives androidSourcesJar
124- }
125-
126- publishing {
127- publications {
128- maven(MavenPublication ) {
129- artifact androidSourcesJar
130- }
131- }
132- }
63+ implementation ' com.facebook.react:react-native:+'
13364}
0 commit comments