Skip to content

Commit

Permalink
Introduce QuackPlugin (#720)
Browse files Browse the repository at this point in the history
- 플러그인 기능을 `QuackPlugin`라는 이름으로 도입합니다.
- `QuackImage`에 GIF 지원을 추가하는 `QuackImageGifPlugin`을 구현합니다.

cc #693
  • Loading branch information
jisungbin authored May 27, 2023
1 parent 7a2b449 commit cae66ad
Show file tree
Hide file tree
Showing 61 changed files with 1,537 additions and 154 deletions.
33 changes: 0 additions & 33 deletions .run/ui-test.run.xml

This file was deleted.

22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
<img src="https://raw.githubusercontent.com/duckie-team/quack-quack-android/main/assets/logo-icon.svg" width="25%" alt="quackquack" />
</p>
<h1 align="center">QuackQuack</h1>
<h4 align="center">Highly automated and Modifier-driven Jetpack Compose UI Kit.<br/>It's almost well-tested and adheres to the stability system.</h4>

<img src="assets/QuackTextSnapshot_ModifierSpan.png" align="right"/>

```kotlin
QuackText(
modifier = Modifier
.background(color = Color.White)
.span(
texts = listOf("QuackQuack", "Duckie"),
style = SpanStyle(color = QuackColor.DuckieOrange.value),
)
.padding(30.dp),
text = "QuackQuack is an awesome ui kit created by the Duckie team.",
typography = QuackTypography.Body1,
modifier = Modifier
.background(color = Color.White)
.span(
texts = listOf("QuackQuack", "Duckie"),
style = SpanStyle(color = QuackColor.DuckieOrange),
)
.padding(30.dp),
text = "QuackQuack is an awesome ui kit created by the Duckie team.",
typography = QuackTypography.Body1,
)
```

QuackQuack is a highly automated, excellent stability, well-tested, flexibly pluggable, and Modifier-driven Jetpack Compose UI KIT.
It makes the DUCKIE team's mobile products consistent and prioritizes user and developer experience.

---

## The full documentation is available on the project website: https://quackquack.duckie.team/android
Expand Down
46 changes: 16 additions & 30 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,23 @@ plugins {
}

dependencies {
// 빌드 순서(알파벳순) 문제로 bom 까지만 플러그인 조회됨
// val publishableProjects = rootProject.allprojects.filter { project ->
// project.plugins.hasPlugin(libs.plugins.gradle.publish.maven.core.get().pluginId)
// }

val publishableProjects = with(projects) {
listOf(
util,
utilBackend,
// TODO: publish utilBackendKsp,
utilBackendKotlinc,
// TODO: publish utilBackendTest,
runtime,
material,
animation,
ui,
aide,
aideAnnotation,
aideProcessor,
sugarMaterial,
sugarProcessor,
casaUi,
casaAnnotation,
casaMaterial,
casaProcessor,
)
}.map { project ->
ArtifactConfig.of(project.dependencyProject).toString()
}
val ignoreProjects = listOf(
projects.bom.dependencyProject,
projects.uiSample.dependencyProject,
projects.utilBackendTest.dependencyProject,
projects.docusaurusIntegration.dependencyProject,
)

constraints {
publishableProjects.forEach(::api)
rootProject.subprojects.forEach { project ->
if (project !in ignoreProjects) {
api(
ArtifactConfig.of(project).toString()
.also { artifact ->
println("BOM publishing: $artifact")
},
)
}
}
}
}
2 changes: 1 addition & 1 deletion bom/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.05.25
2023.05.27
21 changes: 16 additions & 5 deletions build-logic/src/main/kotlin/QuackMavenPublishingPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,21 @@ data class ArtifactConfig(
) {
companion object {
fun of(project: Project): ArtifactConfig {
val groupSuffix = project.name.split("-").first()
val module = project.name
val projects = buildList {
tailrec fun Project.addTailrecParentsToListIfNeeded() {
val parent = parent
if (parent != null && parent != parent.rootProject) {
add(parent)
parent.addTailrecParentsToListIfNeeded()
}
}
add(project)
project.addTailrecParentsToListIfNeeded()
}.asReversed()
val rootProject = projects.first()

val groupSuffix = rootProject.name.split("-").first()
val module = projects.joinToString("-", transform = Project::getName)
val version = project.parseArtifactVersion()

return ArtifactConfig(
Expand All @@ -105,7 +118,5 @@ data class ArtifactConfig(
}
}

override fun toString(): String {
return "$group:$module:$version"
}
override fun toString() = "$group:$module:$version"
}
6 changes: 3 additions & 3 deletions build-logic/src/main/kotlin/internal/versioning.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal fun Project.parseArtifactVersion(): String {
if (!versionFile.exists() || !versionFile.isFile) {
error(
"""
There is no version.txt file in the project path.
Try `./gradlew :project:versioning -Ptype=init` for version configuration.
""".trimIndent(),
There is no version.txt file in the project path.
Try `./gradlew :${project.name}:versioning -Ptype=init` for initialize version.
""".trimIndent(),
)
}
return versionFile.readLines().first()
Expand Down
49 changes: 40 additions & 9 deletions build-logic/src/test/kotlin/ArtifactConfigTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,52 @@ class ArtifactConfigTest : StringSpec() {
}

init {
"프로젝트의 아티팩트 주소를 정상적으로 파싱함" {
val buildLogicProject = ProjectBuilder
.builder()
.withName("buildlogic")
.build()
val artifactConfigProject = ProjectBuilder
.builder()
.withName("buildlogic-testing-artifactconfig")
.build()
"단일 프로젝트의 아티팩트 주소를 정상적으로 파싱함" {
val buildLogicProject =
ProjectBuilder
.builder()
.withName("buildlogic")
.build()
val artifactConfigProject =
ProjectBuilder
.builder()
.withName("buildlogic-testing-artifactconfig")
.build()
val buildLogicArtifact = ArtifactConfig.of(buildLogicProject)
val artifactConfigArtifact = ArtifactConfig.of(artifactConfigProject)

buildLogicArtifact.toString() shouldBe "team.duckie.quackquack.buildlogic:buildlogic:TEST"
artifactConfigArtifact.toString() shouldBe "team.duckie.quackquack.buildlogic:buildlogic-testing-artifactconfig:TEST"
}

"중첩 프로젝트의 아티팩트 주소를 정상적으로 파싱함" {
val rootProject =
ProjectBuilder
.builder()
.withName("root")
.build()
val subProject =
ProjectBuilder
.builder()
.withName("root-sub")
.withParent(rootProject)
.build()
val subNestedProject =
ProjectBuilder
.builder()
.withName("nested-project")
.withParent(subProject)
.build()
val subNestedLevel2Project =
ProjectBuilder
.builder()
.withName("level2")
.withParent(subNestedProject)
.build()

val config = ArtifactConfig.of(subNestedLevel2Project).toString()
config shouldBe "team.duckie.quackquack.root:root-sub-nested-project-level2:TEST"
}
}

override suspend fun afterAny(testCase: TestCase, result: TestResult) {
Expand Down
25 changes: 25 additions & 0 deletions casa-ui/report/compose-metrics/casa-ui_debugUnitTest-module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"skippableComposables": 2,
"restartableComposables": 2,
"readonlyComposables": 0,
"totalComposables": 2,
"restartGroups": 2,
"totalGroups": 2,
"staticArguments": 1,
"certainArguments": 0,
"knownStableArguments": 5,
"knownUnstableArguments": 0,
"unknownStableArguments": 0,
"totalArguments": 5,
"markedStableClasses": 0,
"inferredStableClasses": 0,
"inferredUnstableClasses": 0,
"inferredUncertainClasses": 1,
"effectivelyStableClasses": 0,
"totalClasses": 1,
"memoizedLambdas": 2,
"singletonLambdas": 0,
"singletonComposableLambdas": 2,
"composableLambdas": 2,
"totalLambdas": 2
}
6 changes: 3 additions & 3 deletions casa-ui/report/compose-metrics/casa-ui_release-module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"totalGroups": 47,
"staticArguments": 61,
"certainArguments": 42,
"knownStableArguments": 483,
"knownStableArguments": 509,
"knownUnstableArguments": 6,
"unknownStableArguments": 0,
"totalArguments": 489,
"totalArguments": 515,
"markedStableClasses": 0,
"inferredStableClasses": 0,
"inferredUnstableClasses": 0,
Expand All @@ -22,4 +22,4 @@
"singletonComposableLambdas": 9,
"composableLambdas": 20,
"totalLambdas": 54
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
runtime class CasaUiTest {
runtime val compose: AndroidComposeTestRule<ActivityScenarioRule<ComponentActivity>, ComponentActivity>
<runtime stability> = Runtime(AndroidComposeTestRule)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package,name,composable,skippable,restartable,readonly,inline,isLambda,hasDefaults,defaultsGroup,groups,calls,
Empty file.
1 change: 1 addition & 0 deletions catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ dependencies {
projects.ui,
projects.util,
projects.casaUi,
projects.uiPlugin.image.gif,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class MainActivity : ComponentActivity() {
CasaTheme {
CasaScreen(models = casaModels)
}
/*QuackTheme(
plugins = rememberQuackPlugins {
+QuackImageGifPlugin
},
) {
Box(modifier = Modifier.fillMaxSize()) {
QuackImage(src = "https://media.tenor.com/K-Noz5k7X04AAAAi/colors-rainbow.gif")
}
}*/
/*Preview {
var value by rememberSaveable { mutableStateOf("") }
QuackDefaultTextField(
Expand Down
10 changes: 8 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ compose-animation = "1.4.3"
compose-material-ripple = "1.4.3"
compose-material3 = "1.1.0" # for Playground
compose-activity = "1.7.2"
compose-coil = "2.4.0"

coil-compose = "2.4.0"
coil-gif = "2.4.0"
coil-test = "2.4.0"

test-kotest = "5.6.2"
test-junit-core = "4.13.2"
Expand Down Expand Up @@ -103,7 +106,10 @@ compose-animation = { module = "androidx.compose.animation:animation", version.r
compose-material-ripple = { module = "androidx.compose.material:material-ripple", version.ref = "compose-material-ripple" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
compose-activity = { module = "androidx.activity:activity-compose", version.ref = "compose-activity" }
compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "compose-coil" }

coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" }
coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil-gif" }
coil-test = { module = "io.coil-kt:coil-test", version.ref = "coil-test" }

test-android-lint = { module = "com.android.tools.lint:lint-tests", version.ref = "android-lint" }
test-kotest-framework = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "test-kotest" }
Expand Down
1 change: 1 addition & 0 deletions material/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ android {
}

dependencies {
api(projects.uiPlugin.orArtifact())
implementations(
libs.compose.uiutil,
libs.compose.material.ripple,
Expand Down
Loading

0 comments on commit cae66ad

Please sign in to comment.