UNPKG

3.81 kBPlain TextView Raw
1buildscript {
2 // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3 def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['AppconsentClearReactnative_kotlinVersion']
4
5 repositories {
6 google()
7 mavenCentral()
8 jcenter()
9 maven {
10 url "https://artifactory.datalf.chat/artifactory/app-consent-v2-release"
11 }
12 }
13
14 dependencies {
15 classpath("com.android.tools.build:gradle:7.3.1")
16 // noinspection DifferentKotlinGradleVersion
17 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18 }
19}
20
21apply plugin: 'com.android.library'
22apply plugin: 'kotlin-android'
23
24def getExtOrDefault(name) {
25 return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['AppconsentClearReactnative_' + name]
26}
27
28def getExtOrIntegerDefault(name) {
29 return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['AppconsentClearReactnative_' + name]).toInteger()
30}
31
32android {
33 compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
34 defaultConfig {
35 minSdkVersion getExtOrIntegerDefault('minSdkVersion')
36 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
37 versionCode 4
38 versionName "1.3"
39 }
40
41 buildTypes {
42 release {
43 minifyEnabled false
44 }
45 }
46 lintOptions {
47 disable 'GradleCompatible'
48 }
49 compileOptions {
50 sourceCompatibility JavaVersion.VERSION_1_8
51 targetCompatibility JavaVersion.VERSION_1_8
52 }
53 packagingOptions {
54 resources {
55 excludes += ['META-INF/DEPENDENCIES','META-INF/jacoco-agent.properties','jacoco-agent.properties']
56 }
57 }
58}
59
60repositories {
61 mavenCentral()
62 jcenter()
63 google()
64
65 maven {
66 url "https://artifactory.datalf.chat/artifactory/app-consent-v2-release"
67 }
68
69
70 def found = false
71 def defaultDir = null
72 def androidSourcesName = 'React Native sources'
73
74 if (rootProject.ext.has('reactNativeAndroidRoot')) {
75 defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
76 } else {
77 defaultDir = new File(
78 projectDir,
79 '/../../../node_modules/react-native/android'
80 )
81 }
82
83 if (defaultDir.exists()) {
84 maven {
85 url defaultDir.toString()
86 name androidSourcesName
87 }
88
89 logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
90 found = true
91 } else {
92 def parentDir = rootProject.projectDir
93
94 1.upto(5, {
95 if (found) return true
96 parentDir = parentDir.parentFile
97
98 def androidSourcesDir = new File(
99 parentDir,
100 'node_modules/react-native'
101 )
102
103 def androidPrebuiltBinaryDir = new File(
104 parentDir,
105 'node_modules/react-native/android'
106 )
107
108 if (androidPrebuiltBinaryDir.exists()) {
109 maven {
110 url androidPrebuiltBinaryDir.toString()
111 name androidSourcesName
112 }
113
114 logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
115 found = true
116 } else if (androidSourcesDir.exists()) {
117 maven {
118 url androidSourcesDir.toString()
119 name androidSourcesName
120 }
121
122 logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
123 found = true
124 }
125 })
126 }
127
128 if (!found) {
129 throw new GradleException(
130 "${project.name}: unable to locate React Native android sources. " +
131 "Ensure you have you installed React Native as a dependency in your project and try again."
132 )
133 }
134}
135
136def kotlin_version = getExtOrDefault('kotlinVersion')
137
138dependencies {
139 // noinspection GradleDynamicVersion
140 api 'com.facebook.react:react-native:+'
141 implementation ('com.sfbx.appconsent:appconsent-ui-v3:5.0.0')
142}