Skip to content

Commit 8c6891c

Browse files
committed
ref: prepare the terrain for build system refactor
1 parent f83f6d8 commit 8c6891c

9 files changed

+318
-326
lines changed

app/build.gradle.kts

Lines changed: 97 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,192 +1,115 @@
1-
//import com.google.wireless.android.sdk.stats.GradleBuildVariant.KotlinOptions
2-
//import org.jetbrains.kotlin.config.JvmTarget
3-
4-
//plugins {
5-
// // Application Specific Plugins
6-
// id(BuildPlugins.androidApplication)
7-
// id(BuildPlugins.kotlinAndroid)
8-
// id(BuildPlugins.kotlinKapt)
9-
// id(BuildPlugins.kotlinAndroidExtensions)
10-
// id(BuildPlugins.androidHilt)
11-
//
12-
// // Internal Script plugins
13-
//// id(ScriptPlugins.variants)
14-
//// id(ScriptPlugins.quality)
15-
//// id(ScriptPlugins.compilation)
16-
//}
17-
//
18-
//android {
19-
// compileSdkVersion(AndroidSdk.compile)
20-
//
21-
// defaultConfig {
22-
// minSdkVersion(AndroidSdk.min)
23-
// targetSdkVersion(AndroidSdk.target)
24-
//
25-
// applicationId = AndroidClient.appId
26-
// versionCode = AndroidClient.versionCode
27-
// versionName = AndroidClient.versionName
28-
// testInstrumentationRunner = AndroidClient.testRunner
29-
// }
30-
//
31-
// sourceSets {
32-
// map { it.java.srcDir("src/${it.name}/kotlin") }
33-
//
34-
// //TODO: Remove this when migrating the DI framework
35-
// getByName("main") { java.srcDir("$buildDir/generated/source/kapt/main") }
36-
// }
37-
//}
1+
@file:Suppress("UnstableApiUsage")
382

