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

Establish build-logic module for centralized dependency management. #2

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
99 changes: 63 additions & 36 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import com.wei.picquest.PqBuildType

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
alias(libs.plugins.pq.android.application)
alias(libs.plugins.pq.android.application.compose)
alias(libs.plugins.pq.android.application.flavors)
alias(libs.plugins.pq.android.hilt)
}

android {
namespace = "com.wei.picquest"
compileSdk = 34

defaultConfig {
applicationId = "com.wei.picquest"
minSdk = 21
targetSdk = 34
/**
* Version Code: AABCXYZ
*
Expand All @@ -28,7 +29,9 @@ android {
*/
versionName = "0.0.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// Custom test runner to set up Hilt dependency graph
testInstrumentationRunner = "com.wei.picquest.core.testing.PqTestRunner"

vectorDrawables {
useSupportLibrary = true
}
Expand All @@ -44,29 +47,27 @@ android {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

buildFeatures {
compose = true
}
buildTypes {
debug {
applicationIdSuffix = PqBuildType.DEBUG.applicationIdSuffix
}
release {
isMinifyEnabled = true
applicationIdSuffix = PqBuildType.RELEASE.applicationIdSuffix
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")

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

packaging {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}

testOptions {
unitTests {
isIncludeAndroidResources = true
Expand All @@ -75,20 +76,46 @@ android {
}

dependencies {
// TODO Wei
// implementation(project(":feature:login"))
// implementation(project(":feature:home"))
// implementation(project(":feature:contactme"))

implementation(project(":core:designsystem"))
implementation(project(":core:common"))
implementation(project(":core:data"))
implementation(project(":core:model"))
// implementation(project(":core:datastore"))

androidTestImplementation(project(":core:designsystem"))
// androidTestImplementation(project(":core:datastore-test"))
androidTestImplementation(project(":core:testing"))
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.accompanist.testharness)
// testImplementation(project(":core:datastore-test"))
testImplementation(project(":core:testing"))
testImplementation(libs.androidx.navigation.testing)
testImplementation(libs.accompanist.testharness)
debugImplementation(project(":ui-test-hilt-manifest"))
debugImplementation(libs.androidx.compose.ui.testManifest)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)

// LifeCycle
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.lifecycle.runtimeCompose)

// Navigation
implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.androidx.navigation.compose)

// Coroutines
implementation(libs.kotlinx.coroutines.android)

// Splashscreen
implementation(libs.androidx.core.splashscreen)

implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
implementation("androidx.activity:activity-compose:1.8.1")
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
// Timber
implementation(libs.timber)
}
24 changes: 22 additions & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand All @@ -18,4 +18,24 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

# Fix for Retrofit issue https://github.com/square/retrofit/issues/3751
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
15 changes: 11 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".PqApplication"
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.PicQuest"
android:theme="@style/Theme.Pq.Splash"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.PicQuest">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/wei/picquest/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.wei.picquest.ui.theme.PicQuestTheme
import com.wei.picquest.core.designsystem.theme.PqTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
PicQuestTheme {
PqTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Greeting("Android")
Greeting("PicQuest")
}
}
}
Expand All @@ -40,7 +40,7 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
PicQuestTheme {
Greeting("Android")
PqTheme {
Greeting("PicQuest")
}
}
17 changes: 17 additions & 0 deletions app/src/main/java/com/wei/picquest/PqApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.wei.picquest

import android.app.Application
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class PqApplication : Application() {

override fun onCreate() {
super.onCreate()

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
}
11 changes: 0 additions & 11 deletions app/src/main/java/com/wei/picquest/ui/theme/Color.kt

This file was deleted.

70 changes: 0 additions & 70 deletions app/src/main/java/com/wei/picquest/ui/theme/Theme.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/java/com/wei/picquest/ui/theme/Type.kt

This file was deleted.

Loading
Loading