-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
198 lines (175 loc) · 7.21 KB
/
build.gradle
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
kotlin_version = "1.9.24"
androidXBrowser = "1.5.0"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath("io.hyperswitch:react-native-gradle-plugin:0.75.2.1")
}
}
/*
plugins {
id 'com.vanniktech.maven.publish' version "0.30.0"
}
*/
apply plugin: "io.hyperswitch.rootproject"
apply plugin: 'maven-publish'
//apply plugin: 'signing'
rootProject.allprojects {
// apply plugin: 'com.vanniktech.maven.publish'
repositories {
google()
mavenCentral()
maven {
url("$rootDir/maven/")
}
maven {
url "https://jitpack.io"
}
maven {
url 'https://x.klarnacdn.net/mobile-sdk/'
}
}
/*
afterEvaluate { project ->
if (tasks.findByPath(':react-native-klarna-inapp-sdk:compileDebugUnitTestJavaWithJavac')) {
tasks.findByPath(':react-native-klarna-inapp-sdk:compileDebugUnitTestJavaWithJavac').enabled = false
}
if (tasks.findByPath(':react-native-klarna-inapp-sdk:compileReleaseUnitTestJavaWithJavac')) {
tasks.findByPath(':react-native-klarna-inapp-sdk:compileReleaseUnitTestJavaWithJavac').enabled = false
}
if (project.plugins.hasPlugin('com.android.library') && !excludedLibs.contains(project.name)) {
println("PRO1 [$project]")
mavenPublishing {
// configure(new com.vanniktech.maven.publish.AndroidSingleVariantLibrary("release", false, false))
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates("io.hyperswitch.${project.name}", project.name, project.version)
pom {
name = project.name
description = 'Your project description'
url = 'http://www.hyperswitch.io'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'ChiragKV-Juspay'
name = 'Chirag KV'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/juspay/hyperswitch-sdk-android.git'
developerConnection = 'scm:git:ssh://[email protected]:juspay/hyperswitch-sdk-android.git'
url = 'https://github.com/hyperswitch/hyperswitch-sdk-android'
}
}
}
}
}
*/
}
def runtimeDeps = [
'react-native-code-push',
'react-native-gesture-handler',
'react-native-inappbrowser-reborn',
'react-native-pager-view',
'react-native-safe-area-context',
'react-native-screens',
'react-native-svg',
'sentry_react-native',
]
def runtimeDepsExcluded = [
'demo-app'
]
def runtimeDepsOptional = [
'react-native-reanimated',
'react-native-hyperswitch-kount',
'react-native-hyperswitch-paypal',
'react-native-klarna-inapp-sdk',
'react-native-hyperswitch-scancard',
'react-native-hyperswitch-netcetera-3ds',
]
def configurePomMetadata = { root ->
root.appendNode('name', 'Hyperswitch SDK for Android')
root.appendNode('description', 'This is the Hyperswitch SDK for Android, providing seamless integration with the Hyperswitch platform.')
root.appendNode('url', 'http://www.hyperswitch.io')
def licenseNode = root.appendNode('licenses').appendNode('license')
licenseNode.appendNode('name', 'The Apache License, Version 2.0')
licenseNode.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
licenseNode.appendNode('distribution', 'repo')
def scmNode = root.appendNode('scm')
scmNode.appendNode('url', 'https://github.com/hyperswitch/hyperswitch-sdk-android')
scmNode.appendNode('connection', 'scm:git:git://github.com/juspay/hyperswitch-sdk-android.git')
scmNode.appendNode('developerConnection', 'scm:git:ssh://[email protected]:juspay/hyperswitch-sdk-android.git')
scmNode.appendNode('tag', 'HEAD')
def developerNode = root.appendNode('developers').appendNode('developer')
developerNode.appendNode('id', 'sh-iv-am')
developerNode.appendNode('name', 'Shivam')
developerNode.appendNode('email', '[email protected]')
}
subprojects {
def disableTaskIfPresent = { taskPath ->
def task = tasks.findByPath(taskPath)
if (task) task.enabled = false
}
disableTaskIfPresent(':react-native-klarna-inapp-sdk:compileDebugUnitTestJavaWithJavac')
disableTaskIfPresent(':react-native-klarna-inapp-sdk:compileReleaseUnitTestJavaWithJavac')
// disableTaskIfPresent(':react-native-klarna-inapp-sdk:testReleaseUnitTest')
// disableTaskIfPresent(':react-native-hyperswitch-paypal:lintDebug')
def isAppProject = project.name == 'app'
def isLiteProject = project.name == 'hyperswitch-sdk-android-lite'
def pomVersion = isAppProject ? project.version : (isLiteProject ? liteVersion : extVersion)
def configurePom = { pom ->
def root = pom.asNode()
configurePomMetadata(root)
def dependencies = root.appendNode('dependencies')
configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
if (!runtimeDepsOptional.contains(it.moduleName)) {
def isLiteProjectSub = it.moduleName == 'hyperswitch-sdk-android-lite'
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', (runtimeDeps.contains(it.moduleName) ? extVersion : (isLiteProjectSub ? liteVersion : it.moduleVersion)))
}
}
}
publishing {
publications {
if (!runtimeDepsExcluded.contains(project.name)) {
"$project.name"(MavenPublication) {
groupId = project.group
artifactId = isAppProject ? 'hyperswitch-sdk-android' : project.name
version = pomVersion
artifact "$buildDir/outputs/aar/$project.name-release.aar"
pom.withXml(configurePom)
}
}
}
repositories {
maven {
url("${project.rootDir}/maven")
}
}
}
// signing {
// sign publishing.publications
// }
}