Skip to content

Commit 01e1bf4

Browse files
feat(POM-500): Netcetera core module (#316)
1 parent 0baedb3 commit 01e1bf4

23 files changed

Lines changed: 3610 additions & 1 deletion

File tree

build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
buildscript {
44
ext {
5-
androidGradlePluginVersion = '8.11.1'
5+
androidGradlePluginVersion = '8.12.0'
66
kotlinVersion = '2.1.20'
77
kspVersion = '2.1.20-1.0.32'
88
dokkaVersion = '1.9.20'
99
androidxNavigationVersion = '2.9.2'
10+
secretsVaultPluginVersion = '0.1.3'
1011
nexusPublishPluginVersion = '2.0.0'
1112
}
1213
dependencies {
@@ -21,6 +22,7 @@ plugins {
2122
id 'org.jetbrains.kotlin.plugin.compose' version "$kotlinVersion" apply false
2223
id 'org.jetbrains.dokka' version "$dokkaVersion" apply true
2324
id 'com.google.devtools.ksp' version "$kspVersion" apply false
25+
id 'com.commencis.secretsvaultplugin' version "$secretsVaultPluginVersion" apply false
2426
id 'io.github.gradle-nexus.publish-plugin' version "$nexusPublishPluginVersion" apply true
2527
}
2628

@@ -33,6 +35,9 @@ ext {
3335
targetSdkVersion = 36
3436
compileSdkVersion = 36
3537

38+
ndkVersion = '28.2.13676358'
39+
cmakeVersion = '4.0.3'
40+
3641
publishGroupId = 'com.processout'
3742
publishVersion = file('version.resolved').getText().trim()
3843

@@ -65,7 +70,10 @@ ext {
6570
commonMarkVersion = '0.25.0'
6671
libphonenumberVersion = '9.0.10'
6772
zxingVersion = '3.5.3'
73+
bouncyCastleVersion = '1.79'
74+
slf4jVersion = '1.7.36'
6875

76+
netcetera3dsSdkVersion = '2.5.3.0'
6977
checkout3dsSdkVersion = '3.2.6'
7078
adyen3dsSdkVersion = '2.2.15'
7179

example/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ kotlin {
6161
jvmTarget.set(JvmTarget.JVM_17)
6262
optIn.add("com.processout.sdk.core.annotation.ProcessOutInternalApi")
6363
optIn.add("com.processout.sdk.ui.core.annotation.ProcessOutInternalApi")
64+
optIn.add("com.processout.sdk.netcetera.threeds.core.annotation.ProcessOutInternalApi")
6465
}
6566
}
6667

netcetera-3ds-core/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/build
2+
secrets.json
3+
4+
/src/main/cpp/common
5+
/src/main/cpp/CMakeLists.txt
6+
/src/main/cpp/secrets.cpp
7+
8+
/src/main/kotlin/com/processout/sdk/netcetera/threeds/core/MainSecrets.kt

netcetera-3ds-core/build.gradle

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import groovy.json.JsonOutput
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
4+
plugins {
5+
id 'com.android.library'
6+
id 'org.jetbrains.kotlin.android'
7+
id 'com.commencis.secretsvaultplugin'
8+
}
9+
10+
ext {
11+
publishArtifactId = 'processout-android-netcetera-3ds-core'
12+
publishVersion = rootProject.ext.netcetera3dsSdkVersion
13+
publishDescription = 'ProcessOut Android SDK - Netcetera 3DS Core'
14+
}
15+
16+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
17+
18+
android {
19+
namespace 'com.processout.sdk.netcetera.threeds.core'
20+
compileSdk rootProject.ext.compileSdkVersion
21+
22+
ndkVersion rootProject.ext.ndkVersion
23+
externalNativeBuild {
24+
cmake {
25+
path file('src/main/cpp/CMakeLists.txt')
26+
version rootProject.ext.cmakeVersion
27+
}
28+
}
29+
30+
defaultConfig {
31+
minSdk rootProject.ext.minSdkVersion
32+
targetSdk rootProject.ext.targetSdkVersion
33+
setBuildConfig(it)
34+
consumerProguardFiles 'consumer-rules.pro', 'netcetera-consumer-rules.pro'
35+
ndk {
36+
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
37+
}
38+
}
39+
40+
buildTypes {
41+
release {
42+
minifyEnabled false
43+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
44+
}
45+
debug {
46+
getIsDefault().set(true)
47+
}
48+
}
49+
50+
flavorDimensions = ['environment']
51+
productFlavors {
52+
production {
53+
dimension 'environment'
54+
}
55+
staging {
56+
getIsDefault().set(true)
57+
dimension 'environment'
58+
}
59+
}
60+
61+
buildFeatures {
62+
buildConfig true
63+
}
64+
65+
compileOptions {
66+
sourceCompatibility JavaVersion.VERSION_17
67+
targetCompatibility JavaVersion.VERSION_17
68+
}
69+
70+
publishing {
71+
singleVariant('productionRelease')
72+
}
73+
}
74+
75+
kotlin {
76+
compilerOptions {
77+
jvmTarget.set(JvmTarget.JVM_17)
78+
optIn.add("com.processout.sdk.netcetera.threeds.core.annotation.ProcessOutInternalApi")
79+
}
80+
}
81+
82+
@SuppressWarnings('GrMethodMayBeStatic')
83+
def setBuildConfig(buildType) {
84+
buildType.buildConfigField("String", "LIBRARY_NAME", "\"ProcessOut Android SDK - Netcetera 3DS Core\"")
85+
buildType.buildConfigField("String", "LIBRARY_VERSION", "\"$publishVersion\"")
86+
}
87+
88+
tasks.register('beforeKeepSecrets') {
89+
doLast {
90+
File secrets = project.file("secrets.json")
91+
def content = [[key: "apiKey", value: getApiKey()]]
92+
secrets.text = JsonOutput.toJson(content)
93+
}
94+
}
95+
96+
def getApiKey() {
97+
File localProperties = rootProject.file("local.properties")
98+
if (localProperties.exists()) {
99+
def properties = new Properties()
100+
properties.load(new FileInputStream(localProperties))
101+
String apiKey = properties.getProperty("netcetera.apiKey", "").trim()
102+
if (!apiKey) {
103+
throw new GradleException("Missing or blank 'netcetera.apiKey' in 'local.properties' file.")
104+
}
105+
return apiKey
106+
}
107+
throw new GradleException("File not found: 'local.properties'.")
108+
}
109+
110+
tasks.register('afterKeepSecrets') {
111+
doLast {
112+
copyCMakeLists()
113+
copyMainSecretsClass()
114+
}
115+
}
116+
117+
def copyCMakeLists() {
118+
File source = project.file("src/main/cpp/CMakeLists.copy")
119+
File target = project.file("src/main/cpp/CMakeLists.txt")
120+
target.text = source.text
121+
}
122+
123+
def copyMainSecretsClass() {
124+
String packagePath = "com/processout/sdk/netcetera/threeds/core"
125+
File source = project.file("src/main/kotlin/${packagePath}/MainSecrets.copy")
126+
File target = project.file("src/main/kotlin/${packagePath}/MainSecrets.kt")
127+
target.text = source.text
128+
}
129+
130+
keepSecrets.dependsOn beforeKeepSecrets
131+
afterKeepSecrets.dependsOn keepSecrets
132+
preBuild.dependsOn afterKeepSecrets
133+
134+
dependencies {
135+
api fileTree(dir: 'libs', include: ['*.jar'])
136+
api "org.bouncycastle:bcprov-jdk15to18:$bouncyCastleVersion"
137+
implementation "org.slf4j:slf4j-api:$slf4jVersion"
138+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-keep class com.processout.sdk.netcetera.threeds.core.MainSecrets {
2+
<init>();
3+
}
4+
5+
-keepclassmembers class com.processout.sdk.netcetera.threeds.core.MainSecrets {
6+
native <methods>;
7+
}
8+
9+
-dontwarn org.slf4j.impl.StaticLoggerBinder
10+
-dontwarn org.slf4j.impl.StaticMDCBinder
11+
-dontwarn org.slf4j.impl.StaticMarkerBinder
2.12 MB
Binary file not shown.

0 commit comments

Comments
 (0)