Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add aggregate module #3934

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions aggregates/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
kotlin("multiplatform")
id("com.android.library")
}

kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "aggregates"
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
//put your multiplatform dependencies here
}
commonTest.dependencies {
implementation(kotlin("test"))
}

androidMain.dependencies { }

androidUnitTest.dependencies { }
}
}

android {
namespace = "org.dhis2.mobile.aggregates"
compileSdk = 34
defaultConfig {
minSdk = 21
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.dhis2.mobile.aggregates

class AndroidPlatform : Platform {
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}"
}

actual fun getPlatform(): Platform = AndroidPlatform()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.dhis2.mobile.aggregates

import org.junit.Assert.assertTrue
import org.junit.Test

class AndroidGreetingTest {

@Test
fun testExample() {
assertTrue("Check Android is mentioned", Greeting().greet().contains("Android"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.dhis2.mobile.aggregates

class Greeting {
private val platform: Platform = getPlatform()

fun greet(): String {
return "Hello, ${platform.name}!"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.dhis2.mobile.aggregates

interface Platform {
val name: String
}

expect fun getPlatform(): Platform
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.dhis2.mobile.aggregates

import kotlin.test.Test
import kotlin.test.assertTrue

class CommonGreetingTest {

@Test
fun testExample() {
assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.dhis2.mobile.aggregates

import platform.UIKit.UIDevice

class IOSPlatform : Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}

actual fun getPlatform(): Platform = IOSPlatform()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.dhis2.mobile.aggregates

import kotlin.test.Test
import kotlin.test.assertTrue

class IosGreetingTest {

@Test
fun testExample() {
assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned")
}
}
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ dependencies {
implementation(project(":stock-usecase"))
implementation(project(":dhis2-mobile-program-rules"))
implementation(project(":tracker"))
implementation(project(":aggregates"))

implementation(libs.security.conscrypt)
implementation(libs.security.rootbeer)
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ include(
)
include(":dhis2-mobile-program-rules")
include(":tracker")
include(":aggregates")
//project(":aggregates").projectDir = file("/aggregates")
1 change: 1 addition & 0 deletions stock-usecase/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ dependencies {
implementation(project(":dhis_android_analytics"))

implementation(libs.bundles.stock.implementation)
implementation(project(":aggregates"))
testImplementation(project(":dhis_android_analytics"))
coreLibraryDesugaring(libs.bundles.stock.core)
kapt(libs.bundles.stock.kapt)
Expand Down
Loading