11buildscript {
2- ext. safeExtGet = {prop , fallback ->
3- rootProject. ext. has(prop) ? rootProject. ext. get(prop) : fallback
4- }
5- repositories {
6- google()
7- mavenCentral()
8- }
2+ ext. getExtOrDefault = {name ->
3+ return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[' A0Auth0_' + name]
4+ }
95
10- dependencies {
11- // Matches recent template from React Native (0.67)
12- // https://github.com/facebook/react-native/blob/0.67-stable/template/android/build.gradle#L16
13- classpath(" com.android.tools.build:gradle:${ safeExtGet('gradlePluginVersion', '4.2.2')} " )
14- }
6+ repositories {
7+ google()
8+ mavenCentral()
9+ }
10+
11+ dependencies {
12+ classpath " com.android.tools.build:gradle:8.7.2"
13+ // noinspection DifferentKotlinGradleVersion
14+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:${ getExtOrDefault('kotlinVersion')} "
15+ }
1516}
1617
1718def reactNativeArchitectures () {
@@ -23,38 +24,45 @@ def isNewArchitectureEnabled() {
2324 return rootProject. hasProperty(" newArchEnabled" ) && rootProject. getProperty(" newArchEnabled" ) == " true"
2425}
2526
26- apply plugin : ' com.android.library'
27- apply plugin : ' maven-publish '
27+ apply plugin : " com.android.library"
28+ apply plugin : " kotlin-android "
2829
2930if (isNewArchitectureEnabled()) {
3031 apply plugin : " com.facebook.react"
3132}
3233
33- // Matches values in recent template from React Native 0.62
34- // https://github.com/facebook/react-native/blob/0.62-stable/template/android/build.gradle#L5-L8
35- def DEFAULT_COMPILE_SDK_VERSION = 34
36- def DEFAULT_BUILD_TOOLS_VERSION = " 28.0.3"
37- def DEFAULT_MIN_SDK_VERSION = 16
38- def DEFAULT_TARGET_SDK_VERSION = 34
34+ def getExtOrIntegerDefault (name ) {
35+ return rootProject. ext. has(name) ? rootProject. ext. get(name) : (project. properties[" A0Auth0_" + name]). toInteger()
36+ }
3937
4038android {
41- compileSdkVersion safeExtGet( ' compileSdkVersion ' , DEFAULT_COMPILE_SDK_VERSION )
42- buildToolsVersion safeExtGet( ' buildToolsVersion ' , DEFAULT_BUILD_TOOLS_VERSION )
43- namespace ' com.auth0.react '
39+ namespace " com.auth0.react "
40+
41+ compileSdkVersion getExtOrIntegerDefault( " compileSdkVersion " )
4442
4543 defaultConfig {
46- minSdkVersion safeExtGet( ' minSdkVersion' , DEFAULT_MIN_SDK_VERSION )
47- targetSdkVersion safeExtGet( ' targetSdkVersion' , DEFAULT_TARGET_SDK_VERSION )
44+ minSdkVersion getExtOrIntegerDefault( " minSdkVersion" )
45+ targetSdkVersion getExtOrIntegerDefault( " targetSdkVersion" )
4846 buildConfigField(" boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString())
4947 versionCode 1
5048 versionName " 1.0"
5149 }
52- lintOptions {
53- abortOnError false
54- }
50+
5551 buildFeatures {
5652 buildConfig true
5753 }
54+
55+ buildTypes {
56+ release {
57+ minifyEnabled false
58+ }
59+ }
60+
61+ lintOptions {
62+ disable " GradleCompatible"
63+ abortOnError false
64+ }
65+
5866 compileOptions {
5967 sourceCompatibility JavaVersion . VERSION_1_8
6068 targetCompatibility JavaVersion . VERSION_1_8
@@ -74,89 +82,21 @@ android {
7482}
7583
7684repositories {
77- maven {
78- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
79- // Matches recent template from React Native 0.62
80- // https://github.com/facebook/react-native/blob/0.62-stable/template/android/build.gradle#L27
81- url " $projectDir /../node_modules/react-native/android"
82- }
83- mavenCentral()
84- }
85-
86- dependencies {
87- implementation " com.facebook.react:react-native:${ safeExtGet('reactnativeVersion', '+')} "
88- implementation " androidx.browser:browser:1.2.0"
89- implementation ' com.auth0.android:auth0:3.2.1'
90- }
91-
92- def configureReactNativePom (def pom ) {
93- def packageJson = new groovy.json.JsonSlurper (). parseText(file(' ../package.json' ). text)
94-
95- pom. project {
96- name packageJson. title
97- artifactId packageJson. name
98- version = packageJson. version
99- group = " com.auth0.react"
100- description packageJson. description
101- url packageJson. repository. baseUrl
102-
103- licenses {
104- license {
105- name packageJson. license
106- url packageJson. repository. baseUrl + ' /blob/master/' + packageJson. licenseFilename
107- distribution ' repo'
108- }
109- }
110-
111- developers {
112- developer {
113- id packageJson. author. username
114- name packageJson. author. name
115- }
116- }
117- }
85+ mavenCentral()
86+ google()
87+ maven {
88+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
89+ url " $projectDir /../node_modules/react-native/android"
90+ }
11891}
11992
120- afterEvaluate { project ->
121-
122- task androidJavadoc(type : Javadoc ) {
123- source = android. sourceSets. main. java. srcDirs
124- classpath + = files(android. bootClasspath)
125- include ' **/*.java'
126- }
127-
128- task androidJavadocJar(type : Jar , dependsOn : androidJavadoc) {
129- archiveClassifier = ' javadoc'
130- from androidJavadoc. destinationDir
131- }
132-
133- task androidSourcesJar(type : Jar ) {
134- archiveClassifier = ' sources'
135- from android. sourceSets. main. java. srcDirs
136- include ' **/*.java'
137- }
138-
139- android. libraryVariants. all { variant ->
140- def name = variant. name. capitalize()
141- def javaCompileTask = variant. javaCompileProvider. get()
93+ def kotlin_version = getExtOrDefault(" kotlinVersion" )
14294
143- task " jar${ name} " (type : Jar , dependsOn : javaCompileTask) {
144- from javaCompileTask. destinationDir
145- }
146- }
147-
148- artifacts {
149- archives androidSourcesJar
150- archives androidJavadocJar
151- }
152-
153- publishing {
154- publications {
155- maven(MavenPublication ) {
156- artifact androidSourcesJar
157- }
158- }
159- }
95+ dependencies {
96+ implementation " com.facebook.react:react-android"
97+ implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
98+ implementation " androidx.browser:browser:1.2.0"
99+ implementation ' com.auth0.android:auth0:3.2.1'
160100}
161101
162102if (isNewArchitectureEnabled()) {
0 commit comments