-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild.gradle
More file actions
132 lines (107 loc) · 3.56 KB
/
build.gradle
File metadata and controls
132 lines (107 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//file:noinspection SpellCheckingInspection
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
// Expose package.json version to gradle
apply from: 'version.gradle'
def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
buildscript {
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['adapty_kotlinVersion']
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
def safeExtGet(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['adapty_' + name]
}
def safeExtGetInt(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['adapty_' + name]).toInteger()
}
android {
compileSdkVersion safeExtGetInt('compileSdkVersion')
buildToolsVersion safeExtGet('buildToolsVersion')
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion safeExtGetInt('minSdkVersion')
targetSdkVersion safeExtGetInt('targetSdkVersion')
versionCode 1
versionName packageJsonVersion
multiDexEnabled true
buildConfigField 'String', 'VERSION_NAME', "\"$packageJsonVersion\""
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}
lintOptions {
abortOnError false
disable 'GradleCompatible'
}
buildTypes {
release {
minifyEnabled false
}
debug {
minifyEnabled false
}
// Only for library development
libDebug {
initWith buildTypes.debug
versionNameSuffix "-lib-debug"
repositories {
google()
maven { url "$rootDir/internalMaven" }
maven { url "$rootDir/../../node_modules/react-native/android" }
}
matchingFallbacks = ["debug"]
debuggable true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
if (project.android.hasProperty("namespace")) {
namespace 'com.adapty.react'
}
buildFeatures {
buildConfig true
}
}
repositories {
mavenCentral()
google()
maven { url "$rootDir/../node_modules/react-native/android" }
}
def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['adapty_' + name]
}
def kotlin_version = getExtOrDefault('kotlinVersion')
dependencies {
implementation platform('io.adapty:adapty-bom:3.15.2')
implementation 'io.adapty:android-sdk'
implementation 'io.adapty:android-ui'
implementation 'io.adapty.internal:crossplatform:3.15.6'
// Compatible with older and newer RN
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
//noinspection DifferentStdlibGradleVersion
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "ReactNativeAdapty"
codegenJavaPackageName = "com.adapty.react"
}
}