Skip to content

Commit 686d701

Browse files
authored
Merge pull request #212 from YAPP-Github/feat/#211-r8
[Feat/#211] R8 난독화 및 코드 축소 도입
2 parents 62d592e + 7628954 commit 686d701

File tree

15 files changed

+76
-30
lines changed

15 files changed

+76
-30
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ android {
7272
?: System.getenv("BITNAGIL_PROD_URL")
7373
?: throw GradleException("bitnagil.prod.url 값이 없습니다.")
7474
buildConfigField("String", "BASE_URL", "\"$prodUrl\"")
75-
isMinifyEnabled = false
75+
isMinifyEnabled = true
76+
isShrinkResources = true
7677
proguardFiles(
7778
getDefaultProguardFile("proguard-android-optimize.txt"),
7879
"proguard-rules.pro",

app/proguard-rules.pro

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
1+
-keepattributes SourceFile,LineNumberTable
2+
-renamesourcefileattribute SourceFile
73

8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
4+
# [Kakao SDK 버그 방어]
5+
# AccessTokenInterceptor에서 ClientErrorCause 상수를 리플렉션(getField)으로 찾기 때문에 난독화에서 제외함
6+
-keep enum com.kakao.sdk.common.model.ClientErrorCause {
7+
*;
8+
}
149

15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
10+
# [Kotlinx Serialization]
11+
# 모든 @Serializable 클래스의 직렬화 로직 및 serializer 메서드 유지
12+
-keepattributes Annotation, InnerClasses, Signature, Exceptions
13+
-keepclassmembers class * {
14+
@kotlinx.serialization.Serializable *;
15+
}
16+
-keepclassmembers class * {
17+
kotlinx.serialization.KSerializer serializer(...);
18+
}
1819

19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
20+
# [Domain/Data Layer Enums]
21+
# API 응답 매핑 및 리플렉션 방어를 위해 Enum 상수 이름 유지
22+
-keepclassmembers enum com.threegap.bitnagil.domain.**.model.** {
23+
<fields>;
24+
}
25+
-keepclassmembers enum com.threegap.bitnagil.data.**.model.** {
26+
<fields>;
27+
}
28+
29+
# [Compose Navigation Type-Safe Arguments]
30+
# 네비게이션 인자 클래스 및 Route 객체 보존
31+
-keep class com.threegap.bitnagil.presentation.**.model.navarg.** { *; }
32+
-keep class com.threegap.bitnagil.Route** { *; }
33+
# HomeRoute는 navigation.home 패키지로 Route** 패턴 밖이므로 별도 보호
34+
# Compose Navigation이 내부적으로 serializer descriptor name을 route ID로 사용하므로
35+
# deep link 추가 시 repackaging으로 빌드마다 route string이 달라지는 문제 방어
36+
-keep class com.threegap.bitnagil.navigation.home.HomeRoute** { *; }
37+
38+
# [Kotlin Result - Retrofit 반환 타입]
39+
# suspend fun foo(): Result<T> 형태의 Retrofit 인터페이스에서
40+
# R8이 kotlin.Result의 제네릭 타입 인자를 지워 call adapter 탐색 실패 방어
41+
-keep class kotlin.Result { *; }
42+
43+
# [Network Libraries]
44+
# Retrofit 및 OkHttp 어노테이션 유지
45+
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
package com.threegap.bitnagil.designsystem.font
22

3+
import androidx.compose.ui.text.ExperimentalTextApi
34
import androidx.compose.ui.text.font.Font
45
import androidx.compose.ui.text.font.FontFamily
5-
import androidx.compose.ui.text.font.FontStyle
6+
import androidx.compose.ui.text.font.FontVariation
67
import androidx.compose.ui.text.font.FontWeight
78
import com.threegap.bitnagil.designsystem.R
89

10+
@OptIn(ExperimentalTextApi::class)
911
val pretendard = FontFamily(
10-
Font(R.font.pretendard_black, FontWeight.Black, FontStyle.Normal),
11-
Font(R.font.pretendard_extra_bold, FontWeight.ExtraBold, FontStyle.Normal),
12-
Font(R.font.pretendard_bold, FontWeight.Bold, FontStyle.Normal),
13-
Font(R.font.pretendard_semi_bold, FontWeight.SemiBold, FontStyle.Normal),
14-
Font(R.font.pretendard_medium, FontWeight.Medium, FontStyle.Normal),
15-
Font(R.font.pretendard_regular, FontWeight.Normal, FontStyle.Normal),
16-
Font(R.font.pretendard_light, FontWeight.Light, FontStyle.Normal),
17-
Font(R.font.pretendard_extra_light, FontWeight.ExtraLight, FontStyle.Normal),
18-
Font(R.font.pretendard_thin, FontWeight.Thin, FontStyle.Normal),
12+
Font(
13+
resId = R.font.pretendard_variable,
14+
weight = FontWeight.Bold,
15+
variationSettings = FontVariation.Settings(FontVariation.weight(700)),
16+
),
17+
Font(
18+
resId = R.font.pretendard_variable,
19+
weight = FontWeight.SemiBold,
20+
variationSettings = FontVariation.Settings(FontVariation.weight(600)),
21+
),
22+
Font(
23+
resId = R.font.pretendard_variable,
24+
weight = FontWeight.Medium,
25+
variationSettings = FontVariation.Settings(FontVariation.weight(500)),
26+
),
27+
Font(
28+
resId = R.font.pretendard_variable,
29+
weight = FontWeight.Normal,
30+
variationSettings = FontVariation.Settings(FontVariation.weight(400)),
31+
),
1932
)
2033

2134
val cafe24SsurroundAir = FontFamily(
22-
Font(R.font.cafe_24_ssurround_air_v1_1, FontWeight.Light, FontStyle.Normal),
35+
Font(R.font.cafe_24_ssurround_air_v1_1, FontWeight.Light),
2336
)
-1.49 MB
Binary file not shown.
-1.5 MB
Binary file not shown.
-1.5 MB
Binary file not shown.
-1.47 MB
Binary file not shown.
-1.53 MB
Binary file not shown.
-1.51 MB
Binary file not shown.
-1.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)