Skip to content

Commit a72afca

Browse files
committed
Initial core:testing module
Initial core:designsystem module Initial ui-test-hilt-manifest module
1 parent 7ecb638 commit a72afca

File tree

14 files changed

+227
-41
lines changed

14 files changed

+227
-41
lines changed

app/build.gradle.kts

Lines changed: 59 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import com.wei.picquest.PqBuildType
2+
13
plugins {
2-
id("com.android.application")
3-
id("org.jetbrains.kotlin.android")
4+
alias(libs.plugins.pq.android.application)
5+
alias(libs.plugins.pq.android.application.compose)
6+
alias(libs.plugins.pq.android.application.flavors)
7+
alias(libs.plugins.pq.android.hilt)
48
}
59

610
android {
711
namespace = "com.wei.picquest"
8-
compileSdk = 34
912

1013
defaultConfig {
1114
applicationId = "com.wei.picquest"
12-
minSdk = 21
13-
targetSdk = 34
1415
/**
1516
* Version Code: AABCXYZ
1617
*
@@ -28,7 +29,9 @@ android {
2829
*/
2930
versionName = "0.0.0"
3031

32+
// TODO Wei Custom test runner to set up Hilt dependency graph
3133
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
34+
3235
vectorDrawables {
3336
useSupportLibrary = true
3437
}
@@ -44,29 +47,27 @@ android {
4447
}
4548
}
4649

47-
compileOptions {
48-
sourceCompatibility = JavaVersion.VERSION_17
49-
targetCompatibility = JavaVersion.VERSION_17
50-
}
51-
52-
kotlinOptions {
53-
jvmTarget = JavaVersion.VERSION_17.toString()
54-
}
55-
56-
buildFeatures {
57-
compose = true
58-
}
50+
buildTypes {
51+
debug {
52+
applicationIdSuffix = PqBuildType.DEBUG.applicationIdSuffix
53+
}
54+
release {
55+
isMinifyEnabled = true
56+
applicationIdSuffix = PqBuildType.RELEASE.applicationIdSuffix
57+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
5958

60-
composeOptions {
61-
kotlinCompilerExtensionVersion = "1.5.3"
59+
// To publish on the Play store a private signing key is required, but to allow anyone
60+
// who clones the code to sign and run the release variant, use the debug signing key.
61+
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
62+
signingConfig = signingConfigs.getByName("debug")
63+
}
6264
}
6365

6466
packaging {
6567
resources {
6668
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
6769
}
6870
}
69-
7071
testOptions {
7172
unitTests {
7273
isIncludeAndroidResources = true
@@ -75,22 +76,45 @@ android {
7576
}
7677

7778
dependencies {
79+
// TODO Wei
80+
// implementation(project(":feature:login"))
81+
// implementation(project(":feature:home"))
82+
// implementation(project(":feature:contactme"))
83+
84+
implementation(project(":core:designsystem"))
85+
// implementation(project(":core:common"))
86+
// implementation(project(":core:data"))
87+
// implementation(project(":core:model"))
88+
// implementation(project(":core:datastore"))
89+
90+
androidTestImplementation(project(":core:designsystem"))
91+
// androidTestImplementation(project(":core:datastore-test"))
92+
// androidTestImplementation(project(":core:testing"))
93+
androidTestImplementation(libs.androidx.navigation.testing)
94+
androidTestImplementation(libs.accompanist.testharness)
95+
// testImplementation(project(":core:datastore-test"))
96+
// testImplementation(project(":core:testing"))
97+
testImplementation(libs.androidx.navigation.testing)
98+
testImplementation(libs.accompanist.testharness)
99+
// debugImplementation(project(":ui-test-hilt-manifest"))
100+
debugImplementation(libs.androidx.compose.ui.testManifest)
101+
102+
implementation(libs.androidx.core.ktx)
103+
implementation(libs.androidx.activity.compose)
104+
105+
// LifeCycle
106+
implementation(libs.androidx.lifecycle.livedata.ktx)
107+
implementation(libs.androidx.lifecycle.runtimeCompose)
108+
109+
// Navigation
110+
implementation(libs.androidx.hilt.navigation.compose)
111+
implementation(libs.androidx.navigation.compose)
112+
113+
// Coroutines
114+
implementation(libs.kotlinx.coroutines.android)
78115

79-
implementation("androidx.core:core-ktx:1.12.0")
80-
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
81-
implementation("androidx.activity:activity-compose:1.8.1")
82-
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
83-
implementation("androidx.compose.ui:ui")
84-
implementation("androidx.compose.ui:ui-graphics")
85-
implementation("androidx.compose.ui:ui-tooling-preview")
86-
implementation("androidx.compose.material3:material3")
87-
testImplementation("junit:junit:4.13.2")
88-
androidTestImplementation("androidx.test.ext:junit:1.1.5")
89-
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
90-
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
91-
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
92-
debugImplementation("androidx.compose.ui:ui-tooling")
93-
debugImplementation("androidx.compose.ui:ui-test-manifest")
116+
// Splashscreen
117+
implementation(libs.androidx.core.splashscreen)
94118

95119
// Timber
96120
implementation(libs.timber)

app/proguard-rules.pro

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add project specific ProGuard rules here.
22
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
3+
# proguardFiles setting in build.gradle.kts.
44
#
55
# For more details, see
66
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -18,4 +18,24 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
22+
23+
-dontwarn org.bouncycastle.jsse.BCSSLParameters
24+
-dontwarn org.bouncycastle.jsse.BCSSLSocket
25+
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
26+
-dontwarn org.conscrypt.Conscrypt$Version
27+
-dontwarn org.conscrypt.Conscrypt
28+
-dontwarn org.conscrypt.ConscryptHostnameVerifier
29+
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
30+
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
31+
-dontwarn org.openjsse.net.ssl.OpenJSSE
32+
33+
# Fix for Retrofit issue https://github.com/square/retrofit/issues/3751
34+
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
35+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
36+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
37+
38+
# With R8 full mode generic signatures are stripped for classes that are not
39+
# kept. Suspend functions are wrapped in continuations where the type argument
40+
# is used.
41+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

build.gradle.kts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ buildscript {
77
}
88

99
plugins {
10-
id("com.android.application") version "8.1.0-rc01" apply false
11-
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
12-
}
10+
alias(libs.plugins.android.application) apply false
11+
alias(libs.plugins.android.library) apply false
12+
alias(libs.plugins.kotlin.android) apply false
13+
alias(libs.plugins.navigation.safeargs.kotlin) apply false
14+
alias(libs.plugins.hilt) apply false
15+
alias(libs.plugins.kotlin.jvm) apply false
16+
alias(libs.plugins.kotlin.serialization) apply false
17+
alias(libs.plugins.ksp) apply false
18+
alias(libs.plugins.secrets) apply false
19+
alias(libs.plugins.roborazzi) apply false
20+
}

core/designsystem/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

core/designsystem/build.gradle.kts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
plugins {
2+
alias(libs.plugins.pq.android.library)
3+
alias(libs.plugins.pq.android.library.compose)
4+
alias(libs.plugins.pq.android.hilt)
5+
}
6+
7+
android {
8+
namespace = "com.wei.picquest.core.designsystem"
9+
10+
defaultConfig {
11+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
12+
}
13+
}
14+
15+
dependencies {
16+
androidTestImplementation(project(":core:testing"))
17+
18+
// Write trace events to the system trace buffer.
19+
api(libs.androidx.tracing.ktx)
20+
// Material Design 3
21+
api(libs.androidx.compose.material3)
22+
api(libs.androidx.compose.material3.windowSizeClass)
23+
api(libs.androidx.compose.material.iconsExtended)
24+
// main APIs for the underlying toolkit systems,
25+
// such as input and measurement/layout
26+
api(libs.androidx.compose.ui.util)
27+
api(libs.androidx.compose.foundation)
28+
api(libs.androidx.compose.foundation.layout)
29+
api(libs.androidx.compose.runtime)
30+
// Android Studio Preview support
31+
api(libs.androidx.compose.ui.tooling.preview)
32+
api(libs.androidx.compose.ui.tooling)
33+
// Optional - Integration with window
34+
api(libs.androidx.window)
35+
// Optional - Integration with LiveData
36+
api(libs.androidx.compose.runtime.livedata)
37+
// Optional - accompanist adaptive
38+
api(libs.accompanist.adaptive)
39+
40+
implementation(libs.androidx.core.ktx)
41+
// Optional - Integration with activities
42+
implementation(libs.androidx.activity.compose)
43+
// Optional - Integration with browser
44+
implementation(libs.androidx.browser)
45+
// Coil
46+
implementation(libs.coil.kt)
47+
implementation(libs.coil.kt.compose)
48+
implementation(libs.coil.kt.svg)
49+
// kotlin datetime
50+
implementation(libs.kotlinx.datetime)
51+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>

core/testing/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

core/testing/build.gradle.kts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins {
2+
alias(libs.plugins.pq.android.library)
3+
alias(libs.plugins.pq.android.library.compose)
4+
alias(libs.plugins.pq.android.hilt)
5+
}
6+
7+
android {
8+
namespace = "com.wei.picquest.core.testing"
9+
}
10+
11+
12+
dependencies {
13+
// TODO Wei
14+
// implementation(project(":core:common"))
15+
// implementation(project(":core:data"))
16+
// implementation(project(":core:model"))
17+
// implementation(project(":core:domain"))
18+
// implementation(project(":core:network"))
19+
implementation(project(":core:designsystem"))
20+
21+
api(libs.junit4)
22+
api(libs.androidx.activity.compose)
23+
api(libs.androidx.compose.ui.test)
24+
api(libs.androidx.test.espresso.core)
25+
api(libs.androidx.test.core)
26+
api(libs.androidx.test.runner)
27+
// testharness
28+
api(libs.accompanist.testharness)
29+
// Coroutines test
30+
api(libs.kotlinx.coroutines.test)
31+
api(libs.hilt.android.testing)
32+
// Google truth
33+
api(libs.google.truth)
34+
// For flow test
35+
api(libs.turbine)
36+
// Android Unit Testing Framework
37+
api(libs.robolectric.shadows)
38+
// For screenshot tests
39+
api(libs.roborazzi)
40+
41+
debugApi(libs.androidx.compose.ui.testManifest)
42+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>

settings.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ dependencyResolutionManagement {
1717

1818
rootProject.name = "PicQuest"
1919
include(":app")
20-
20+
21+
include(":core:designsystem")
22+
include(":core:testing")
23+
24+
include(":ui-test-hilt-manifest")

ui-test-hilt-manifest/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
alias(libs.plugins.pq.android.library)
3+
alias(libs.plugins.pq.android.hilt)
4+
}
5+
6+
android {
7+
namespace = "com.wei.picquest.uitesthiltmanifest"
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<application>
4+
<activity android:name=".HiltComponentActivity" />
5+
</application>
6+
7+
</manifest>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.wei.picquest.uitesthiltmanifest
2+
3+
import androidx.activity.ComponentActivity
4+
import dagger.hilt.android.AndroidEntryPoint
5+
6+
/**
7+
* A [ComponentActivity] annotated with [AndroidEntryPoint] for use in tests, as a workaround
8+
* for https://github.com/google/dagger/issues/3394
9+
*/
10+
@AndroidEntryPoint
11+
class HiltComponentActivity : ComponentActivity()

0 commit comments

Comments
 (0)