Skip to content

Commit 36ba7ca

Browse files
author
Kgothatso Ngako
committed
Initial commit converting kotlin-android into kotlin multiplatform lib
1 parent 2a9e9dc commit 36ba7ca

File tree

95 files changed

+7228
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7228
-0
lines changed

Diff for: build.gradle.kts

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
buildscript {
2+
// apply(from = rootProject.file("gradle/dependencies.gradle"))
3+
4+
repositories {
5+
mavenCentral()
6+
google()
7+
gradlePluginPortal()
8+
}
9+
dependencies {
10+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
11+
// classpath(KAplugin.androidGradle)
12+
// classpath KAplugin.google.hilt
13+
// classpath KAplugin.gradleVersions
14+
// classpath KAplugin.kotlin.gradle
15+
// classpath KAplugin.square.exhaustive
16+
17+
// NOTE: Do not place your application dependencies here; they belong
18+
// in the individual module build.gradle files
19+
}
20+
}
21+
22+
plugins {
23+
kotlin("multiplatform") version "1.5.10"
24+
}
25+
26+
group = "chat.sphinx"
27+
version = "1.0-SNAPSHOT"
28+
29+
repositories {
30+
mavenCentral()
31+
}
32+
33+
kotlin {
34+
jvm {
35+
compilations.all {
36+
kotlinOptions.jvmTarget = "1.8"
37+
}
38+
withJava()
39+
testRuns["test"].executionTask.configure {
40+
useJUnitPlatform()
41+
}
42+
}
43+
val hostOs = System.getProperty("os.name")
44+
val isMingwX64 = hostOs.startsWith("Windows")
45+
val nativeTarget = when {
46+
hostOs == "Mac OS X" -> macosX64("native")
47+
hostOs == "Linux" -> linuxX64("native")
48+
isMingwX64 -> mingwX64("native")
49+
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
50+
}
51+
52+
53+
sourceSets {
54+
val kotlinVersion = "1.5.1"
55+
val commonMain by getting {
56+
dependencies {
57+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
58+
implementation("com.benasher44:uuid:0.4.0")
59+
implementation("com.soywiz.korlibs.krypto:krypto:2.2.0")
60+
implementation("org.jetbrains.kotlinx:kotlinx-io:0.1.16")
61+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10")
62+
}
63+
}
64+
val commonTest by getting {
65+
dependencies {
66+
implementation(kotlin("test"))
67+
68+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0")
69+
}
70+
}
71+
val jvmMain by getting {
72+
dependencies {
73+
implementation("org.jetbrains.kotlinx:kotlinx-io-jvm:0.1.16")
74+
}
75+
}
76+
val jvmTest by getting
77+
val nativeMain by getting
78+
val nativeTest by getting
79+
}
80+
}
81+
82+
val projectDirGenRoot = "$buildDir/generated/projectdir/kotlin"
83+
84+
kotlin.sourceSets.named("commonTest") {
85+
this.kotlin.srcDir(projectDirGenRoot)
86+
}

Diff for: gradle.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kotlin.code.style=official
2+
kotlin.mpp.enableGranularSourceSetsMetadata=true
3+
kotlin.native.enableDependencyPropagation=false