3+
class AppConfig {
4+
val id = "com.fernandocejas.sample"
5+
val versionCode = 1
6+
val versionName = "1.0"
397

8+
val compileSdk = libs.versions.compileSdk.get().toInt()
9+
val minSdk = libs.versions.minSdk.get().toInt()
10+
val targetSdk = libs.versions.targetSdk.get().toInt()
4011

41-
plugins {
42-
id("com.android.application")
43-
id("org.jetbrains.kotlin.android")
44-
id("kotlin-android")
45-
id("kotlin-kapt")
46-
id("com.google.dagger.hilt.android")
47-
48-
// id("kotlin-android-extensions")
49-
// kotlin("android.extensions")
50-
// id("dagger.hilt.android.plugin")
51-
// id("com.google.devtools.ksp")
12+
val javaVersion = JavaVersion.VERSION_17
13+
val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
5214
}
5315

54-
//repositories {
55-
// google()
56-
// mavenCentral()
57-
//}
16+
plugins {
17+
id("com.android.application")
18+
id("org.jetbrains.kotlin.android")
19+
id("kotlin-android")
20+
id("kotlin-kapt")
21+
id("com.google.dagger.hilt.android")
22+
}
5823

5924
android {
60-
namespace = "com.fernandocejas.sample"
61-
62-
compileSdk = 33
63-
defaultConfig {
64-
applicationId = "com.fernandocejas.sample"
65-
minSdk = 29
66-
targetSdk = 33
67-
versionCode = 1
68-
versionName = "1.0"
69-
70-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
71-
}
72-
73-
compileOptions {
74-
sourceCompatibility = JavaVersion.VERSION_17
75-
targetCompatibility = JavaVersion.VERSION_17
76-
}
77-
78-
kotlinOptions {
79-
jvmTarget = "17"
80-
}
81-
82-
buildFeatures {
83-
viewBinding = true
84-
}
85-
86-
buildTypes {
87-
getByName("debug") {
88-
isMinifyEnabled = false
25+
val appConfig = AppConfig()
26+
27+
namespace = appConfig.id
28+
compileSdk = appConfig.compileSdk
29+
30+
defaultConfig {
31+
applicationId = appConfig.id
32+
33+
minSdk = appConfig.minSdk
34+
targetSdk = appConfig.targetSdk
35+
versionCode = appConfig.versionCode
36+
versionName = appConfig.versionName
37+
38+
testInstrumentationRunner = appConfig.testInstrumentationRunner
8939
}
90-
getByName("release") {
91-
isMinifyEnabled = false
40+
41+
compileOptions {
42+
sourceCompatibility = appConfig.javaVersion
43+
targetCompatibility = appConfig.javaVersion
44+
}
45+
46+
kotlinOptions {
47+
jvmTarget = appConfig.javaVersion.toString()
9248
}
93-
}
94-
}
9549

96-
//dependencies {
97-
// //Compile time dependencies
98-
// ksp(Libraries.lifecycleCompiler)
99-
// ksp(Libraries.hiltCompiler)
100-
//
101-
// // Application dependencies
102-
// implementation(Libraries.kotlinStdLib)
103-
// implementation(Libraries.kotlinCoroutines)
104-
// implementation(Libraries.kotlinCoroutinesAndroid)
105-
// implementation(Libraries.appCompat)
106-
// implementation(Libraries.ktxCore)
107-
// implementation(Libraries.constraintLayout)
108-
// implementation(Libraries.viewModel)
109-
// implementation(Libraries.liveData)
110-
// implementation(Libraries.lifecycleExtensions)
111-
// implementation(Libraries.cardView)
112-
// implementation(Libraries.recyclerView)
113-
// implementation(Libraries.material)
114-
// implementation(Libraries.androidAnnotations)
115-
// implementation(Libraries.glide)
116-
// implementation(Libraries.hilt)
117-
// implementation(Libraries.retrofit)
118-
// implementation(Libraries.okHttpLoggingInterceptor)
119-
//
120-
// //TODO: change this
121-
// implementation("androidx.fragment:fragment-ktx:1.2.5")
122-
//
123-
// // Unit/Android tests dependencies
124-
// testImplementation(TestLibraries.junit4)
125-
// testImplementation(TestLibraries.mockk)
126-
// testImplementation(TestLibraries.kluent)
127-
// testImplementation(TestLibraries.robolectric)
128-
//
129-
// // Acceptance tests dependencies
130-
// androidTestImplementation(TestLibraries.testRunner)
131-
// androidTestImplementation(TestLibraries.espressoCore)
132-
// androidTestImplementation(TestLibraries.testExtJunit)
133-
// androidTestImplementation(TestLibraries.testRules)
134-
// androidTestImplementation(TestLibraries.espressoIntents)
135-
// androidTestImplementation(TestLibraries.hiltTesting)
136-
//
137-
// // Development dependencies
138-
// debugImplementation(DevLibraries.leakCanary)
139-
//}
50+
buildFeatures {
51+
viewBinding = true
52+
}
53+
54+
buildTypes {
55+
getByName("debug") {
56+
isMinifyEnabled = false
57+
}
58+
getByName("release") {
59+
isMinifyEnabled = false
60+
}
61+
}
62+
}
14063

14164
dependencies {
142-
//Compile time dependencies
65+
//Compile time dependencies
14366
// ksp("androidx.lifecycle:lifecycle-compiler:2.6.1")
14467
// ksp("com.google.dagger:hilt-android-compiler:2.46.1")
145-
kapt("androidx.lifecycle:lifecycle-compiler:2.6.1")
68+
kapt("androidx.lifecycle:lifecycle-compiler:2.6.1")
14669
// kapt("com.google.dagger:hilt-android-compiler:2.46.1")
14770

148-
implementation("com.google.dagger:hilt-android:2.44")
149-
kapt("com.google.dagger:hilt-android-compiler:2.44")
150-
151-
152-
// Application dependencies
153-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")
154-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
155-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
156-
implementation("androidx.appcompat:appcompat:1.6.1")
157-
implementation("androidx.core:core-ktx:1.10.1")
158-
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
159-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
160-
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
161-
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
162-
163-
// Update from here
164-
implementation("androidx.cardview:cardview:1.0.0")
165-
implementation("androidx.recyclerview:recyclerview:1.3.0")
166-
implementation("com.google.android.material:material:1.9.0")
167-
implementation("androidx.annotation:annotation:1.6.0")
168-
implementation("com.github.bumptech.glide:glide:4.15.1")
71+
implementation("com.google.dagger:hilt-android:2.44")
72+
kapt("com.google.dagger:hilt-android-compiler:2.44")
73+
74+
75+
// Application dependencies
76+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")
77+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
78+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
79+
implementation("androidx.appcompat:appcompat:1.6.1")
80+
implementation("androidx.core:core-ktx:1.10.1")
81+
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
82+
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
83+
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
84+
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
85+
86+
// Update from here
87+
implementation("androidx.cardview:cardview:1.0.0")
88+
implementation("androidx.recyclerview:recyclerview:1.3.0")
89+
implementation("com.google.android.material:material:1.9.0")
90+
implementation("androidx.annotation:annotation:1.6.0")
91+
implementation("com.github.bumptech.glide:glide:4.15.1")
16992
// implementation("com.google.dagger:hilt-android:2.46.1")
170-
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
171-
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11")
172-
173-
//TODO: change this
174-
implementation("androidx.fragment:fragment-ktx:1.6.0")
175-
176-
// Unit/Android tests dependencies
177-
testImplementation("junit:junit:4.13.2")
178-
testImplementation("io.mockk:mockk:1.13.5")
179-
testImplementation("org.amshove.kluent:kluent-android:1.73")
180-
testImplementation("org.robolectric:robolectric:4.10.3")
181-
182-
// Acceptance tests dependencies
183-
androidTestImplementation("androidx.test:runner:1.5.2")
184-
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
185-
androidTestImplementation("androidx.test.ext:junit:1.1.5")
186-
androidTestImplementation("androidx.test:rules:1.5.0")
187-
androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1")
188-
androidTestImplementation("com.google.dagger:hilt-android-testing:2.46.1")
189-
190-
// Development dependencies
191-
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12")
93+
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
94+
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11")
95+
96+
//TODO: change this
97+
implementation("androidx.fragment:fragment-ktx:1.6.0")
98+
99+
// Unit/Android tests dependencies
100+
testImplementation("junit:junit:4.13.2")
101+
testImplementation("io.mockk:mockk:1.13.5")
102+
testImplementation("org.amshove.kluent:kluent-android:1.73")
103+
testImplementation("org.robolectric:robolectric:4.10.3")
104+
105+
// Acceptance tests dependencies
106+
androidTestImplementation("androidx.test:runner:1.5.2")
107+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
108+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
109+
androidTestImplementation("androidx.test:rules:1.5.0")
110+
androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1")
111+
androidTestImplementation("com.google.dagger:hilt-android-testing:2.46.1")
112+
113+
// Development dependencies
114+
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12")
192115
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest package="com.fernandocejas.sample"
3-
xmlns:tools="http://schemas.android.com/tools"
43
xmlns:android="http://schemas.android.com/apk/res/android">
54

65
<!--Permissions-->
@@ -14,8 +13,7 @@
1413
android:icon="@mipmap/ic_launcher"
1514
android:label="@string/app_name"
1615
android:supportsRtl="true"
17-
android:theme="@style/AppTheme"
18-
tools:ignore="GoogleAppIndexingWarning">
16+
android:theme="@style/AppTheme">
1917

2018
<!--Activities-->
2119
<activity

build.gradle.kts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,3 @@
1-
//plugins {
2-
// id(ScriptPlugins.infrastructure)
3-
//}
4-
//
5-
//buildscript {
6-
// repositories {
7-
// google()
8-
// jcenter()
9-
// }
10-
//
11-
// dependencies {
12-
// classpath (BuildPlugins.androidGradlePlugin)
13-
// classpath (BuildPlugins.kotlinGradlePlugin)
14-
// classpath (BuildPlugins.hiltGradlePlugin)
15-
// }
16-
//}
17-
18-
//allprojects {
19-
// repositories {
20-
// google()
21-
// jcenter()
22-
// }
23-
//}
24-
25-
26-
//allprojects {
27-
// repositories {
28-
// google()
29-
// jcenter()
30-
// }
31-
//}
32-
33-
341
plugins {
352
/**
363
* Use `apply false` in the top-level build.gradle file to add a Gradle

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#Gradle Properties
2-
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:MaxPermSize=512m -Xmx4608M
2+
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx4608M
33
org.gradle.parallel=true
44
org.gradle.configureondemand=true
55

66
#Application Properties
77
kotlin.incremental=true
88
android.useAndroidX=true
99
android.enableJetifier=true
10-
kotlin.code.style=official
10+
kotlin.code.style=official

gradle/libs.versions.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[versions]
2+
# sdk -----------
3+
compileSdk = "33"
4+
minSdk = "26"
5+
targetSdk = "33"
6+
# kotlin ---------
7+
kotlin = "1.8.22"
8+
kotlinCoroutines = "1.7.2"
9+
# android --------
10+
ktx = "1.10.1"
11+
appCompat = "1.6.1"
12+
materialDesign = "1.1.1"
13+
composeBom = "2023.05.01"
14+
activityCompose = "1.7.2"
15+
liveData = "1.4.3"
16+
# plugings -------
17+
androidGradlePlugin = "8.0.2"
18+
19+
20+
[libraries]
21+
# dependencies ---
22+
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
23+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" }
24+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinCoroutines" }
25+
android-core-ktx = { module = "androidx.core:core-ktx", version.ref = "ktx" }
26+
android-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appCompat" }
27+
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
28+
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "liveData" }
29+
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "materialDesign" }
30+
androidx-compose-material3-window-size = { module = "androidx.compose.material3:material3-window-size-class", version.ref = "materialDesign" }
31+
androidx-activty-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
32+
33+
# tooling --------
34+
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
35+
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
36+
37+
38+
[plugins]
39+
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
40+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

2.81 KB
Binary file not shown.

0 commit comments

Comments
 (0)