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

Introduce QuackPlugin #720

Merged
merged 32 commits into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
74da800
Detail coil dependencies in version catalog
jisungbin May 27, 2023
f977523
Added modifier utility to make modifier work easier
jisungbin May 27, 2023
2238581
Added compose-runtime-test module to facilitate Compose Runtime testing
jisungbin May 27, 2023
13ab2fc
Adding pluggable feature to QuackQuack
jisungbin May 27, 2023
49b2076
Added QuackImagePlugin plugin to access Coil inside QuackImage
jisungbin May 27, 2023
669bf76
Added QuackImageGifPlugin plugin to add GIF support to QuackImage
jisungbin May 27, 2023
3fe0aa7
Activate new modules
jisungbin May 27, 2023
cc5917a
Added plugin support to QuackImage
jisungbin May 27, 2023
3dfa06c
Adding a plugin integration point to QuackTheme
jisungbin May 27, 2023
43eafd7
catalog updated
jisungbin May 27, 2023
1e94548
Rebuild
jisungbin May 27, 2023
14cd14a
Changed plugin lookup method from first to last
jisungbin May 27, 2023
3bc6d9c
ui-plugin documentation
jisungbin May 27, 2023
64c8bfd
ui-plugin-image documentation
jisungbin May 27, 2023
2f10373
ui-plugin-image-gif documentation
jisungbin May 27, 2023
cfe8f04
ui documentation
jisungbin May 27, 2023
e91570a
material documentation
jisungbin May 27, 2023
273bde9
Fix dependency
jisungbin May 27, 2023
a868efb
Readme updates
jisungbin May 27, 2023
11e7e2e
Readme updates
jisungbin May 27, 2023
c346118
Update README.md
jisungbin May 27, 2023
83dad9d
Make spotless happy
jisungbin May 27, 2023
54259f7
Remove useless run configuration
jisungbin May 27, 2023
903cb4d
Prepare a new version
jisungbin May 27, 2023
324f02e
Cleanup
jisungbin May 27, 2023
3ec5945
Added support for nested projects to QuackMavenPublishingPlugin
jisungbin May 27, 2023
4a71431
Relnote
jisungbin May 27, 2023
22eb3ec
util-modifier documentation
jisungbin May 27, 2023
4e2ac6c
util-compose-runtime-test documentation
jisungbin May 27, 2023
2c1a1aa
Relnote
jisungbin May 27, 2023
e3c9925
Fix publishing issues
jisungbin May 27, 2023
1bcef2b
Fix bom publishing logic
jisungbin May 27, 2023
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
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