Diff for: gradle/dependencies.gradle

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
/*************************/
2+
/** Sphinx Dependencies **/
3+
/*************************/
4+
ext.versions = [
5+
'buildTools': "30.0.3",
6+
'compileSdk': 31,
7+
'minSdk': 23,
8+
9+
'androidGradle': '4.2.2',
10+
'arch': '2.1.0',
11+
'camera': '1.1.0-alpha10',
12+
'cameraView': '1.0.0-alpha30',
13+
'coil': '1.3.0',
14+
'coroutines': '1.5.1',
15+
'insetter': '0.5.0',
16+
'lifecycle': '2.3.1',
17+
'hilt': '2.37',
18+
'hiltJetpack': '1.0.0-alpha03',
19+
'kotlin': '1.5.21',
20+
'moshi': '1.12.0',
21+
'navigation': '2.3.5',
22+
'okhttp': '4.9.1',
23+
'sqlDelight': '1.5.0',
24+
'toplAndroid': '2.1.2',
25+
]
26+
27+
/**
28+
* APPLICATION DEPENDENCIES:
29+
*
30+
* dependencies {
31+
* implementation deps.distributor.libName
32+
* }
33+
* */
34+
ext.deps = [
35+
androidx: [
36+
annotation: "androidx.annotation:annotation:1.2.0",
37+
appCompat: "androidx.appcompat:appcompat:1.3.0",
38+
camera: [
39+
core: "androidx.camera:camera-core:${versions.camera}",
40+
camera2: "androidx.camera:camera-camera2:${versions.camera}",
41+
lifecycle: "androidx.camera:camera-lifecycle:${versions.camera}",
42+
view: "androidx.camera:camera-view:${versions.cameraView}",
43+
extensions: "androidx.camera:camera-extensions:${versions.cameraView}",
44+
video: "androidx.camera:camera-video:${versions.camera}",
45+
],
46+
concurrent: [
47+
futures: "androidx.concurrent:concurrent-futures-ktx:1.1.0",
48+
],
49+
constraintLayout: "androidx.constraintlayout:constraintlayout:2.0.4",
50+
core: "androidx.core:core-ktx:1.6.0",
51+
exifInterface: "androidx.exifinterface:exifinterface:1.3.2",
52+
lifecycle: [
53+
commonJava8: "androidx.lifecycle:lifecycle-common-java8:${versions.lifecycle}",
54+
hilt: "androidx.hilt:hilt-lifecycle-viewmodel:${versions.hiltJetpack}",
55+
processLifecycleOwner: "androidx.lifecycle:lifecycle-process:${versions.lifecycle}",
56+
runtime: "androidx.lifecycle:lifecycle-runtime-ktx:${versions.lifecycle}",
57+
// service: "androidx.lifecycle:lifecycle-service:${versions.lifecycle}",
58+
viewModel: "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}",
59+
viewModelSavedState: "androidx.lifecycle:lifecycle-viewmodel-savedstate:${versions.lifecycle}",
60+
],
61+
media: "androidx.media:media:1.3.1",
62+
navigation: [
63+
fragment: "androidx.navigation:navigation-fragment-ktx:${versions.navigation}",
64+
ui: "androidx.navigation:navigation-ui-ktx:${versions.navigation}",
65+
],
66+
paging3: "androidx.paging:paging-runtime:3.0.0",
67+
recyclerView: "androidx.recyclerview:recyclerview:1.2.1",
68+
swipeRefreshLayout: "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0",
69+
securityCrypto: "androidx.security:security-crypto:1.1.0-alpha03",
70+
viewBinding: "androidx.databinding:viewbinding:${versions.androidGradle}",
71+
],
72+
// bouncyCastle: "org.bouncycastle:bcprov-jdk15on:1.65",
73+
chrisbanes: [
74+
insetter: "dev.chrisbanes.insetter:insetter:${versions.insetter}",
75+
insetterWidgets: "dev.chrisbanes.insetter:insetter-widgets:${versions.insetter}"
76+
],
77+
google: [
78+
hilt: "com.google.dagger:hilt-android:${versions.hilt}",
79+
material: "com.google.android.material:material:1.4.0-beta01",
80+
mlKitBarcodeScanning: "com.google.mlkit:barcode-scanning:16.2.0",
81+
zxing: "com.google.zxing:core:3.4.1",
82+
],
83+
guardianProject: [
84+
jtorctl: "info.guardianproject:jtorctl:0.4",
85+
],
86+
instacart: [
87+
coil: "io.coil-kt:coil:${versions.coil}",
88+
coilBase: "io.coil-kt:coil-base:${versions.coil}",
89+
coilGif: "io.coil-kt:coil-gif:${versions.coil}",
90+
coilSvg: "io.coil-kt:coil-svg:${versions.coil}",
91+
coilVideo: "io.coil-kt:coil-video:${versions.coil}",
92+
],
93+
javax: [
94+
inject: "javax.inject:javax.inject:1",
95+
],
96+
jncryptor: "org.cryptonode.jncryptor:jncryptor:1.2.0",
97+
json: "org.json:json:20210307",
98+
jsoup: "org.jsoup:jsoup:1.14.1",
99+
kotlin: [
100+
coroutinesAndroid: "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}",
101+
coroutinesCore: "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}",
102+
reflect: "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}",
103+
],
104+
matthewNelson: [
105+
toplService: "io.matthewnelson.topl-android:topl-service:${versions.toplAndroid}",
106+
toplServiceBase: "io.matthewnelson.topl-android:topl-service-base:${versions.toplAndroid}",
107+
torBinary: "io.matthewnelson.topl-android:tor-binary:0.4.6.5",
108+
],
109+
sqlCipher: "net.zetetic:android-database-sqlcipher:4.4.3",
110+
sqlRequery: "com.github.requery:sqlite-android:3.36.0",
111+
square: [
112+
okio: "com.squareup.okio:okio:2.10.0",
113+
okhttp: "com.squareup.okhttp3:okhttp:${versions.okhttp}",
114+
okhttpLogging: "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}",
115+
moshi: "com.squareup.moshi:moshi-kotlin:${versions.moshi}",
116+
sqlDelightAndroid: "com.squareup.sqldelight:android-driver:${versions.sqlDelight}",
117+
sqlDelightAndroidPaging3: "com.squareup.sqldelight:android-paging3-extensions:${versions.sqlDelight}",
118+
sqlDelightCoroutines: "com.squareup.sqldelight:coroutines-extensions:${versions.sqlDelight}",
119+
sqlDelightJvm: "com.squareup.sqldelight:sqlite-driver:${versions.sqlDelight}",
120+
sqlDelightNative: "com.squareup.sqldelight:native-driver:${versions.sqlDelight}",
121+
sqlDelightRuntime: "com.squareup.sqldelight:runtime:${versions.sqlDelight}",
122+
],
123+
viewBindingDelegateNoReflect: "com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.4.7",
124+
giphy: [
125+
sdk: "com.giphy.sdk:ui:2.1.2"
126+
],
127+
jitsi: [
128+
sdk: "org.jitsi.react:jitsi-meet-sdk:3.10.2"
129+
],
130+
lottie: [
131+
sdk: "com.airbnb.android:lottie:4.0.0"
132+
],
133+
swipeRevealLayout: [
134+
sdk: "com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1"
135+
]
136+
]
137+
138+
/**
139+
* DEBUG DEPENDENCIES:
140+
* dependencies {
141+
* debugImplementation debugDeps.distributor.libName
142+
* }
143+
* */
144+
ext.debugDeps = [
145+
square: [
146+
leakCanary: "com.squareup.leakcanary:leakcanary-android:2.5",
147+
],
148+
]
149+
150+
ext.plugin = [
151+
androidGradle: "com.android.tools.build:gradle:${versions.androidGradle}",
152+
androidx: [
153+
navigation: [
154+
safeArgs: "androidx.navigation:navigation-safe-args-gradle-plugin:${versions.navigation}",
155+
],
156+
],
157+
google: [
158+
hilt: "com.google.dagger:hilt-android-gradle-plugin:${versions.hilt}",
159+
],
160+
gradleVersions: "com.github.ben-manes:gradle-versions-plugin:0.39.0",
161+
kotlin: [
162+
dokka: "org.jetbrains.dokka:dokka-gradle-plugin:0.10.1",
163+
gradle: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
164+
serialization: "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}",
165+
],
166+
mavenPublish: "com.vanniktech:gradle-maven-publish-plugin:0.13.0",
167+
square: [
168+
exhaustive: "app.cash.exhaustive:exhaustive-gradle:0.2.0",
169+
sqlDelight: "com.squareup.sqldelight:gradle-plugin:${versions.sqlDelight}"
170+
],
171+
]
172+
173+
/**
174+
* TEST DEPENDENCIES:
175+
* dependencies {
176+
* testImplementation testDeps.distributor.libName
177+
*
178+
* androidTestImplementation testDeps.distributor.libName
179+
* }
180+
* */
181+
ext.testDeps = [
182+
androidx: [
183+
archCore: "androidx.arch.core:core-testing:${versions.arch}",
184+
core: "androidx.test:core:1.4.0",
185+
espresso: "androidx.test.espresso:espresso-core:3.4.0",
186+
junit: "androidx.test.ext:junit:1.1.3",
187+
],
188+
google: [
189+
hilt: "com.google.dagger:hilt-android-testing:${versions.hilt}",
190+
guava: "com.google.guava:guava:30.1.1-jre",
191+
],
192+
junit: "junit:junit:4.12",
193+
hamcrest: "org.hamcrest:hamcrest-library:1.3",
194+
kotlin: [
195+
coroutines: "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}",
196+
],
197+
robolectric: "org.robolectric:robolectric:4.6.1",
198+
jsonAssert: "org.skyscreamer:jsonassert:1.5.0",
199+
turbine: "app.cash.turbine:turbine:0.5.2",
200+
]
201+
202+
/**
203+
* KOTLIN ANNOTATION PROCESSOR DEPENDENCIES:
204+
*
205+
* Requires plugin to be applied in build.gradle:
206+
*
207+
* apply plugin: 'kotlin-kapt'
208+
*
209+
* dependencies {
210+
* kapt kaptDeps.distributor.libName
211+
*
212+
* // for testing
213+
* kaptTest kaptDeps.distributor.libName
214+
* }
215+
* */
216+
ext.kaptDeps = [
217+
google: [
218+
hilt: "com.google.dagger:hilt-compiler:${versions.hilt}",
219+
],
220+
square: [
221+
moshiCodegen: "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}",
222+
],
223+
]

Diff for: gradle/wrapper/gradle-wrapper.jar

58.1 KB
Binary file not shown.

Diff for: gradle/wrapper/gradle-wrapper.properties

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)