Skip to content

Commit

Permalink
Prepare working sample & Cleanup (#679)
Browse files Browse the repository at this point in the history
* Improve build configuration

* Rebuild

* Remove test logging

* Prepare working sample

* Make useArtifact to private

* Improve document

* Cleanup

* Remove sample sourceset

* Prepare working sample

* Prepare working sample

* Remove sampled-annotation module

* Remove sampled-annotation module

* Configure ui-sample module

* Dummy

* Bump agp

* Rollback agp bump

* Bump agp (re)

* Fix build error for ui-sample module
  • Loading branch information
jisungbin committed May 11, 2023
1 parent bc78bd0 commit 0dcdcc9
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 22 deletions.
29 changes: 29 additions & 0 deletions .run/template-gradle.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
~ Designed and developed by Duckie Team 2023.
~
~ Licensed under the MIT.
~ Please see full license: https://github.com/duckie-team/quack-quack-android/blob/main/LICENSE
-->

<component name="ProjectRunConfigurationManager">
<configuration default="true" factoryName="Gradle" type="GradleRunConfiguration">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>false</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion .run/unit-test.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>false</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<ForceTestExec>true</ForceTestExec>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ internal val quackComponents: Map<String, String> = run {

aide["QuackButton"] = "button"
aide["QuackBaseButton"] = "button"
aide["QuackLargeButton"] = "button"
aide["QuackPrimaryLargeButton"] = "button"
aide["QuackSecondaryLargeButton"] = "button"
aide["QuackMediumButton"] = "button"
aide["QuackSmallButton"] = "button"
aide["QuackPrimaryFilledSmallButton"] = "button"
aide["QuackPrimaryOutlinedSmallButton"] = "button"
aide["QuackPrimaryOutlinedRoundSmallButton"] = "button"
aide["QuackSecondarySmallButton"] = "button"
aide["QuackSecondaryRoundSmallButton"] = "button"

aide["QuackBody1"] = "text"
aide["QuackBody2"] = "text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.snap
import androidx.compose.animation.core.tween
import androidx.compose.runtime.Stable
import team.duckie.quackquack.util.DelicateQuackApi
import team.duckie.quackquack.util.DelicateQuackQuackApi

/**
* 꽥꽥에서 기본적으로 사용할 애니메이션의 기본 지속 시간
Expand Down Expand Up @@ -44,7 +44,7 @@ public object QuackAnimationSpec {
*
* **이 값의 변경은 모든 애니메이션에 영향을 미치므로 신중하게 사용해야 합니다.**
*/
@DelicateQuackApi
@DelicateQuackQuackApi
public var snapMode: Boolean = false

/**
Expand All @@ -56,7 +56,7 @@ public object QuackAnimationSpec {
*
* @see snapMode
*/
@OptIn(DelicateQuackApi::class)
@OptIn(DelicateQuackQuackApi::class)
public operator fun <T> invoke(): DurationBasedAnimationSpec<T> = when (snapMode) {
true -> snap()
else -> tween(
Expand Down
2 changes: 1 addition & 1 deletion build-logic/src/main/kotlin/ProjectOrArtifact.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import org.gradle.api.artifacts.ProjectDependency
* 로컬 모듈을 아티팩트로 변환하는 로직은 [ProjectDependency.orArtifact]를
* 참고하세요.
*/
const val useArtifact = false
private const val useArtifact = false

/**
* 로컬 모듈을 publishing된 아티팩트로 변환합니다.
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ plugins {
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.gradle.dependency.graph)
alias(libs.plugins.gradle.dependency.handler.extensions)
alias(libs.plugins.kotlin.jvm) apply false
idea
}

Expand Down
7 changes: 6 additions & 1 deletion docusaurus-integration/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Please see full license: https://github.com/duckie-team/quack-quack-android/blob/main/LICENSE
*/

@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

plugins {
quackquack("jvm-kotlin")
quackquack("quack-publishing")
Expand All @@ -13,6 +15,9 @@ plugins {

dependencies {
compileOnly(libs.kotlin.embeddable.compiler)
implementation(libs.google.autoservice.annotation)
implementations(
libs.google.autoservice.annotation,
projects.utilBackendKotlinc,
)
ksp(libs.google.autoservice.ksp.processor)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
import org.jetbrains.kotlin.ir.util.dumpKotlinLike
import org.jetbrains.kotlin.ir.util.file
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import team.duckie.quackquack.util.backend.kotlinc.locationOf

internal class DRPIrVisitor(
@Suppress("unused") private val context: IrPluginContext,
Expand All @@ -33,14 +34,24 @@ internal class DRPIrVisitor(
}

override fun visitSimpleFunction(declaration: IrSimpleFunction) {
logger(declaration.dumpKotlinLike())
val message = with(declaration.file.locationOf(declaration)) {
"""
[name: ${declaration.name.asString()}]
path: $path
line: $line
column: $column
lineEnd: $lineEnd
columnEnd: $columnEnd
""".trimIndent()
}
logger(message)
}

override fun visitTypeAlias(declaration: IrTypeAlias) {
logger(declaration.dumpKotlinLike())
logger(declaration.name.asString())
}

override fun visitClass(declaration: IrClass) {
logger(declaration.dumpKotlinLike())
logger(declaration.name.asString())
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
gradle-android = "8.2.0-alpha02"
gradle-android = "8.2.0-alpha03"
gradle-publish-maven = "0.25.2"
gradle-dependency-handler-extensions = "1.1.0"
gradle-dependency-graph = "1.1.0"
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ include(
":material",
":animation",
":ui",
":ui-sample",
":aide",
":aide-annotation",
":aide-processor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ internal class SugarIrVisitor(
optins = optins,
)

logger(with(logger) { sugarIrData.prependLogPrefix(withNewline = true) })
// logger(with(logger) { sugarIrData.prependLogPrefix(withNewline = true) })
addSugarIrData(sugarIrData)
}
}
Expand Down
29 changes: 29 additions & 0 deletions ui-sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Designed and developed by Duckie Team 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/duckie-team/quack-quack-android/blob/main/LICENSE
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
quackquack("android-library")
quackquack("android-compose")
}

android {
namespace = "team.duckie.quackquack.ui.sample"

sourceSets {
getByName("main").java.srcDir("src/sample/kotlin")
}
}

tasks.withType<KotlinCompile> {
enabled = false
}

dependencies {
compileOnly(projects.ui)
}
8 changes: 8 additions & 0 deletions ui-sample/src/sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Designed and developed by Duckie Team 2023.
~
~ Licensed under the MIT.
~ Please see full license: https://github.com/duckie-team/quack-quack-android/blob/main/LICENSE
-->

<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Designed and developed by Duckie Team 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/duckie-team/quack-quack-android/blob/main/LICENSE
*/

@file:Suppress("unused")

package team.duckie.quackquack.ui.sample

import androidx.compose.runtime.Composable
import team.duckie.quackquack.material.QuackTypography
import team.duckie.quackquack.ui.QuackText

@Composable
fun SampleTest() {
QuackText(text = "Hello, World!", typography = QuackTypography.Body1)
}
7 changes: 7 additions & 0 deletions ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ ksp {
arg("CasaPath", "$rootDir/catalog/src/main/kotlin/team/duckie/quackquack/catalog")
}

val sample: Configuration by configurations.creating {
isCanBeResolved = false
isCanBeConsumed = false
}

dependencies {
sample(projects.uiSample)

apis(
projects.animation.orArtifact(),
projects.sugarMaterial.orArtifact(),
Expand Down
6 changes: 3 additions & 3 deletions ui/src/androidTest/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### 테스트 방식
## 테스트 방식

https://twitter.com/ji_sungbin/status/1654405012926369793
https://quackquack.duckie.team/android/testing#snapshot-test

### @RequiresApi(Build.VERSION_CODES.O)
## @RequiresApi(Build.VERSION_CODES.O)

SDK Level 26부터 테스트 가능
20 changes: 20 additions & 0 deletions ui/src/main/kotlin/team/duckie/quackquack/ui/sugar/text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import team.duckie.quackquack.ui.QuackText
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -82,6 +84,8 @@ public fun QuackBody1(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -119,6 +123,8 @@ public fun QuackBody2(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -156,6 +162,8 @@ public fun QuackBody3(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -193,6 +201,8 @@ public fun QuackHeadLine1(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -230,6 +240,8 @@ public fun QuackHeadLine2(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -267,6 +279,8 @@ public fun QuackLarge1(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -304,6 +318,8 @@ public fun QuackSubtitle(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -341,6 +357,8 @@ public fun QuackSubtitle2(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down Expand Up @@ -378,6 +396,8 @@ public fun QuackTitle1(
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@Casa
@Composable
Expand Down
2 changes: 2 additions & 0 deletions ui/src/main/kotlin/team/duckie/quackquack/ui/text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ internal object QuackTextErrors {
* 가로 공간이 무제한인 것처럼 배치됩니다. 또한 [overflow] 및 [TextAlign]에 예기치 않은
* 효과가 발생할 수 있습니다.
* @param overflow 시각적 overflow를 처리하는 방법
*
* @sample team.duckie.quackquack.ui.sample.SampleTest
*/
@SugarName(SugarName.PREFIX_NAME + SugarName.TOKEN_NAME)
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ package team.duckie.quackquack.util
@Retention(AnnotationRetention.SOURCE)
public annotation class AllowMagicNumber(val because: String)

/**
* 주의깊게 사용해야 하는 API임을 나타냅니다.
*/
/** 주의깊게 사용해야 하는 API임을 나타냅니다. */
@MustBeDocumented
@Retention(AnnotationRetention.BINARY)
@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "This is a delicate API and its use requires care. Make sure you fully read " +
"and understand documentation of the declaration that is marked as a delicate API.",
)
public annotation class DelicateQuackApi
public annotation class DelicateQuackQuackApi

/**
* 매우 실험적인 함수이기에 사용하기 전에 테스트가 꼭 필요함을 나타냅니다.
Expand Down

0 comments on commit 0dcdcc9

Please sign in to comment.