Skip to content

Commit

Permalink
Androapp 5449 local library (#27)
Browse files Browse the repository at this point in the history
* add testing dhis2 icon

* [ANDROAPP-5431] Add DHIS2 icon library

* [ANDROAPP-5431] rename dhis2 icons

* [ANDROAPP-5449] Renaming packages

* renaming

* [ANDROAPP-5431] create publish script

* [ANDROAPP-5449] update references

* [ANDROAPP-5449] Rename step name
  • Loading branch information
andresmr authored Aug 21, 2023
1 parent 935c64f commit b11f82e
Show file tree
Hide file tree
Showing 36 changed files with 195 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
run: chmod +x ./gradlew

# Create publish to maven
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
- name: Publish to maven
run: ./gradlew publishAllPublicationsToSonatypeRepository
3 changes: 0 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
group = "org.hisp.dhis.mobileui"
version = "1.0-SNAPSHOT"

plugins {
kotlin("jvm") apply false
kotlin("multiplatform") apply false
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ kotlin {

android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
namespace = "org.hisp.dhis.mobileui.common"
namespace = "org.hisp.dhis.mobile.ui.common"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
Expand All @@ -78,7 +78,7 @@ ktlint {
}

multiplatformResources {
multiplatformResourcesPackage = "org.hisp.dhis.mobileui.library"
multiplatformResourcesPackage = "org.hisp.dhis.mobile.ui"
multiplatformResourcesClassName = "SharedRes"
}

Expand Down
4 changes: 2 additions & 2 deletions common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import org.hisp.dhis.common.screens.Components
import org.hisp.dhis.common.screens.FormsComponentsScreen
import org.hisp.dhis.common.screens.IconButtonScreen
import org.hisp.dhis.common.screens.radio.RadioButtonScreen
import org.hisp.dhis.mobileui.designsystem.theme.DHIS2Theme
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

@Composable
fun App() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import org.hisp.dhis.common.screens.previews.ButtonPreview
import org.hisp.dhis.common.screens.previews.ButtonPreviewWithIcon
import org.hisp.dhis.mobileui.designsystem.component.ButtonStyle
import org.hisp.dhis.mobileui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobileui.designsystem.component.RowComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.ButtonStyle
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.RowComponentContainer

@Composable
fun ButtonScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import org.hisp.dhis.common.screens.previews.InputShellPreview
import org.hisp.dhis.mobileui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobileui.designsystem.component.InputShellState
import org.hisp.dhis.mobileui.designsystem.component.SimpleTextInputField
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.component.SimpleTextInputField
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

@Composable
fun FormsComponentsScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import org.hisp.dhis.common.screens.previews.IconButtonPreview
import org.hisp.dhis.common.screens.previews.SquareIconButtonPreview
import org.hisp.dhis.mobileui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobileui.designsystem.component.IconButtonStyle
import org.hisp.dhis.mobileui.designsystem.component.RowComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.IconButtonStyle
import org.hisp.dhis.mobile.ui.designsystem.component.RowComponentContainer

@Composable
fun IconButtonScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import org.hisp.dhis.mobileui.designsystem.component.Button
import org.hisp.dhis.mobileui.designsystem.component.ButtonStyle
import org.hisp.dhis.mobile.ui.designsystem.component.Button
import org.hisp.dhis.mobile.ui.designsystem.component.ButtonStyle

@Composable
internal fun ButtonPreview(text: String, style: ButtonStyle = ButtonStyle.OUTLINED, enabled: Boolean = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.hisp.dhis.mobileui.designsystem.component.EmptyInput
import org.hisp.dhis.mobileui.designsystem.component.IconButton
import org.hisp.dhis.mobileui.designsystem.component.InputShell
import org.hisp.dhis.mobileui.designsystem.component.InputShellState
import org.hisp.dhis.mobileui.designsystem.component.SquareIconButton
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobileui.designsystem.theme.TextColor
import org.hisp.dhis.mobile.ui.designsystem.component.EmptyInput
import org.hisp.dhis.mobile.ui.designsystem.component.IconButton
import org.hisp.dhis.mobile.ui.designsystem.component.InputShell
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.component.SquareIconButton
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor

@Composable
internal fun InputShellPreview(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.FileDownload
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import org.hisp.dhis.mobileui.designsystem.component.IconButton
import org.hisp.dhis.mobileui.designsystem.component.IconButtonStyle
import org.hisp.dhis.mobileui.designsystem.component.SquareIconButton
import org.hisp.dhis.mobile.ui.designsystem.component.IconButton
import org.hisp.dhis.mobile.ui.designsystem.component.IconButtonStyle
import org.hisp.dhis.mobile.ui.designsystem.component.SquareIconButton

@Composable
internal fun SquareIconButtonPreview(enabled: Boolean = true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.hisp.dhis.common.screens.radio

import androidx.compose.runtime.Composable
import org.hisp.dhis.mobileui.designsystem.component.RadioButton
import org.hisp.dhis.mobile.ui.designsystem.component.RadioButton

@Composable
internal fun RadioButtonPreview(selected: Boolean = true, enabled: Boolean = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import org.hisp.dhis.mobileui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobileui.designsystem.component.RowComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.RowComponentContainer

@Composable
fun RadioButtonScreen() {
Expand Down
7 changes: 7 additions & 0 deletions convention-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl` // Is needed to turn our build logic written in Kotlin into the Gradle Plugin
}

repositories {
gradlePluginPortal() // To use 'maven-publish' and 'signing' plugins in our own plugin
}
101 changes: 101 additions & 0 deletions convention-plugins/src/main/kotlin/convention.publication.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.`maven-publish`
import org.gradle.kotlin.dsl.signing
import java.util.*

plugins {
`maven-publish`
signing
}

// Stub secrets to let the project sync and build without the publication values set up
ext["signing.keyId"] = null
ext["signing.password"] = null
ext["signing.secretKeyRingFile"] = null
ext["ossrhUsername"] = null
ext["ossrhPassword"] = null

// Grabbing secrets from local.properties file or from environment variables, which could be used on CI
val secretPropsFile = project.rootProject.file("local.properties")
if (secretPropsFile.exists()) {
secretPropsFile.reader().use {
Properties().apply {
load(it)
}
}.onEach { (name, value) ->
ext[name.toString()] = value
}
} else {
ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID")
ext["signing.password"] = System.getenv("SIGNING_PASSWORD")
ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE")
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")
}

val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

fun getExtraString(name: String) = ext[name]?.toString()

publishing {
// Configure maven central repository
repositories {
maven {
name = "sonatype"
setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = getExtraString("ossrhUsername")
password = getExtraString("ossrhPassword")
}
}
}

// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())

// Provide artifacts information requited by Maven Central
pom {
name.set("DHIS2 Mobile Design system")
description.set("Compose Multiplatform DHIS2 Mobile UI components library")
url.set("https://github.com/dhis2/dhis2-mobile-ui")

licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("andresmr")
name.set("Andres")
email.set("[email protected]")
}
developer {
id.set("xavimolloy")
name.set("Xavi")
email.set("[email protected]")
}
developer {
id.set("DavidAparicioAlbaAsenjo")
name.set("David")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/dhis2/dhis2-mobile-ui")
}
}
}
}

// Signing artifacts. Signing.* extra properties values will be used
signing {
isRequired = false
sign(publishing.publications)
}
8 changes: 6 additions & 2 deletions designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
group = "org.hisp.dhis.mobile"
version = "1.0-SNAPSHOT"

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
id("com.android.library")
id("org.jlleitschuh.gradle.ktlint")
id("dev.icerock.mobile.multiplatform-resources")
id("convention.publication")
}

kotlin {
Expand All @@ -28,7 +32,7 @@ kotlin {

android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
namespace = "org.hisp.dhis.mobileui.designsystem"
namespace = "org.hisp.dhis.mobile.ui.designsystem"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
Expand All @@ -55,7 +59,7 @@ ktlint {
}

multiplatformResources {
multiplatformResourcesPackage = "org.hisp.dhis.mobileui.designsystem.library"
multiplatformResourcesPackage = "org.hisp.dhis.mobile.ui.designsystem"
multiplatformResourcesClassName = "SharedRes"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobileui.designsystem.component
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
Expand All @@ -12,13 +12,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import org.hisp.dhis.mobileui.designsystem.theme.Outline
import org.hisp.dhis.mobileui.designsystem.theme.Radius
import org.hisp.dhis.mobileui.designsystem.theme.Ripple
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobileui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobileui.designsystem.theme.TextColor
import org.hisp.dhis.mobileui.designsystem.theme.buttonShadow
import org.hisp.dhis.mobile.ui.designsystem.theme.Outline
import org.hisp.dhis.mobile.ui.designsystem.theme.Radius
import org.hisp.dhis.mobile.ui.designsystem.theme.Ripple
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
import org.hisp.dhis.mobile.ui.designsystem.theme.buttonShadow

/**
* DHIS2 button with generic icon slot.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobileui.designsystem.component
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -12,7 +12,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

/**
* DHIS2 ColumnComponentContainer wraps Material 3 [Column]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobileui.designsystem.component
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
Expand All @@ -18,13 +18,13 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import org.hisp.dhis.mobileui.designsystem.theme.Outline
import org.hisp.dhis.mobileui.designsystem.theme.Radius
import org.hisp.dhis.mobileui.designsystem.theme.Ripple
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobileui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobileui.designsystem.theme.TextColor
import org.hisp.dhis.mobileui.designsystem.theme.iconButtonshadow
import org.hisp.dhis.mobile.ui.designsystem.theme.Outline
import org.hisp.dhis.mobile.ui.designsystem.theme.Radius
import org.hisp.dhis.mobile.ui.designsystem.theme.Ripple
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
import org.hisp.dhis.mobile.ui.designsystem.theme.iconButtonshadow

/**
* DHIS2 square icon button with generic icon slot. Wraps Material 3 [ElevatedButton].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.hisp.dhis.mobileui.designsystem.component
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
Expand All @@ -18,10 +18,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.graphics.PathEffect
import androidx.compose.ui.graphics.drawscope.Stroke
import org.hisp.dhis.mobileui.designsystem.theme.Outline
import org.hisp.dhis.mobileui.designsystem.theme.Radius
import org.hisp.dhis.mobileui.designsystem.theme.Spacing
import org.hisp.dhis.mobileui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.Outline
import org.hisp.dhis.mobile.ui.designsystem.theme.Radius
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

/**
* DHIS2 Text Input Field. Wraps Material· [BasicTextField].
Expand Down
Loading

0 comments on commit b11f82e

Please sign in to comment.